SA-MP Forums Archive
AFK Detection - 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 Detection (/showthread.php?tid=284373)



AFK Detection - Luis- - 18.09.2011

Hello, I am planning on making an AFK detector for my server but I have no idea how I would start it off, if someone wouldn't mind telling me how to it'd be much appreciated.

Thanks!


Re: AFK Detection - MadSkillz - 18.09.2011

http://forum.sa-mp.com/showthread.ph...=onplayerpause


Re: AFK Detection - =WoR=G4M3Ov3r - 18.09.2011

Floats, Playerupdates, timers.


Re: AFK Detection - Luis- - 18.09.2011

Hmm, could you possibly give me a little example please?


Re: AFK Detection - =WoR=G4M3Ov3r - 18.09.2011

PHP код:
enum iFloat
{
    
Float:PosX,
    
Float:PosY,
    
Float:PosZ,
    
Float:Angle,
    
Float:Healthbar,
    
Float:Armourbar,

You can aswell add a new variable such as
PHP код:
new CheckPlayerAFK[MAX_PLAYERS];
new 
UpdateInfo[MAX_PLAYERS][iFloat];
new 
InactivePlayer[MAX_PLAYERS]; 
PHP код:
public OnPlayerConnect(playerid)
{
    
UpdateInfo[playerid][PosX] = 0;
    
UpdateInfo[playerid][PosY] = 0;
    
UpdateInfo[playerid][PosZ] = 0;
    
UpdateInfo[playerid][Angle] = 0;
    
UpdateInfo[playerid][Healthbar] = 0;
    
UpdateInfo[playerid][Armourbar] = 0;
    
InactivePlayer[playerid] = 0;
    
CheckPlayerAFK[playerid] = 0;
    return 
1;

Note, you will need stocks.


Edit: there's many more stuff you can use, I just gave ya an example