SA-MP Forums Archive
Problem with online administrators. - 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: Problem with online administrators. (/showthread.php?tid=515093)



Problem with online administrators. - DemME - 24.05.2014

Hey, I've got a command like /admins, but in-game it won't to show the current online admins.

PHP код:
    if (strcmp(cmd"/admins"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            
SendClientMessage(playeridCOLOR_GREY"Admins Online:");
              for(new 
0PLAYERSi++)
            {
                if(
IsPlayerConnected(i))
                {
                    if(
PlayerInfo[playerid][pAdmin] == 0)
                    {
                        if(
PlayerInfo[i][pAdmin] >= && PlayerInfo[i][pAdmin] <= 5000)
                        {
                            new 
admtext[64];
                            if(
PlayerInfo[i][pAdmin] == 5000) { admtext "Server Developer"; }
                            else if(
PlayerInfo[i][pAdmin] == 1338) { admtext "Head Administrator"; }
                            else if(
PlayerInfo[i][pAdmin] == 3) { admtext "Administrator Level 3"; }
                            else if(
PlayerInfo[i][pAdmin] == 2)    { admtext "Administrator Level 2"; }
                            else if(
PlayerInfo[i][pAdmin] == 1) { admtext "Administrator Level 1"; }
                            else { 
admtext "Lead Administrator"; }
                            
GetPlayerName(isendernamesizeof(sendername));
                            if(
AdminDuty[i] == 0)
                            {
                                
format(stringsizeof(string), "(%s) %s (ID: %d) Adminduty: No",admtextGetPlayerNameEx(i), i);
                                
SendClientMessage(playeridCOLOR_GREYstring);
                            }
                            else
                            {
                                
format(stringsizeof(string), "(%s) %s (ID: %d) Adminduty: Yes",admtextGetPlayerNameEx(i), i);
                                
SendClientMessage(playeridCOLOR_GROVEstring);
                            }
                        }
                    }
                }
            }
        }
        return 
1;
    } 
+REP Promised for helpers.


Re : Problem with online administrators. - S4t3K - 24.05.2014

Try adding printf at each time you do something in your script.

And describe what you do, for example after "IsPlayerConnected(playerid)" add "printf("Player connected");", and after the beginning of the for loop, add "printf("Entering in the loop !");" etc etc, then check your console and tell us the last printf displayed into.


Re: Problem with online administrators. - Barnwell - 24.05.2014

go in the game and try this /ahide


Re: Problem with online administrators. - iFiras - 24.05.2014

Try this:
pawn Код:
if (strcmp(cmd, "/admins", true) == 0)
{
        if(IsPlayerConnected(playerid))
        {
            SendClientMessage(playerid, COLOR_GREY, "Admins Online:");
            for(new i = 0; i < PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                        if(PlayerInfo[i][pAdmin] >= 1 && PlayerInfo[i][pAdmin] <= 5000)
                        {
                            new admtext[64];
                            if(PlayerInfo[i][pAdmin] == 5000) { format(admtext,sizeof(admtext),"Server Developer"); }
                            else if(PlayerInfo[i][pAdmin] == 1338) { format(admtext,sizeof(admtext),"Head Administrator"); }
                            else if(PlayerInfo[i][pAdmin] == 3) { format(admtext,sizeof(admtext),"Administrator Level 3"); }
                            else if(PlayerInfo[i][pAdmin] == 2)    { format(admtext,sizeof(admtext),"Administrator Level 2"); }
                            else if(PlayerInfo[i][pAdmin] == 1) { format(admtext,sizeof(admtext),"Administrator Level 1"); }
                            else { format(admtext,sizeof(admtext),"Lead Administrator"); }
                            GetPlayerName(i, sendername, sizeof(sendername));

                            if(AdminDuty[i] == 0)
                            {
                                format(string, sizeof(string), "(%s) %s (ID: %d) Adminduty: No",admtext, GetPlayerNameEx(i), i);
                                SendClientMessage(playerid, COLOR_GREY, string);
                            }
                            else
                            {
                                format(string, sizeof(string), "(%s) %s (ID: %d) Adminduty: Yes",admtext, GetPlayerNameEx(i), i);
                                SendClientMessage(playerid, COLOR_GROVE, string);
                            }


                  }
            }

        }
        return 1;
}



Re: Problem with online administrators. - Jefff - 24.05.2014

pawn Код:
if(strcmp(cmd, "/admins", true) == 0)
{
    new admtext[64];
    SendClientMessage(playerid, COLOR_GREY, "Admins Online:");
    for(new i = 0; i < PLAYERS; i++)
        if(IsPlayerConnected(i))
            if(1 <= PlayerInfo[i][pAdmin] <= 5000)
            {
                if(PlayerInfo[i][pAdmin] == 5000)       admtext = "Server Developer";
                else if(PlayerInfo[i][pAdmin] == 1338)  admtext = "Head Administrator";
                else if(PlayerInfo[i][pAdmin] == 3)     admtext = "Administrator Level 3";
                else if(PlayerInfo[i][pAdmin] == 2)     admtext = "Administrator Level 2";
                else if(PlayerInfo[i][pAdmin] == 1)     admtext = "Administrator Level 1";
                else                                    admtext = "Lead Administrator";

                format(string, sizeof(string), "(%s) %s (ID: %d) Adminduty: %s",admtext, GetPlayerNameEx(i), i, (!AdminDuty[i]) ? ("No") : ("Yes"));
                SendClientMessage(playerid, (!AdminDuty[i]) ? COLOR_GREY : COLOR_GROVE, string);
            }

    if(!admtext[0])
        SendClientMessage(playerid, COLOR_GREY, "No Admins Online");

    return 1;
}



Re: Problem with online administrators. - Jacksta21 - 24.05.2014

Edit: Nevermind:P


Re: Problem with online administrators. - DemME - 24.05.2014

Quote:
Originally Posted by Jefff
Посмотреть сообщение
pawn Код:
if(strcmp(cmd, "/admins", true) == 0)
{
    new admtext[64];
    SendClientMessage(playerid, COLOR_GREY, "Admins Online:");
    for(new i = 0; i < PLAYERS; i++)
        if(IsPlayerConnected(i))
            if(1 <= PlayerInfo[i][pAdmin] <= 5000)
            {
                if(PlayerInfo[i][pAdmin] == 5000)       admtext = "Server Developer";
                else if(PlayerInfo[i][pAdmin] == 1338)  admtext = "Head Administrator";
                else if(PlayerInfo[i][pAdmin] == 3)     admtext = "Administrator Level 3";
                else if(PlayerInfo[i][pAdmin] == 2)     admtext = "Administrator Level 2";
                else if(PlayerInfo[i][pAdmin] == 1)     admtext = "Administrator Level 1";
                else                                    admtext = "Lead Administrator";

                format(string, sizeof(string), "(%s) %s (ID: %d) Adminduty: %s",admtext, GetPlayerNameEx(i), i, (!AdminDuty[i]) ? ("No") : ("Yes"));
                SendClientMessage(playerid, (!AdminDuty[i]) ? COLOR_GREY : COLOR_GROVE, string);
            }

    if(!admtext[0])
        SendClientMessage(playerid, COLOR_GREY, "No Admins Online");

    return 1;
}
Simple, Short and works perfect! +rep, thanks you!