08.03.2014, 15:27
Or you can compare the value instead of string.
Like this.
Like this.
pawn Код:
new reaction;
new reactionmoney;
OnPlayerText:
if(reaction == strval(text))
{
new string[128];
new name[24];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), ""COL_BLUE"%s"COL_WHITE" won reaction test! Result: %d.", name,reaction);
SendClientMessageToAll(COLOR_GRAY, string);
SetPlayerScore(playerid, GetPlayerScore(playerid)+1);
sGivePlayerMoney(playerid, reactionmoney);
}
public timer:
forward react();
public react()
{
new string[128];
reactionmoney = randomEx(1000, 3000);
new rand1 = randomEx(10, 99);
new rand2 = randomEx(10, 99);
new rand3 = randomEx(10, 99);
reaction = rand1+rand2+rand3;
format(string, sizeof(string), ""COL_WHITE"Reaction test | "COL_BLUE"%d - %d + %d "COL_WHITE"| "COL_BLUE"+1 score and $%d", rand1, rand2, rand3, reactionmoney);
SendClientMessageToAll(COLOR_GRAY, string);
return 1;
}