Timer Time Issues. - 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: Timer Time Issues. (
/showthread.php?tid=179418)
Timer Time Issues. -
Code_Red - 26.09.2010
Hey Umm...
so ive set my timer for 1000 milliseconds and when it finishes it adds a point(please dont ask what point) problem is , its too fast for 1 second (and ive tested it) in one minute its giving more then 60 points
can you please tell me what to do?
Re: Timer Time Issues. -
Mauzen - 26.09.2010
You could add the points with the timer + GetTickCount()
pawn Код:
new lasttick[MAX_PLAYERS];
public TimerFunc(playerid)
{
if(GetTickCount() - lasttick[playerid] >= 1000)
{
SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
lasttick[playerid] = GetTickCount();
}
}
This will check in addition, if really more than a sec went since the player got his last point. So the max tolerance will be 1 point.
Re: Timer Time Issues. -
Code_Red - 26.09.2010
hmm , thanks!
WORKS! thanks you.
Re: Timer Time Issues. -
LarzI - 26.09.2010
https://sampforum.blast.hk/showthread.php?tid=179311
Check it out