checking if a player is afk
#1

how can i check if someone is afk? (by pressing ESC)
Reply
#2

Use OnPlayerPause
Reply
#3

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.
Reply


Forum Jump:


Users browsing this thread: