Giving Score each hour
#2

Globally:
pawn Код:
new gOnlineTimer[ MAX_PLAYERS ];
//making a global variable to use later when killing the looping timer
OnPlayerConnect:
pawn Код:
gOnlineTimer[ playerid ] = SetTimerEx( "HourScoreIncome", 60*60*1000, true, "i", playerid );
//here we initialize the timer, and assigns the global variable as its ID. The timer will loop every 60*60*1000th millisecond, which is every hour.
OnPlayerDisconnect:
pawn Код:
KillTimer( gOnlineTimer[ playerid ] );
//killing the timer so that it won't run when the player disconnects
Anywhere:
pawn Код:
forward HourScoreIncome(playerid);
public HourScoreIncom(playerid)
    return SetPlayerScore( playerid, GetPlayerScore( playerid ) + 1 );
//simply adding 1 to the player's current score (the timer function)
This should work.
Reply


Messages In This Thread
Giving Score each hour - by diego_p11 - 17.12.2012, 13:32
Re: Giving Score each hour - by LarzI - 17.12.2012, 13:37
Re: Giving Score each hour - by diego_p11 - 17.12.2012, 13:49
Re: Giving Score each hour - by Konstantinos - 17.12.2012, 13:51

Forum Jump:


Users browsing this thread: 1 Guest(s)