checking if a player is afk - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: checking if a player is afk (
/showthread.php?tid=275389)
checking if a player is afk -
xDeadlyBoy - 09.08.2011
how can i check if someone is afk? (by pressing ESC)
Re: checking if a player is afk -
TouR - 09.08.2011
Use OnPlayerPause
Re: checking if a player is afk -
admantis - 09.08.2011
You can use this basic method.
pawn Код:
new iAFKDef[MAX_PLAYERS];
forward afkCheck();
public afkCheck() {
for( new i = 0; i < MAX_PLAYERS; i +=1 ) {
iAFKDef[i] -= 1; if ( iAFKDef[i] <= 0 ) { Kick( i ); }
}
return 1;
}
public OnGameModeInit( ) {
SetTimer( "afkCheck", 1000, true );
}
public OnPlayerUpdate( playerid ) {
iAFKDef[playerid] = 10; }
This is caused because OnPlayerUpdate is not called when a player pauses, so try to figure out yourself.