SA-MP Forums Archive
[HELP] AFK Puts [AFK] In-Front Of Name (eg. /afk = [AFK]Name) ? - 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: [HELP] AFK Puts [AFK] In-Front Of Name (eg. /afk = [AFK]Name) ? (/showthread.php?tid=202428)



[HELP] AFK Puts [AFK] In-Front Of Name (eg. /afk = [AFK]Name) ? - <Weponz> - 24.12.2010

Ok i have a working /afk command. I want to know how to make the /afk command put a "[AFK]" tag in there name when in AFK so players know when people are AFK and when they /back there name is back to normal?

Any help?

pawn Код:
CMD:afk(playerid, params[])
{
        new string[128];
        new name[MAX_PLAYER_NAME];
        if(isafk[playerid] == false)
        {
            if(afktimer[playerid]) return SendClientMessage(playerid,RED,"Please Wait Before Being AFK Again!");
            afktimer[playerid] =30;
            isafk[playerid] = true;
            SetPlayerHealth(playerid, 9999);
            GetPlayerName(playerid, name, MAX_PLAYER_NAME);
            format(string, sizeof(string), "%s Is Now AFK",name);
            printf(string);
            SendClientMessage(playerid, YELLOW, "Type /back To Stop Being AFK.");
            SendClientMessageToAll(RED, string);
            TogglePlayerControllable(playerid,0);
        }
        else
        {
            SendClientMessage(playerid, RED, "You Are Already AFK!");
        }
    return true;
}

CMD:back(playerid, params[])
{
        new string[128];
        new name[MAX_PLAYER_NAME];
        if(isafk[playerid] == true)
        {
            isafk[playerid] = false;
            GetPlayerName(playerid, name, MAX_PLAYER_NAME);
            format(string, sizeof(string), "%s Is No Longer AFK",name);
            SendClientMessageToAll(YELLOW, string);
            printf(string);
            TogglePlayerControllable(playerid,1);
        }
        else
        {
        SendClientMessage(playerid, RED, "You Are Not AFK!");
        }
    return true;
}
Thanks In Advanced!


Re: [HELP] AFK Puts [AFK] In-Front Of Name (eg. /afk = [AFK]Name) ? - Gavibro - 24.12.2010

pawn Код:
CMD:afk(playerid, params[])
{
        new string[128];
        new name[MAX_PLAYER_NAME];
        if(isafk[playerid] == false)
        {
            if(afktimer[playerid]) return SendClientMessage(playerid,RED,"Please Wait Before Being AFK Again!");
            afktimer[playerid] =30;
            isafk[playerid] = true;
            SetPlayerHealth(playerid, 9999);
            GetPlayerName(playerid, name, MAX_PLAYER_NAME);
            format(string, sizeof(string), "%s Is Now AFK",name);
            new NewName[24];//
            format(NewName,24,"[AFK]%s",name);//
            SetPlayerName(playerid,NewName);
            printf(string);
            SendClientMessage(playerid, YELLOW, "Type /back To Stop Being AFK.");
            SendClientMessageToAll(RED, string);
            TogglePlayerControllable(playerid,0);
        }
        else
        {
            SendClientMessage(playerid, RED, "You Are Already AFK!");
        }
    return true;
}

CMD:back(playerid, params[])
{
        new string[128];
        new name[MAX_PLAYER_NAME];
        if(isafk[playerid] == true)
        {
            isafk[playerid] = false;
            GetPlayerName(playerid, name, MAX_PLAYER_NAME);
            strdel(name,0,5);//
            SetPlayerName(playeri,name);//
            format(string, sizeof(string), "%s Is No Longer AFK",name);
           
            SendClientMessageToAll(YELLOW, string);
            printf(string);
            TogglePlayerControllable(playerid,1);
        }
        else
        {
        SendClientMessage(playerid, RED, "You Are Not AFK!");
        }
    return true;
}
I hope it will work


Re: [HELP] AFK Puts [AFK] In-Front Of Name (eg. /afk = [AFK]Name) ? - Jeffry - 24.12.2010

I suggest you NOT to use this.
I had it on my server over one year, and just now I've found out that this sucks.

Take a very long name (Maximum) and put the [AFK] infront. => Means the name gets 5 chars longer. By doing /back again, the last letters of the name will miss.

I have removed the Tag at my server. Just a info for you.


Re: [HELP] AFK Puts [AFK] In-Front Of Name (eg. /afk = [AFK]Name) ? - <Weponz> - 24.12.2010

@Gavibro

Thanks!~ i GTG now ill test in 20mins


@ Jeffry

Hmm interesting.Thanks for sharing this with me.


Re: [HELP] AFK Puts [AFK] In-Front Of Name (eg. /afk = [AFK]Name) ? - Steven82 - 24.12.2010

Quote:
Originally Posted by Jeffry
Посмотреть сообщение
I suggest you NOT to use this.
I had it on my server over one year, and just now I've found out that this sucks.

Take a very long name (Maximum) and put the [AFK] infront. => Means the name gets 5 chars longer. By doing /back again, the last letters of the name will miss.

I have removed the Tag at my server. Just a info for you.
Thought you would of know that since the name can only be like 20/24/25 characters i can't remeber lol but yea...seems like a good idea until the long run.


Re: [HELP] AFK Puts [AFK] In-Front Of Name (eg. /afk = [AFK]Name) ? - Retardedwolf - 24.12.2010

You could just set the AFK player's name to AFKPLAYER(INSERT PLAYER ID HERE ), store their name and return it back to them when they use /back