15.05.2014, 17:22
Well, first i recommend you to use a timerfix: https://sampforum.blast.hk/showthread.php?tid=289675 or https://sampforum.blast.hk/showthread.php?tid=375925 .
Then, you can create a timer that executes every minute, but starts exactly next 00 seconds like:
Then, in EachMinuteTimer, you verify if it is hour 15 and minute 00 and if it is so, you give them payday:
For that "if only you spent 20 minutes on server" you can create a new array[MAX_PLAYERS] and OnPlayerConnect you make it 0, then in EachMinuteTimer you make array[i]++; then you put instead of "Payday ( i )", if(array[i]>=20){array[i]=0; Payday(i);}
Hope you understand.
Then, you can create a timer that executes every minute, but starts exactly next 00 seconds like:
PHP код:
new h,mi,s;
gettime(h,mi,s);
SetTimer("aEachMinuteTimer", 60000-(s*1000), 0); //Execute aEachMinuteTimer at next 00 seconds
public aEachMinuteTimer()
{
EachMinuteTimer();//executes the timer because it's a new minute
SetTimer ( "EachMinuteTimer" , 60000 , 1 ) ; //Execute EachMinuteTimer at every minute from now on.
return 1;
}
PHP код:
public EachMinuteTimer()
{
new h,m,s;
gettime ( h,m,s );
if(h==15 && m==0){
foreach (Player , i) {//ForEach already verifies if Player is connected.
GivePlayerMoney(i,...);
}
}
Hope you understand.