Bet command
#10

You use strtok so u cant use cmdtext only cmd
Код:
if(strcmp(cmd,"/bet", true) == 0)
{
	tmp = strtok(cmdtext, idx);
	if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bet [amount] [color (red or black)]");
	new amount = strval(tmp);
	tmp = strtok(cmdtext, idx);
	new rand = random(2);
	if(!rand)
	{
		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);
		}
		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);
		}
	}else{
		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);
		}
		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;
}
:>
Reply


Messages In This Thread
Bet command - by Viktor_Burns - 07.07.2009, 14:33
Re: Bet command - by yom - 07.07.2009, 15:30
Re: Bet command - by Viktor_Burns - 07.07.2009, 15:44
Re: Bet command - by refshal - 07.07.2009, 15:45
Re: Bet command - by Viktor_Burns - 07.07.2009, 17:40
Re: Bet command - by refshal - 07.07.2009, 17:53
Re: Bet command - by Viktor_Burns - 07.07.2009, 18:06
Re: Bet command - by yom - 07.07.2009, 18:15
Re: Bet command - by Viktor_Burns - 07.07.2009, 18:49
Re: Bet command - by Jefff - 07.07.2009, 20:12

Forum Jump:


Users browsing this thread: 1 Guest(s)