5 mins not moving -> afk -> kick ?
#1

I want to make if somebody Isnt moving for 5 minits then he gets kicked no idea how can anybody help me?
Reply
#2

Try this http://forum.sa-mp.com/showthread.ph...ct+afk+include
Reply
#3

I would use the cordinates... Like use a timer to detect if someone coordinates is the same every second and make a variable biger every second, If the variable reach 300 (300 seconds are 5 minutes) the player is automactly kicked
Reply
#4

What tour15 said is the most sufficient method.

Quote:
Originally Posted by [BADBOY]
Посмотреть сообщение
That system only works if the player is "paused" (alt-tabbed).
Reply
#5

example please tour? or calgon?
Reply
#6

Quote:
Originally Posted by thimo
Посмотреть сообщение
example please tour? or calgon?
Take a look at an AFK kicking filterscript or half of the roleplaying gamemodes in the Gamemodes Release board.

I wrote up an example but I can't be bothered to complete it or test it.
Reply
#7

Example:
pawn Код:
forward AFK(playerid);
new AFKtimer;
pawn Код:
public OnPlayerPause(playerid)
{
    AFKtimer = SetTimerEx("AFK", 300000, 0, "i", playerid);
    return 1;
}
pawn Код:
public OnPlayerUnPause(playerid)
{
    KillTimer(AFKtimer);
    return 1;
}
pawn Код:
public AFK(playerid)
{
    if(IsPlayerPaused(playerid))
    {
        Kick(playerid);
        new string[128], playername[24];
        GetPlayerName(playerid, playername, 24);
        format(string, sizeof(string), "%s has been kicked for being AFK (away from keyboard) for more than 5 minutes", playername);
        SendClientMessageToAll(0xAFAFAFAA, string);
    }
    return 1;
}
Done
Reply
#8

I'd use the position method though, less script = less lag.
Reply
#9

Quote:
Originally Posted by Jochemd
Посмотреть сообщение
I'd use the position method though, less script = less lag.
Not really, it matters how you're coding it.
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)