SA-MP Forums Archive
Run every hour - 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: Run every hour (/showthread.php?tid=138063)



Run every hour - falor - 31.03.2010

Hey guys,
Actually i'm making my mod, and for the payday i have no idea of how to do.
I want the payday to run on every hour (like 15:00 ; 16;00)
Because if i make a Settimer, it dipends from the connection.
Thanks for your help


Re: Run every hour - SloProKiller - 31.03.2010

Use SetTimer under OnGameModeInit.


Re: Run every hour - falor - 31.03.2010

Yes i did it, but it doesn't run every hour.
It changes, in function of player's connection, and the hour of the server is running
Like if i run my server at 14:32 the payday will be at 15:32, 16:32 etc...
But i need them to fix hours (15:00, 16:00 etc)


Re: Run every hour - wafffllesss - 31.03.2010

Try Something like this:
pawn Код:
//top
new LastHour = 0;
forward PayDay();

//OnGameModeInit()

SetTimer("PayDay",60*1000,1);
new nh,nm,ns;
gettime(nh,nm,ns);
LastHour=nh;

//Anywhere (outside callbacks and functions)

public PayDay(){
  new nh,nm,ns;
  gettime(nh,nm,ns);
  if(nh != LastHour){
    LastHour = nh;
    for(new i =0;i<500;i++){
    ....//PayDay Script...
    }
  }
}



Re: Run every hour - falor - 31.03.2010

I'll try this!
Thank you