help me with payday on every hour
#1

Hi.I wanna if player is online to get 1000 money when the time is --:00.Thanks
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=187229
Reply
#3

Under OnGameModeInit, start a loop that loops very often. In this example I've used 100ms each interval
pawn Код:
SetTimer( "PayDayTimer", 100, true );
You can then do a time check in the timer-callback, like so:
pawn Код:
forward PayDayTimer();
public PayDayTimer()
{
    new
        hour,
        minute,
        second;
    gettime( hour, minute, second ); //get the current time
    if( minute == 0 ) //if minute == 0 - anything o' clock
    {
        for( new i = 0; i < MAX_PLAYERS; i++ ) //loop through all possible players
        {
            if( IsPlayerConnected( i )) //check if the players loop through are connected (no point giving money to players who don't exist)
            {
                SendClientMessage( i, 0xFFFF00FF, "PAYDAY! + $1000"); //send a message
                GivePlayerMoney( i, 1000 ); //give them money
            }
        }
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)