16.01.2013, 14:56
Quote:
Well you wanted something that wasn't called 3052 or whatever times a second, so there... be happy with it.
|
OnPlayerUpdate is called every time a client updates with the server, so depending on if the player is doing something (moving etc) it will be called more or less, it's not something to avoid almost like it's the plague but you shouldn't pack it full of stuff.
One way to make a detection to see if a player is paused is like this.
Define these global variables...
pawn Code:
new PlayerPaused[MAX_PLAYERS], pausetick[MAX_PLAYERS];
pawn Code:
pausetick[playerid] = GetTickCount();
pawn Code:
SetTimer("PauseCheck", 1000, 1);
pawn Code:
forward PauseCheck();
public PauseCheck()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(playerid)) continue;
if(GetTickCount() - pausetick[i] > 1000) // If they haven't updated in 1+ seconds, increase if needed.
{
PlayerPaused[i] = 1;
}
else
{
PlayerPaused[i] = 0;
}
}
return 1;
}
I'm pretty sure you can take it from here to make an AFK kicker now that you have this pause detector.