19.09.2010, 16:17
Someone know how to put the text "BRB ... pausing" under the playername when he press ESC?
forward CheckForPause();
new PlayerUpdateCount[MAX_PLAYERS];
new PlayerPaused[MAX_PLAYERS];
//OnGameModeInit
SetTimer("CheckForPause", 1000, true);
//OnPlayerUpdate
PlayerUpdateCount[playerid] += 0.03125
//Because 0.03125 * the amount of times OnPlayerUpdate is called (32) equals 1
public CheckForPause()
{
for(new i; i <= MAX_PLAYERS; i++) {
if(IsPlayerConnected(i) && !PlayerPaused[i]) {
PlayerUpdateCount[i]--;
if(PlayerUpdateCount[i] < 0) PlayerPaused[i] = 1;
}
}
return 1;
}
OnPlayerUpdate isn't called.
Find out how many times OnPlayerUpdate is called (32 per second approx.), then create a timer to zero a variable which is increased everytime OnPlayerUpdate is called. Ex: pawn Code:
|