Kill AFk player
#1

Is there a way to kill afk players? I see this on many servers and i want to know what code is used for this thing.
Reply
#2

Sure there is. It would be useful to search the forums for an AFK script tutorial. Usually most of them will kick the inactive player, but you could just change the function to instead of kicking them, to set their HP to zero. Here, I'll link you to one:

https://sampforum.blast.hk/showthread.php?tid=381125
Reply
#3

Why would you want to kill people if they're afk, just kick them (It'll free up a slot for someone else).
Reply
#4

If hitman wants to kill a afk target he can't because the target is afk.
I want that because players can't kill afk players.
Reply
#5

Quote:
Originally Posted by BornHuman
View Post
Sure there is. It would be useful to search the forums for an AFK script tutorial. Usually most of them will kick the inactive player, but you could just change the function to instead of kicking them, to set their HP to zero. Here, I'll link you to one:

https://sampforum.blast.hk/showthread.php?tid=381125
I want to make something like this:
Players who are not afk can kill the afk players.
Reply
#6

Quote:
Originally Posted by buburuzu19
View Post
If hitman wants to kill a afk target he can't because the target is afk.
I want that because players can't kill afk players.
That's redundant. If a player is afk, then they are still able to take damage unless they're tabbed. And if they're tabbed, using a function on them won't work until they tab back in, such as killing them. Anyway, check out my last response.
Reply
#7

Well, the only way is setting their health to zero after they come back from being afk.
Reply
#8

pawn Code:
new AntiAFK[MAX_PLAYERS];
new AFKTIMER[MAX_PLAYERS];

#define MAX_AFK_TIME 5

forward OnPlayerAFKcheck(playerid)
{
    AntiAFK[playerid]++;
    if(AntiAFK[playerid]>MAX_AFK_TIME)
    {
        // ur code
        //SetPlayerHealth(playerid,0.0);
    }
}

public OnPlayerConnect(playerid)
{
    AFKTIMER[playerid]=SetTimerEx("OnPlayerAFKcheck",1000,true, "d", playerid);
    return 1;
}
public OnPlayerDisconnect(playerid,reason)
{
    KillTimer(AFKTIMER[playerid]);
    AntiAFK[playerid]=0;
    return 1;
}
public OnPlayerUpdate(playerid)
{
    AntiAFK[playerid]=0;
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)