SetTimer Bug - 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: SetTimer Bug (
/showthread.php?tid=546290)
SetTimer Bug -
Stoyanov - 14.11.2014
I have reaction system with random letters.
Sometimes it start several times two three.
OnFilterScriptInit
Код:
xReactionTimer = SetTimer("xReactionTest", TIME, 1);
OnPlayerText
Код:
switch(xTestBusy)
{
case true:
{
if(!strcmp(xChars, text, false))
{
new
string[128],
pName[MAX_PLAYER_NAME]
;
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "{56ff00}%s спечели теста за бързо реагиране. Той получава %d$", pName, xCash);
SendClientMessageToAll(GREEN, string);
GivePlayerMoney(playerid, xCash);
xReactionTimer = SetTimer("xReactionTest", TIME, 1);
xTestBusy = false;
}
}
}
Function Callback
Код:
function xReactionProgress()
{
switch(xTestBusy)
{
case true:
{
new
string[128]
;
format(string, sizeof(string), "Никой не спечели теста за бързо реагиране!");
SendClientMessageToAll(WHITE, string);
xReactionTimer = SetTimer("xReactionTest", TIME, 1);
}
}
return 1;
}
function xReactionTest()
{
new
xLength = (random(8) + 3),
string[128]
;
xCash = 8400;
format(xChars, sizeof(xChars), "");
Loop(x, xLength) format(xChars, sizeof(xChars), "%s%s", xChars, xCharacters[random(sizeof(xCharacters))][0]);
format(string, sizeof(string), "{ff00db}Който първи напише в чата {56ff00}%s {ff00db}печели {56ff00}%d$", xChars, xCash);
SendClientMessageToAll(YELLOW, string);
KillTimer(xReactionTimer);
xTestBusy = true;
SetTimer("xReactionProgress", 30000, 0);
return 1;
}
Re: SetTimer Bug -
k0r - 14.11.2014
Код:
xReactionTimer = SetTimer("xReactionTest", TIME, 1);
change it to false/0.
Re: SetTimer Bug -
Stoyanov - 14.11.2014
Works,
BUT
+1 problem:
Re: SetTimer Bug -
Stoyanov - 14.11.2014
After the reaction test say that nobody answered it and if i answer it, it bugs again.
Re: SetTimer Bug -
Stoyanov - 14.11.2014
anybody?
Re: SetTimer Bug -
Stoyanov - 15.11.2014
BUMP