Run every hour
#1

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

Use SetTimer under OnGameModeInit.
Reply
#3

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)
Reply
#4

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...
    }
  }
}
Reply
#5

I'll try this!
Thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)