[AFK List] Support needed if poss
#9

Quote:
Originally Posted by nepstep
Посмотреть сообщение
There you go
pawn Код:
#include <a_samp>

new AFK[MAX_PLAYERS];
new Text3D:AFKL[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    AFK[playerid] = 0;
    return 1;
}

public OnPlayerDisconnect(playerid)
{
    Delete3DTextLabel(AFKL[playerid]);
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    new string[256];

    if (strcmp("/afklist", cmdtext, true) == 0)
    {
            SendClientMessage(playerid, 0x33AA33AA, "AFK LIST:");
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(AFK[i] == 1)
                    {
                            new name[128];
                            GetPlayerName(i,name,128);
                            format(string, 256, "%s", name);
                            SendClientMessage(playerid, 0xFFFF00FF, string);
                    }
                }
            }
            return 1;
    }
    if(!strcmp(cmdtext, "/imafk", true))
    {
        new name[MAX_PLAYER_NAME];
        if(AFK[playerid] == 1) return SendClientMessage(playerid, 0xFF0000FF, "You are already AFK!");
        GetPlayerName(playerid, name, sizeof name);
        AFK[playerid] = 1;
        TogglePlayerControllable(playerid, 0);
        SendClientMessage(playerid, 0x33AA33AA, "You are now AFK, When you are back type /back!");
        format(string, sizeof string, "%s is now AFK!", name);
        SendClientMessageToAll(0xAFAFAFAA, string);
        AFKL[playerid] = Create3DTextLabel("Away From Keyboard", 0xFF0000FF, 30.0, 40.0, 50.0, 40.0, 0);
        Attach3DTextLabelToPlayer(AFKL[playerid], playerid, 0.0, 0.0, 0.7);
        return 1;
    }
    if(!strcmp(cmdtext, "/back", true))
    {
        new name[MAX_PLAYER_NAME];
        if(AFK[playerid] == 0) return SendClientMessage(playerid, 0xFF0000FF, "You aren't AFK!");
        GetPlayerName(playerid, name, sizeof name);
        AFK[playerid] = 0;
        TogglePlayerControllable(playerid, 1);
        SendClientMessage(playerid, 0x33AA33AA, "You are back!");
        format(string, sizeof string, "%s is back!", name);
        SendClientMessageToAll(0xAFAFAFAA, string);
        Delete3DTextLabel(AFKL[playerid]);
        return 1;
    }
    return 0;
}
Goodluck & Goodnight from me, I'm off for today
Thankyou for that, I removed the old afk system from ravens and put this one in, Much better!

Thanks
Reply


Messages In This Thread
[AFK List] Support needed if poss - by UnknownGamer - 19.07.2012, 23:37
Re: [AFK List] Support needed if poss - by nepstep - 19.07.2012, 23:39
Re: [AFK List] Support needed if poss - by UnknownGamer - 19.07.2012, 23:40
Re: [AFK List] Support needed if poss - by nepstep - 19.07.2012, 23:43
Re: [AFK List] Support needed if poss - by UnknownGamer - 19.07.2012, 23:48
Re: [AFK List] Support needed if poss - by nepstep - 19.07.2012, 23:50
Re: [AFK List] Support needed if poss - by UnknownGamer - 19.07.2012, 23:54
Re: [AFK List] Support needed if poss - by nepstep - 19.07.2012, 23:56
Re: [AFK List] Support needed if poss - by UnknownGamer - 20.07.2012, 00:05

Forum Jump:


Users browsing this thread: 2 Guest(s)