07.07.2009, 14:33
Hi there, im working on my bet command.
This is what I got so far:
It compiles fine, but the problem is, when I type for example /bet 1000 red ingame, it gives me UNKNOWN command, anyone out there who knows the solution?
thx in advance
This is what I got so far:
pawn Код:
if(strcmp("/bet", cmdtext, true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bet [amount] [color (red or black)]");
return 1;
}
new rand = random(2);
new amount;
amount = strval(tmp);
if(rand >= 0)
if(strcmp(tmp, "red", true) == 0)
{
GivePlayerMoney(playerid, amount);
format(string, sizeof(string), "RED WINS: You win %d dollars !",amount);
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
else if(strcmp(tmp, "black", true) == 0)
{
GivePlayerMoney(playerid, -amount);
format(string, sizeof(string), "BLACK WINS: You lose %d dollars !",amount);
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
if(rand >=1)
if(strcmp(tmp, "black", true) == 0)
{
GivePlayerMoney(playerid, amount);
format(string, sizeof(string), "BLACK WINS: You win %d dollars !",amount);
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
else if(strcmp(tmp, "red", true) == 0)
{
GivePlayerMoney(playerid, -amount);
format(string, sizeof(string), "RED WINS: You lose %d dollars !",amount);
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
}
thx in advance