21.06.2011, 03:39
pawn Код:
// After #includes
new
pAFKTimer[ MAX_PLAYERS ],
isAFK[ MAX_PLAYERS ]
;
// OnPlayerConnect
pAFKTimer[ playerid ] = SetTimerEx( "getAFK", 900000, true, "i", playerid );
isAFK[ playerid ] = 0;
// OnPlayerUpdate
if ( isAFK[ playerid ] == 1 )
{
new
szString[ 128 ]
;
format( szString, sizeof szString, "* %s is now back on the server.", getpName( playerid ) );
SendClientMessageToAll( 0xFFFFFFAA, szString );
}
KillTimer( pAFKTimer[ playerid ] );
pAFKTimer[ playerid ] = SetTimerEx( "getAFK", 900000, true, "i", playerid );
// Add this somewhere on your script ( not in a callback / function ).
stock getpName( playerid )
{
new
pName[ 24 ]
;
return GetPlayerName( playerid, pName, sizeof pName ), pName;
}
forward getAFK( playerid ); public getAFK( playerid )
{
new
szString[ 128 ]
;
format( szString, sizeof szString, "* %s is now AFK.", getpName, playerid );
SendClientMessageToAll( 0xFFFFFFAA, szString );
isAFK[ playerid ] = 1;
return 1;
}