help me with payday on every hour
#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


Messages In This Thread
help me with payday on every hour - by Hugoca - 10.12.2012, 13:13
Re: help me with payday on every hour - by iggy1 - 10.12.2012, 13:14
Re: help me with payday on every hour - by LarzI - 10.12.2012, 13:17

Forum Jump:


Users browsing this thread: 1 Guest(s)