Afk detect - 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: Afk detect (
/showthread.php?tid=487914)
Afk detect -
iBots - 15.01.2014
Guys i always request a good way to detect afk people but you guys only give me an idea to check pos
I have made the position thing before you guys tell me and i am not asking for that,i am asking for a system that detects afk automatic,or whats the system that SAMP used to detect the afk and put an icon on his head automaticly ....
Because i have seen a server doing the same thing,a timer appears at the same time when the samp icon appears,abovr the players head...HOW

??
Re: Afk detect -
erminpr0 - 15.01.2014
OnPlayerUpdate is not calling while player is paused, it is being called whenever player updates server with his status (Pos,Weapon,Skin etc.)
So you can do this:
pawn Код:
#define MAX_AFK_MINUTES 10
public OnPlayerUpdate(playerid)
{
SetPVarInt(playerid, "AFK", 0);
SetPVarInt(playerid, "AFKMinutes", 0);
return 1;
}
forward AddAfk();
public AddAfk()
{
foreach(Player, playerid)
{
SetPVarInt(playerid, "AFK", 1);
SetPVarInt(playerid, "AFKMinutes", GetPVarInt(playerid, "AFKMinutes")+1);
if(GetPVarInt(playerid, "AFKMinutes") > MAX_AFK_MINUTES)
{
Kick(playerid);
}
}
return 1;
}
public OnGameModeInit()
{
SetTimer("AddAfk", 1000*60, true);
return 1;
}
P.S. sorry I don't have any other idea. xD
Re: Afk detect -
iBots - 16.01.2014
i am looking for another system