Kill AFk player - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Kill AFk player (
/showthread.php?tid=546086)
Kill AFk player -
buburuzu19 - 12.11.2014
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.
Re: Kill AFk player -
BornHuman - 12.11.2014
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
Re: Kill AFk player -
zT KiNgKoNg - 12.11.2014
Why would you want to kill people if they're afk, just kick them (It'll free up a slot for someone else).
Re: Kill AFk player -
buburuzu19 - 12.11.2014
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.
Re: Kill AFk player -
buburuzu19 - 12.11.2014
Quote:
Originally Posted by BornHuman
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.
Re: Kill AFk player -
BornHuman - 12.11.2014
Quote:
Originally Posted by buburuzu19
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.
Re: Kill AFk player -
DavidBilla - 12.11.2014
Well, the only way is setting their health to zero after they come back from being afk.
Re: Kill AFk player -
Quickie - 13.11.2014
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;
}