SA-MP Forums Archive
Timer doesn't work - 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: Timer doesn't work (/showthread.php?tid=551523)



Timer doesn't work - Eyce - 19.12.2014

Hey there, I have a paycheck system scripted on my game-mode and just like any other role-play scripts, it's set to every hour. It's just really weird that sometimes it works fine and sometimes it doesn't.

Here's what I currently have:

pawn Код:
forward OneSecond();
public OneSecond()
{
    new hour, minute, second;
    gettime(hour, minute, second);
    new string[128];

    if(minute >= 59 && second >= 59)
    {
        SetWorldTime(hour+1);
        format(string, sizeof(string), "The time now is %d:00", hour+1);
        SendClientMessageToAll(0xFFFFFFFF, string);
    }
   
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(minute >= 59 && second >= 59)
        {
            // Give paycheck here
        }
    }
    return 1;
}

public OnGameModeInit()
{
    SetTimer("OneSecond", 1000, 1);
    return 1;
}
If someone could enlighten me, please do. Thank you.