SA-MP Forums Archive
Afk system. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Afk system. (/showthread.php?tid=265551)



Afk system. - budelis - 01.07.2011

Hi people.Maybe anybody have afk system?If player don't move for 2 min,he have attacked 3dtext label.with text "Afk"


Re: Afk system. - Shadoww5 - 01.07.2011

This may work, try:

PHP код:
new Text3D:text[MAX_PLAYERS];

forward Check();

public 
OnGameModeInit()
{
    
SetTimer("Check"60000true);
    return 
1;
}

public 
Check()
{
    for(new 
0MAX_PLAYERS++)
    {
        new 
Float:Pos[3];
        
GetPlayerPos(iPos[0], Pos[1], Pos[2]);
        if(
GetPVarFloat(i"X") == Pos[0] && GetPVarFloat(i"Y") == Pos[1] && GetPVarFloat(i"Z") == Pos[2])
        {
            
SetPVarInt(i"AFK"GetPVarInt(i"AFK") +1);
            if(
GetPVarInt(i"AFK") > 1)
            {
                
text[i] = Create3DTextLabel("AFK: Away From Keyboard !",0xFFF600FF,10.0,40.0,10.0,20.0,0);
                
Attach3DTextLabelToPlayer(text[i], i0.00.00.4);
            }
        }
        else { 
Delete3DTextLabel(text[i]); }
        
SetPVarFloat(i"X"Pos[0]);
        
SetPVarFloat(i"Y"Pos[1]);
        
SetPVarFloat(i"Z"Pos[2]);
    }
    return 
1;




Re: Afk system. - Revolutionary Roleplay - 01.07.2011

If you just want someone to do it for you, post a request in the stickied thread. I would be glad to help you, but I'm not going to waste my time just writing code for you when you have no desire to learn from it.