AFK Kick

Yoh Asakura

New member
Messages
261
Points
0
Emulator
Hello,

I'd like know if anyone could edit this script that Dastgir made. I would like to kick all the players from all maps that are afk for 6 hours.

- script afkwoe -1,{OnInit: .timetocheck = 30; //Seconds after which idle is checked. .idle_time = 30; //Idle time in seconds, from which one can be warped.end;OnPCLoginEvent: addtimer .timetocheck*1000,strnpcinfo(3)+"::OnCheckAFK"; end;                                                               OnCheckAFK: if(checkidle() >= .idle_time && getmapflag(strcharinfo (3), mf_gvg)) { dispbottom "The Police, has detected him as bot because you were in afk a long time during woe"; warp "SavePoint",0,0; end; } addtimer .timetocheck*1000,strnpcinfo(3)+"::OnCheckAFK";} 

Kind Regards,

Yoh.

 
Last edited by a moderator:
Edit and adjust the setting .idle_time accordingly.

Code:
OnCheckAFK:	if( checkidle() >= .idle_time ) {	    atcommand "@kick" + strcharinfo(0);		end;	}
 
Last edited by a moderator:
Seconds between each check. If you'll set it to 60 it'll trigger once a minute, if you'll set it to 3600, it'll trigger once an hour. And so on.

 
Last edited by a moderator:
Example:

OnInit: .timetocheck = 60; //Seconds after which idle is checked. .idle_time = 3600; //Idle time in seconds, from which one can be warped.

This way it will check every minute if any player is afk for 1 hour, is that right?

 
Not working.

It's not kicking...no error in ssh.
Try this, buddy:

Code:
-    script    afkwoe    -1,{    OnInit:        .timetocheck = 60;	    //Seconds after which idle is checked.        .idle_time = 3600;	    //Idle time in seconds, from which one can be warped.        end;    OnPCLoginEvent:        addtimer .timetocheck*1000,strnpcinfo(1)+"::OnCheckAFK";        end;                                                                       OnCheckAFK:        if(checkidle() >= .idle_time) {            atcommand "@kick "+ strcharinfo(0);            end;        }        addtimer .timetocheck*1000,strnpcinfo(1)+"::OnCheckAFK";        end;}
 
Last edited by a moderator:
@@Dastgir

I know that. I followed what @Gaar mentioned but it's still not working.

Code:
OnCheckAFK:    if( checkidle() >= .idle_time ) {	    atcommand "@kick" + strcharinfo(0);	    end;    }
 
 
Hello,

I'd like know if anyone could edit this script that Dastgir made. I would like to kick all the players from all maps that are afk for 6 hours.

- script afkwoe -1,{OnInit: .timetocheck = 30; //Seconds after which idle is checked. .idle_time = 30; //Idle time in seconds, from which one can be warped.end;OnPCLoginEvent: addtimer .timetocheck*1000,strnpcinfo(3)+"::OnCheckAFK"; end;                                                               OnCheckAFK: if(checkidle() >= .idle_time && getmapflag(strcharinfo (3), mf_gvg)) { dispbottom "The Police, has detected him as bot because you were in afk a long time during woe"; warp "SavePoint",0,0; end; } addtimer .timetocheck*1000,strnpcinfo(3)+"::OnCheckAFK";} 

Kind Regards,

Yoh.
here you go.

http://pastebin.com/f04Vk6Pp

 
@@Zhao Chow

Not working...

Can you edit to check each 1 second if a char is AFK for 1 minute? This way I can check if the way I put the numbers is right...

 
set .afk_timer, 1000;

1000 = 1 second

well, better explanation: the time is in milliseconds.

 
@@Yoh Asakura

just change this line

    set .afk_timer, 1000*60; //Timer in milliseconds(Formula 1000=1second(do not change) / 60=1minute(do not change).
    set .Max_Idle_Time, 60*60*6; //Maximum Time for IDLE Characters (60=seconds / 60=minutes / 6=hours)
 
change it to this :
    set .afk_timer, 1000*1;
    set .Max_Idle_Time, 60*1;
 
or
    set .afk_timer, 1000;
    set .Max_Idle_Time, 60;


 
it was in above post
 

set .afk_timer, 1000*60; //Timer in milliseconds(Formula 1000=1second(do not change) / 60=1minute(do not change). set .Max_Idle_Time, 60*60*6; //Maximum Time for IDLE Characters (60=seconds / 60=minutes / 6=hours)

 
just remove the set .afk_timer, 1000*60;

and look like this .afk_timer, 1000;

and remove set .Max_Idle_Time, 60*60*6;

and look like this .Max_Idle_Time, 60*60;

 
Last edited by a moderator:
Back
Top