What did I do wrong? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: What did I do wrong? (
/showthread.php?tid=497383)
What did I do wrong? -
AnthonyTimmers - 26.02.2014
pawn Код:
public OnPlayerText(playerid, text[])
{
if (strval(text) == MathQuizAnswer && MathQuizAnswer != -1)
{
MathQuizAnswered = 1;
MathQuizAnswer = -1;
SetTimer("MessageDelay", 500, false);
}
return 1;
}
forward MessageDelay(playerid);
public MessageDelay(playerid)
{
new randomprice = 2500 + (random(10) * 500);
new string[64+MAX_PLAYER_NAME+1];
new name[MAX_PLAYER_NAME+1];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s has answered the Math Quiz correctly and has won %d$!", name, randomprice);
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
print(string);
GivePlayerMoney(playerid, randomprice);
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash] + randomprice;
}
When I answered it, it said another player had won the quiz (who didn't even answer anything).
What did I do wrong?
Respuesta: What did I do wrong? -
CuervO - 26.02.2014
You're using a global timer (without parameters) on a function which needs input parameters.
Use SetTimerEx instead to put the needed parameters (playerid).
Re: What did I do wrong? -
AnthonyTimmers - 27.02.2014
Thanks, that fixed it.