C++ error [message #363028] |
Sat, 13 December 2008 12:43 |
|
YazooGang
Messages: 742 Registered: August 2008 Location: US
Karma: 0
|
Colonel |
|
|
i wanted to make something quick for my renegade server and i made this simple command so in the future, it might be useful to like modify it and use it for something else:
class weaponmodChatCommand : public ChatCommandClass {
void Triggered(int ID,const TokenClass &Text,int ChatType) {
GameObject *obj = Get_GameObj(ID);
if (state == WeaponClass::Firing)
{
Commands->Give_Points(obj,10,false);
Commands->Give_Money(obj,10,false);
}
else
{
//nothing
}
}
};
ChatCommandRegistrant<weaponmodChatCommand> weaponmodChatCommandReg("!modw",CHATTYPE_ALL,0,GAMEMODE_AOW);
well, unfortunatly, i got errors:
Quote: | Error 1 error C2065: 'state' : undeclared identifier c:\Westwood\RenegadeFDS\Server\gmmain.cpp 1302
|
Quote: | Error 2 error C2597: illegal reference to non-static member 'WeaponClass::Firing' c:\Westwood\RenegadeFDS\Server\gmmain.cpp 1302
|
Quote: | Error 3 error C3867: 'WeaponClass::Firing': function call missing argument list; use '&WeaponClass::Firing' to create a pointer to member c:\Westwood\RenegadeFDS\Server\gmmain.cpp 1302
|
Quote: | Error 4 error C2568: '==' : unable to resolve function overload c:\Westwood\RenegadeFDS\Server\gmmain.cpp 1302
|
Quote: | Error 5 error BK1506 : cannot open file '.\tmp\scripts\debug\gmmain.sbr': No such file or directory BSCMAKE
|
help?
[Updated on: Sat, 13 December 2008 12:43] Report message to a moderator
|
|
|
|
|
|
|
Re: C++ error [message #363038 is a reply to message #363028] |
Sat, 13 December 2008 13:24 |
|
cAmpa
Messages: 597 Registered: March 2006
Karma: 0
|
Colonel |
|
|
Quote: | Like the weapon i'm currently holding.
i think thats the problem lol
|
?? state is nothing in your code = undeclared identifier
And wtf is a "aa command"?
Bückstabü!
|
|
|
Re: C++ error [message #363039 is a reply to message #363038] |
Sat, 13 December 2008 13:31 |
|
YazooGang
Messages: 742 Registered: August 2008 Location: US
Karma: 0
|
Colonel |
|
|
cAmpa wrote on Sat, 13 December 2008 14:24 |
Quote: | Like the weapon i'm currently holding.
i think thats the problem lol
|
?? state is nothing in your code = undeclared identifier
And wtf is a "aa command"?
|
A commands like !help !buy !kick ect...
and i got the state thing from the this code
if (state == WeaponClass::WS_RELOADING){
barx = (float)draw.Draw_Single_Line(D3DCOLOR_XRGB(255,255,0), 0, 0, L"Charging... ");
barx *= draw.GetScalar();
DrawChargeBar(barx, 0.003f, 0.02f, 0.004f, 1.0f-(1.0f/reloadtime*statetime), D3DCOLOR_XRGB(255,255,0), D3DCOLOR_XRGB(255,255,0), D3DCOLOR_XRGB(0,0,0));
} else if (maxammo == 0 && _ammo == 0)
draw.Draw_Single_Line(D3DCOLOR_XRGB(255,0,0), 0, 0, L"Battery depleted.");
else
draw.Draw_Single_Line(D3DCOLOR_XRGB(0,255,0), 0, 0, L"Charged.");
if (g_pPICBatch->Serialize())
g_pPICBatch->Render();
|
|
|
|
|
|
|
|
Re: C++ error [message #363052 is a reply to message #363050] |
Sat, 13 December 2008 15:14 |
|
saberhawk
Messages: 1068 Registered: January 2006 Location: ::1
Karma: 0
|
General (1 Star) |
|
|
You can't. SK's code which you blindly copied and modified works only on the client as a RenderObject using alot of code that SSGM simply doesn't have access to. Due to the client side nature of the code, even if SSGM did have access to that code, it wouldn't be able to actually *do* anything because the server is not your client.
|
|
|
Re: C++ error [message #363110 is a reply to message #363050] |
Sun, 14 December 2008 05:09 |
|
reborn
Messages: 3231 Registered: September 2004 Location: uk - london
Karma: 0
|
General (3 Stars) |
|
|
YazooGang wrote on Sat, 13 December 2008 17:05 | so then how would i make a command that gives me money and points each time i fire a bullet?
|
You can check the ammo count in a persons weapon clip, if you attached a timer script to the person that checked there ammo count for the weapon they're holding it could work. You'd have to constantly check the ammo count and if it is less then the previous time you checked, you can assume they're firing a weapon and grant them points and money.
To make it a chat hook command, you could simply attach this script to the player only when they type that command.
There are flaws in this idea though. You could pick up crates that remove the weapons or ammo. You would also have to make sure it is counting the ammo of the current weapon, and account for them switching weapons too.
It'd be a little work, and a totally crappy way of doing it, but it'd probably work.
|
|
|