Conflicting Timers - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Conflicting Timers (
/showthread.php?tid=111942)
Conflicting Timers -
Daren_Jacobson - 04.12.2009
Okay, I ran into a Timer problem when they are self-recursive, I made this once I suspected the problem.
pawn Код:
OnGameModeInit()
{
SetTimerEx("testing", 1000, 0, "s", "woot");
SetTimerEx("testing", 500, 0, "s", "hehe");
return 1;
}
foward testing(string[])
public testing(string[])
{
print(string);
SetTimerEx("testing", 1000, 0, "s", string);
return 1;
}
excuse the indentation, I guess I have deleted my function.
well, that would print a (null) and then restart my server, so i changed it to.
pawn Код:
foward testing(string[])
public testing(string[])
{
new string2[1000];
format(string2, sizeof(string2), "%s", string);
print(string2);
SetTimerEx("testing", 1000, 0, "s", string2);
return 1;
}
and that would print hehe only. it wouldn't print any woot's.
why? I have no clue. but i definitely need help.
Re: Conflicting Timers -
Daren_Jacobson - 05.12.2009
Still causing me head-aches.
Re: Conflicting Timers -
Daren_Jacobson - 08.12.2009
I ran
pawn Код:
main()
{
SetTimerEx("testing", 500, 0, "s", "woot");
SetTimerEx("lolcat", 1000, 0, "s", "hehe");
}
forward testing(string[])
public testing(string[])
{
new coolstring[100];
format(coolstring, sizeof(coolstring), "%s", string);
printf("%s &", coolstring);
SetTimerEx("lolcat", 1000, 0, "s", coolstring);
return 1;
}
forward lolcat(string[])
public lolcat(string[])
{
new coolstring[100];
format(coolstring, sizeof(coolstring), "%s", string);
printf("%s &&", coolstring);
SetTimerEx("testing", 1000, 0, "s", coolstring);
return 1;
}
and it prints
woot &&
woot &
woot &
woot &&
woot &&
woot &
woot &
woot &&
...
this puzzles me deeply, since the first time lolcat() get's called is with the direct quote "hehe" yet it shows "woot", I am so confused.
Re: Conflicting Timers -
yom - 08.12.2009
That is a bug of SetTimerEx, you can't fix it, but you can avoid that bug by not running a SetTimerEx if another is already running.