[FilterScript] Simple AFK System.
#1

Introduction.
Hello, my name is Juan Viz, most known as Phantom, I'm new in things like scripting, I already have some map releases but I though I needed to go to another level and do something like this so enjoy!
Code | Download
pawn Код:
/*

Filterscript created by: Phantom
Credits:
lelemaster for helping me while doing the script.
V1ceC1ty for helping me while doing the script aswell.
Akira297 for insipiring me to script.
Note: If you release / use it on any webpage or gamemode give me credits.
Feel free to Edit/remove/add lines of code to the FS.
SA:MP Forums


*/

#define Filterscript
#include <a_samp>
new pAFK[MAX_PLAYERS] = 0;
#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
        print("\n--------------------------------------");
        print(" Away from keyboard FS Loaded");
        print("--------------------------------------\n");
        return 1;
}

public OnFilterScriptExit()
{
        return 1;
}

#else

main()
{
        print("\n----------------------------------");
        print(" Away from keyboard FS Unloaded");
        print("----------------------------------\n");
}
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/afk", cmdtext, true, 10) == 0)
    {
        if(pAFK[playerid] == 1)
        {
            SendClientMessage(playerid, 0xEFEFF7AA, "You are already AFK! As you typed this, it means you are back!");
            SetPlayerHealth(playerid, 100);
            pAFK[playerid] == 0;
        }
        else if(pAFK[playerid] == 0)
        {
            SendClientMessage(playerid, 0xFFFFFFFF, "You are now AFK!");
            SetPlayerVirtualWorld(playerid, 69696969);
            pAFK[playerid] == 1;
            SetPlayerHealth(playerid, 9999999);
        }
        return 1;
    }
    if (strcmp("/back", cmdtext, true, 10) == 0)
    {
        if(pAFK[playerid] == 0)
        {
            SendClientMessage(playerid, 0xEFEFF7AA, "You are not even AFK!!");
        }
        else if(pAFK[playerid] == 1)
        {
            pAFK[playerid] == 0;
            SetPlayerVirtualWorld(playerid, 0);
            SetPlayerHealth(playerid, 100);
            SendClientMessage(playerid, 0xFFFFFFFF, "You are now back");
        }
        return 1;
    }
    return 0;
}

public OnPlayerDisconnect(playerid)
{
    pAFK[playerid] = 0;
    return 1;
}
public OnPlayerConnect(playerid)
{
        pAFK[playerid] == 0;
}
#endif
Код:
Changelog
-V0.1 Released --First release -V0.2 Released --Removed useless line of codes --HP Sets to 99999 when you /AFK --HP Sets to 100 when you /back --HP Sets to 100 when you /AFK While being AFK, which means automaticly comming back. For more information about the last update on the V0.2 read the first line of /AFK
Well thats all, thanks for downloading or using this, enjoy!

Updated to V0.2
Removed useless coding.


NOTE: Make sure to add #define Filterscript at the top of the script (if you download it/use pastebin) or it won't work.
Reply


Messages In This Thread
Simple AFK System. - by Juan_Viz - 26.10.2012, 20:19
Re: Simple AFK System. - by Yamakei - 26.10.2012, 20:20
Respuesta: Re: Simple AFK System. - by Juan_Viz - 26.10.2012, 20:22
Re: Simple AFK System. - by NoahF - 26.10.2012, 20:44
Respuesta: Re: Simple AFK System. - by Juan_Viz - 26.10.2012, 20:55
Re: Simple AFK System. - by Yamakei - 26.10.2012, 21:33
Re: Simple AFK System. - by NoahF - 26.10.2012, 22:07
Re: Simple AFK System. - by Hashish - 27.10.2012, 04:28
Respuesta: Simple AFK System. - by Juan_Viz - 27.10.2012, 11:44
Re: Respuesta: Simple AFK System. - by NoahF - 27.10.2012, 12:14

Forum Jump:


Users browsing this thread: 1 Guest(s)