AFK Help /Admins
#1

"AFK" Help /Admins

Quote:

CMD:Admins(playerid, params[])
{
new string[128];
new count=0;
new AFK[128]; // ---> AFK
SendClientMessage(playerid, COLOR_WHITE, "Admins Online");
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pAdmin] > 0)
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(i, pName, sizeof(pName));
format(string, 256, "( Admin %d ) %s [Id:%d] %s {008080}[%s]",PlayerInfo[i][pAdmin],pName,i,AFK); // ---> AFK
// ---> and
format(string, 256, "( Admin %d ) %s [Id:%d] %s",PlayerInfo[i][pAdmin],pName,i); // ---> Back
SendClientMessage(playerid, COLOR_GREY, string);
count++;
}
}
}
return 1;
}

Reply
#2

What the Problem ?
The AFK admin not show ?
Reply
#3

Yes Please
Reply
#4

Код:
GetPlayerName(i, pName, sizeof(pName));
format(string, 256, "( Admin %d ) %s [Id:%d] %s {008080}[%s]",PlayerInfo[i][pAdmin],pName,i,AFK); // ---> AFK
// ---> and
format(string, 256, "( Admin %d ) %s [Id:%d] %s",PlayerInfo[i][pAdmin],pName,i); // ---> Back
SendClientMessage(playerid, COLOR_GREY, string);
That simply makes the string twice, without even checking anything.

It'll use the second one always.



that, or you've cropped out some code.
Reply
#5

You haven't formatted
pawn Код:
new AFK[128]; // ---> AFK
you should format it, something like this:
pawn Код:
new AFK[128]; // ---> AFK
   format(AFK,128,"%s",PlayerInfo[i][AFK]);
or something like that.
Reply
#6

Quote:
Originally Posted by Eth
Посмотреть сообщение
or something like that.
It would help if AFK actually had something to format.
Reply
#7

PlayerInfo[i][AFK]
Reply
#8

ї?
Quote:

enum pInfo
{
pPassword[129],
pAdmin,
pLevel,
pVip,
pMoney,
pScore,
pSkin,
pKills,
pDeaths,
pBanned
}

Or
Quote:

enum pInfo
{
pPassword[129],
pAdmin,
pLevel,
pVip,
pMoney,
pScore,
pSkin,
pKills,
pDeaths,
pAfk,
pBanned
}

Reply
#9

Don't waste an enum slot for something like this. It's only worth a variable.

As I said before, you'll have to look at how you are doing that string format.

Код:
If(AFK[playerid]>0)
{
format(string, 256, "( Admin %d ) %s [Id:%d] %s {008080}[%s]",PlayerInfo[i][pAdmin],pName,i,AFK); 
}
else
{
format(string, 256, "( Admin %d ) %s [Id:%d] %s",PlayerInfo[i][pAdmin],pName,i);
}
^^ Totally untested, and not intended to be copied... It's simply there to try show what I mean.
Reply
#10

Код:
enum pInfo
{
pAFK,
};

CMD:admins(playerid, params[])
{
    static
         string[128],
         name[24];

    SendClientMessage(playerid, -1, "Admins online:");

    for(new I = 0; I < MAX_PLAYERS; I++) if(PlayerInfo[I][pAdmin]) {
        GetPlayerName(I, name, 24);
        format(string, sizeof(string), "( Admin %d) %s [Id: %d] Status: %s", PlayerInfo[I][pAdmin], name, I, (PlayerInfo[I][pAFK]) ? ("Away") : ("Available"));
        SendClientMessage(playerid, -1, string);
    }
    return 1;
}
Use this.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)