16.02.2013, 23:07
Basically. This timer runs every second, so it can update the time. Which it does correctly. However, I'm trying to make payday every hour paid to each player. Problem is that when it gets to the hour (on the hour) it runs the payday for the whole minute until it's say (12:01). I.e Running it for 60secs although I only want to execute the code once. Could someone tell me how I could solve this?
pawn Код:
public UpdateTimeAndWeather()
{
foreach(Player, i)
{
if(IsPlayerConnected(i) && LoggedIn[i] == 1)
{
gettime(hour, minute,seconds);
format(timestr,32,"%02d:%02d:%02d",hour + 2,minute,seconds);
SetPlayerTime(i,hour+2,minute);
seconds ++;
if(seconds == 60)
{
minute ++;
}
if(minute == 00)
{
hour ++;
foreach(Player, x)
{
doPayDay(x);
}
}
TextDrawSetString(txtTimeDisp,timestr);
SetWorldTime(hour);
}
}
}