//Script by: BrianL
- script IdleKick -1,{
OnPCLoginEvent:
set .interval, 1; // How often to check? (seconds)
set .max_idle, 120; // Idle time before kicking? (seconds)
getmapxy( @map$, @x, @y, 0 );
addtimer .interval *1000, strnpcinfo(3)+"::OnCheck";
end;
OnCheck:
getmapxy( .@map$, .@x, .@y, 0 );
if( .@map$ == "bat_c01" ) {
if (.@map$==@map$ && .@x==@x && .@y==@y) { // same map,x,y (idle)
set @idle_seconds, @idle_seconds + .interval;
} else { // they moved, so reset idle timer
set @idle_seconds, 0;
}
set @map$,.@map$; set @x,.@x; set @y,.@y;
if (@idle_seconds >= .max_idle) {
dispbottom "Idle characters are not allowed in Gold Room. Warping to save point...";
warp "SavePoint",0,0; // warp out
// atcommand "@kick "+strcharinfo(0); // or kick
}
}
addtimer .interval *1000, strnpcinfo(3)+"::OnCheck";
end;
}