Questions about AFK
#6

Checking if a player is alt tabbed is pretty simple.

Make two variables.
PHP код:
new 
    
gPauseUpdateMAX_PLAYERS ],
    
gIdleTimeMAX_PLAYERS ]

OnPlayerUpdate -
PHP код:
public OnPlayerUpdateplayerid )
{
    
gPauseUpdateplayerid ] = GetTickCount( );
    return 
1;

You'll need a one second timer.
PHP код:
public OnClientSecond()
{
    for( new 
playeridplayerid MAX_PLAYERSplayerid++ )
    {
        if( !
IsPlayerConnectedplayerid ) ) {
            continue;
        }
        if( 
GetTickCount( ) > ( gPauseUpdateplayerid ] + 3000 ) ) {
            
gIdleTimeplayerid ] ++;
        } else if( 
gIdleTimeplayerid ] ) gIdleTimeplayerid ] = 0;
    }
    return 
1;

Reply


Messages In This Thread
Questions about AFK - by Ezzz - 03.07.2018, 14:45
Re: Questions about AFK - by Ezzz - 03.07.2018, 14:47
Re: Questions about AFK - by Sew_Sumi - 03.07.2018, 22:06
Re: Questions about AFK - by Ezzz - 07.07.2018, 03:10
Re: Questions about AFK - by Sew_Sumi - 07.07.2018, 03:36
Re: Questions about AFK - by Kane - 07.07.2018, 04:28
Re: Questions about AFK - by Sew_Sumi - 07.07.2018, 04:52
Re: Questions about AFK - by Ezzz - 07.07.2018, 06:10

Forum Jump:


Users browsing this thread: 1 Guest(s)