SA-MP Forums Archive
/admins list, names. - 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: /admins list, names. (/showthread.php?tid=128702)



/admins list, names. - Landon - 19.02.2010

Hi SAMP scripters.

I am having a roleplay script, with alot of different admin names, but if I typ /admins in the server, it will shows:

Admins online:
Bla_Bla - [Level 3]

since he is a level 3 admin, is there any way to change the "Level 3" to Game Admin? So, if I typ /makeadmin 0 3 that he has the name: Game Admin?

Appreciated.


Re: /admins list, names. - Jeffry - 19.02.2010

Can you show your /admins code?


Re: /admins list, names. - aircombat - 19.02.2010

Quote:
Originally Posted by Jeffry
Can you show your /admins code?
i agree , u need to show : /admins command
________
OUTDOOR ORGY


Re: /admins list, names. - notime - 19.02.2010

Код:
new AdminNames[][32] =
{
	{"No admin"},
	{"Level 1"},
	{"Level 2"},
	{"Game Admin"}
};
place this somewhere at the top of your script like every other "new".
btw: you can change the "No Admin", "Level 1" and "Level 2" into something you like.

then at your /admins make the string like this:
I dont know how you got your admin level defined so i just use "AccountInfo[playerid][AdminLevel]" for it, you can change that with your info.
and im not sure u use "PlayerName" but you can define that or change that.
Код:
format(string, sizeof(string), "%s - [Level %d] %s", AdminNames[AccountInfo[playerid][AdminLevel]], AccountInfo[playerid][AdminLevel], PlayerName);
This will show the line like this if hes admin level 3:
Код:
"Game Admin - [Level 3] Notime"



Re: /admins list, names. - Landon - 19.02.2010

Alright, I've used the search tool, helped me alot, but I am a 1337 admin, but that doesn't show a name.

pawn Код:
if (strcmp(cmd, "/admins", true) == 0)
    {
    if(IsPlayerConnected(playerid))
      {
        SendClientMessage(playerid, COLOR_GREY, "Admins online");
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                  if(PlayerInfo[i][pAdmin] >= 1 && PlayerInfo[i][pAdmin] < 1337)
                  {
                    new admtext[64];
                        if(PlayerInfo[playerid][pAdmin] == 1) { admtext = "Roleplay Admin"; }
                        else if(PlayerInfo[playerid][pAdmin] == 2) { admtext = "Game Admin"; }
                        else if(PlayerInfo[playerid][pAdmin] == 3) { admtext = "Senior Game Admin"; }
                        else if(PlayerInfo[playerid][pAdmin] == 1337) { admtext = "Community Owner"; }
                        else { admtext = "Unknown Administrator"; }
                        GetPlayerName(i, sendername, sizeof(sendername));
                        if(AdminDuty[i] == 0)
                        {
                            format(string, 256, "%s %s Adminduty: No", admtext, sendername);
                            SendClientMessage(playerid, COLOR_GREY, string);
                        }
                        else
                        {
                          format(string, 256, "%s %s Adminduty: Yes", admtext, sendername);
                            SendClientMessage(playerid, COLOR_GREEN, string);
                        }
                    }
                }
            }
        }
        return 1;
    }



Re: /admins list, names. - Jeffry - 19.02.2010

Maybe try

pawn Код:
(cmd, "/admins", true) == 0)
    {
    if(IsPlayerConnected(playerid))
      {
        SendClientMessage(playerid, COLOR_GREY, "Admins online");
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                  if(PlayerInfo[i][pAdmin] >= 1 && PlayerInfo[i][pAdmin] < 1338) //here was 1337, but you are 1337, means it will dont show, cause 1337 is not lower then 1337
                  {
                    new admtext[64];
                        if(PlayerInfo[i][pAdmin] == 1) { admtext = "Roleplay Admin"; }
                        else if(PlayerInfo[i][pAdmin] == 2) { admtext = "Game Admin"; } // And here, i made [playerid] to [i]
                        else if(PlayerInfo[i][pAdmin] == 3) { admtext = "Senior Game Admin"; }
                        else if(PlayerInfo[i][pAdmin] == 1337) { admtext = "Community Owner"; }
                        else { admtext = "Unknown Administrator"; }
                        GetPlayerName(i, sendername, sizeof(sendername));
                        if(AdminDuty[i] == 0)
                        {
                            format(string, 256, "%s %s Adminduty: No", admtext, sendername);
                            SendClientMessage(playerid, COLOR_GREY, string);
                        }
                        else
                        {
                          format(string, 256, "%s %s Adminduty: Yes", admtext, sendername);
                            SendClientMessage(playerid, COLOR_GREEN, string);
                        }
                    }
                }
            }
        }
        return 1;
    }
Hope it works


Re: /admins list, names. - [NYRP]Mike. - 19.02.2010

Here you go buddy, enjoy Works fine i tested it.

pawn Код:
// Add this ontop of your script
new AdminDuty[MAX_PLAYERS];
pawn Код:
// Main command
if (strcmp(cmd, "/admins", true) == 0)
    {
    if(IsPlayerConnected(playerid))
      {
        SendClientMessage(playerid, COLOR_RED, " ");
        SendClientMessage(playerid, COLOR_RED, "Online Admins: ");
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                  if(PlayerInfo[i][pAdmin] >= 1 && PlayerInfo[i][pAdmin] < 1341)
                  {
                    new admtext[64];
                    if(PlayerInfo[i][pAdmin] == 1337) { admtext = "Lead Admin"; }
                    else if(PlayerInfo[i][pAdmin] == 4) { admtext = "High Admin"; }
                        else if(PlayerInfo[i][pAdmin] == 3) { admtext = "Normal Admin"; }
                        else if(PlayerInfo[i][pAdmin] == 2) { admtext = "Low Admin"; }
                        else if(PlayerInfo[i][pAdmin] == 1) { admtext = "Moderator"; }
                        else { admtext = "Moderator"; }
                        GetPlayerName(i, sendername, sizeof(sendername));
                        if(AdminDuty[i] == 0)
                        {
                            format(string, 256, "%s ( %s )", sendername, admtext);
                            SendClientMessage(playerid, COLOR_WHITE, string);
                        }
                        else
                        {
                          format(string, 256, "%s ( %s )", sendername, admtext);
                            SendClientMessage(playerid, COLOR_YELLOW, string);
                        }
                    }
                }
            }
        }
        return 1;
    }



Re: /admins list, names. - Landon - 19.02.2010

Both codes are working, thanks guys!

But I would like to get ride of the underscore if I have a name like: Firstname_Lastname

Appreciated! <3


Re: /admins list, names. - Landon - 20.02.2010

Bump?


Re: /admins list, names. - dice7 - 20.02.2010

pawn Код:
GetPlayerName(i, sendername, sizeof(sendername));
new pos = strfind("Are you in here?", "_");
if(pos > -1) sendername[pos] = ' ';