SA-MP Forums Archive
PayDay once a day - how to? - 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: PayDay once a day - how to? (/showthread.php?tid=74624)



PayDay once a day - how to? - kacperoo - 24.04.2009

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


Re: PayDay once a day - how to? - MenaceX^ - 24.04.2009

Payday once a day in 24:00?


Re: PayDay once a day - how to? - kacperoo - 24.04.2009

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


Re: PayDay once a day - how to? - MenaceX^ - 24.04.2009

Gettime.


Re: PayDay once a day - how to? - kacperoo - 24.04.2009

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


Re: PayDay once a day - how to? - MenaceX^ - 24.04.2009

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();
}



Re: PayDay once a day - how to? - Andom - 24.04.2009

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();
  }
}



Re: PayDay once a day - how to? - MenaceX^ - 24.04.2009

oh ops, didn't notice.


Re: PayDay once a day - how to? - kacperoo - 24.04.2009

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


Re: PayDay once a day - how to? - Joe Staff - 24.04.2009

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.