01.08.2012, 17:06
I don't see your need for all those timers and health stuff?
pawn Код:
new PlayerUpdate[MAX_PLAYERS char], // less than 255 players, change it yourself if needed..
Paused[MAX_PLAYERS];
forward OnPlayerPause(playerid);
forward OnPlayerUnPause(playerid);
forward IsPlayerPaused(playerid);
public IsPlayerPaused(playerid) return Paused[playerid];
public OnPlayerUpdate(playerid)
{
if(PlayerUpdate{playerid} >= 2)
{
Paused[playerid] = 0;
CallRemoteFunction("OnPlayerUnPause", "i", playerid);
}
PlayerUpdate{playerid} = 0;
return 1;
}
public OnPlayerPause(playerid)
{
printf("[System] - %s(%d) Has Paused", Playername(playerid), playerid);
return 1;
}
public OnPlayerUnPause(playerid)
{
printf("[System] - %s(%d) Has Unpaused", Playername(playerid), playerid);
return 1;
}
// in a preferably 1 second timer
if(PlayerUpdate{i} < 2)
{
PlayerUpdate{i}++;
}
else
{
if(Paused[i] != 1)
{
CallRemoteFunction("OnPlayerPause", "i", i);
Paused[i] = 1;
}
}