Timer Time Issues.
#1

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?
Reply
#2

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.
Reply
#3

hmm , thanks!

WORKS! thanks you.
Reply
#4

https://sampforum.blast.hk/showthread.php?tid=179311

Check it out
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)