17.12.2012, 13:37
Globally:
OnPlayerConnect:
OnPlayerDisconnect:
Anywhere:
This should work.
pawn Код:
new gOnlineTimer[ MAX_PLAYERS ];
//making a global variable to use later when killing the looping timer
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.
pawn Код:
KillTimer( gOnlineTimer[ playerid ] );
//killing the timer so that it won't run when the player disconnects
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)