How to make a /afklist command?
#1

Does anyone know how to make this, I have already a variable setted for my normal /afk and /back but now I want people to see who is /afk.

Variable at top of script:
pawn Код:
new IsAFK[MAX_PLAYERS];
It must be like in
pawn Код:
COMMAND:afklist(playerid,params[])
new Msg[128], Afkname[24];
{
   
    format(Msg, 128, "{FF6600}s%", Afkname[24]); // the guy who is AFK.
    SendClientMessage(playerid, 0xFFFFFFFF, "People who are AFK:")
    SendClientMessage(playerid, 0xFFFFFFFF, Msg)
}
Someone could help?
Reply
#2

Код:
COMMAND:afklist(playerid,params[])
new Msg[128], Afkname[24];
{
    
    format(Msg, 128, "{FF6600}%s is now AFK", Afkname[24]); // the guy who is AFK.
    SendClientMessage(playerid, 0xFFFFFFFF, Msg)
}
This can be the correct code for you according to your code!
Reply
#3

Something like this...
pawn Код:
command(afklist, playerid, params)
{
new pString[MAX_PLAYER_NAME], pName[MAX_PLAYER_NAME];

for(new pID = 0; pID < MAX_PLAYERS; pID ++)
{
if(IsPlayerConnected(pID)
{
if(IsPlayerAFK[pID] == 1)
{
SendClientMessage(playerid, 0xFFFFFFFF, "Players on AFK");
GetPlayerName(playerid, pName, sizeof(pName));
format(pString, sizeof(pString), "%s" pName);
SendClientMessage(playerid, 0xFFFFFFFF, pString);
}
}
}
return 1;
}
Reply
#4

untested, but I see no reason this shoudn't work

pawn Код:
CMD:afklist(playerid)
{
    new pString[MAX_PLAYER_NAME + 2];
    new pName[MAX_PLAYER_NAME];
    SendClientMessage(playerid, 0xFFFF00AA, "|_____AFK Players_____|");
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i)
        {
            if(IsAFK[i] == 1)
            {
                GetPlayerName(i, pName, sizeof(pName));
                format(pString, sizeof(pString), "> %s" pName);
                SendClientMessage(playerid, 0xFFFFFFAA, pString);
            }
        }
    }
    return 1;
}
Reply
#5

Quote:
Originally Posted by Rob_Maate
Посмотреть сообщение
untested, but I see no reason this shoudn't work

pawn Код:
CMD:afklist(playerid)
{
    new pString[MAX_PLAYER_NAME + 2];
    new pName[MAX_PLAYER_NAME];
    SendClientMessage(playerid, 0xFFFF00AA, "|_____AFK Players_____|");
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i)
        {
            if(IsAFK[i] == 1)
            {
                GetPlayerName(i, pName, sizeof(pName));
                format(pString, sizeof(pString), "> %s" pName);
                SendClientMessage(playerid, 0xFFFFFFAA, pString);
            }
        }
    }
    return 1;
}
Yeah it will according to his functions. I hope so!
Reply
#6

Well in his script were only errors, like he forgot an ) at the end and some other stuff.

Well it's fixed now, thanks for helping me out. BUt remember i'm not a copy-paste-aholic.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)