could anyone help me with this mod commands [message #336131] |
Fri, 20 June 2008 05:42 ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/custom_avatars/23242.gif) |
cpjok
Messages: 425 Registered: September 2007
Karma: 0
|
Commander |
|
|
ok it works but theres some problems
when they have got anoth to buy it they can buy it and it takes there creds but
if they dont have enougth to buy it but use the command it gives them the item and dosent charge them
Quote: | class RailChatCommand : public ChatCommandClass {
void Triggered(int ID,const TokenClass &Text,int ChatType) {
GameObject *obj = Get_GameObj(ID);
char message[256];
Console_Input(StrFormat("cmsg 166,149,56 [BZ-BOT]: Someone Bought A Railgun",ID).c_str());
Console_Input(message);
Commands->Give_Powerup(obj,"POW_Railgun_Player",false);
float Credits = Commands->Get_Money(obj);
if(Credits >= 600 ){
Commands->Give_Money(obj,-600,false);
}
else{
Console_Input(StrFormat("ppage %d Rail Cost 600 ",Get_Player_ID(obj)).c_str());
}
}
};
ChatCommandRegistrant<RailChatCommand> RailChatCommandReg("!rail",CHATTYPE_ALL,0,GAMEMODE_AOW);
|
|
|
|
|
Re: could anyone help me with this mod commands [message #336142 is a reply to message #336131] |
Fri, 20 June 2008 07:02 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/custom_avatars/1562.jpg) |
zunnie
Messages: 2959 Registered: September 2003 Location: Netherlands
Karma: 0
|
General (2 Stars) |
![jannemanjr](/theme/Renegade_Forums/images/skype.png)
|
|
Try like this. You had the give powerup command before it did
the money check so you would get the powerup even if you didnt have enough money.
class RailChatCommand : public ChatCommandClass {
void Triggered(int ID,const TokenClass &Text,int ChatType)
{
GameObject *obj = Get_GameObj(ID);
char message[256];
float Credits = Commands->Get_Money(obj);
if(Credits >= 600 )
{
Commands->Give_Money(obj,-600,false);
Console_Input(StrFormat("cmsg 166,149,56 [BZ-BOT]: Someone Bought A Railgun",ID).c_str());
Console_Input(message);
Commands->Give_Powerup(obj,"POW_Railgun_Player",false);
}
else
{
Console_Input(StrFormat("ppage %d Rail Cost 600 ",Get_Player_ID(obj)).c_str());
}
}
};
ChatCommandRegistrant<RailChatCommand> RailChatCommandReg("!rail",CHATTYPE_ALL,0,GAMEMODE_AOW);
[Updated on: Fri, 20 June 2008 07:03] Report message to a moderator
|
|
|
|