SA-MP Forums Archive
AFK Help /Admins - 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)
+--- Thread: AFK Help /Admins (/showthread.php?tid=598707)



AFK Help /Admins - Tween73 - 16.01.2016

"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;
}




Re: AFK Help /Admins - Amunra - 16.01.2016

What the Problem ?
The AFK admin not show ?


Re: AFK Help /Admins - Tween73 - 16.01.2016

Yes Please


Re: AFK Help /Admins - Sew_Sumi - 16.01.2016

Код:
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.


Re: AFK Help /Admins - Eth - 16.01.2016

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.


Re: AFK Help /Admins - Sew_Sumi - 16.01.2016

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


Re: AFK Help /Admins - Tween73 - 16.01.2016

PlayerInfo[i][AFK]


Re: AFK Help /Admins - Tween73 - 16.01.2016

ї?
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
}




Re: AFK Help /Admins - Sew_Sumi - 16.01.2016

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.


Respuesta: AFK Help /Admins - IzadorO - 16.01.2016

Код:
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.