PayDay once a day - how to?
#1

Hi,
I want to make PayDay once a day on my server.
It will not depend from time spent online
.
Hm.. How to add anyone 200$ (will be changed) at 24:00?
What's the best method that won't lag server?

Thanks for reply,
ownede
Reply
#2

Payday once a day in 24:00?
Reply
#3

Quote:
Originally Posted by MenaceX^
Payday once a day in 24:00?
Yes. Once a day, at 24:00 or so.
Reply
#4

Gettime.
Reply
#5

Quote:
Originally Posted by MenaceX^
Gettime.
Can you post an example ?
Reply
#6

Sure.
pawn Код:
SetTimer("Payday",1000,true);// to OnGameModeInit
forward MainTimer(); // somewhere
public MainTimer()
{
  new hour,mins,sec;
  gettime(hour,mins,sec);
  if(mins==24&&sec==00)
    PayDay();
}
Reply
#7

Quote:
Originally Posted by MenaceX^
Sure.
pawn Код:
SetTimer("Payday",1000,true);// to OnGameModeInit
forward MainTimer(); // somewhere
public MainTimer()
{
  new hour,mins,sec;
  gettime(hour,mins,sec);
  if(mins==24&&sec==00)
    PayDay();
}
That's not correct, should be this:

pawn Код:
SetTimer("Payday",1000,true);// to OnGameModeInit
forward MainTimer(); // somewhere
public MainTimer()
{
  new hours, minutes, secconds;
  gettime(hours, minutes, secconds);
  if(hours == 0 && minutes == 0 && secconds == 0) // This would launche at 0:00, that's the same as 24:00 (but the last one is impossible)
  {
    PayDay();
  }
}
Reply
#8

oh ops, didn't notice.
Reply
#9

Mm, thanks.
But may 1 second timer lag server?
There will be about 100 players online.
Reply
#10

No. Just realize that 1 second timer isn't always exactly 1 second. With checks you'll find out that more often than not it's like 1011 milliseconds, potentially skipping one second over time, and by some far off chance, skip your payday.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)