SA-MP Forums Archive
/admins command - 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 command (/showthread.php?tid=274692)



/admins command - DannySnoopy - 06.08.2011

Okay so i use the PRP GM, and i added a new /admins look, instead of LVL's rank names for admins.

Now, when i set some one as admin i can see his rank name like this (Owner) Martin_Tortelli.

When i remove him from the admin team, it says () Martin_Tortelli. how do i fix it? thanks for the helpers.

Here's the code

PHP код:
if (strcmp(cmd"/admins"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            
SendClientMessage(playeridCOLOR_WHITE" ");
            
SendClientMessage(playeridCOLOR_WHITE"||~||..::{FF0000}Los Angeles RP Admins{FFFFFF}::..||~||");
            for(new 
0MAX_PLAYERSi++)
            {
                if(
IsPlayerConnected(i))
                {
                    {
                        new 
admtext[64];
                         if(
PlayerInfo[i][pAdmin] == 10000) { admtext "Owner"; }
                        else if(
PlayerInfo[i][pAdmin] == 99999) { admtext "Server Manager"; }
                        else if(
PlayerInfo[i][pAdmin] == 1337) { admtext "Head Administrator"; }
                        else if(
PlayerInfo[i][pAdmin] == 4) { admtext "High Administrator"; }
                        else if(
PlayerInfo[i][pAdmin] == 3) { admtext "Senior Administrator"; }
                        else if(
PlayerInfo[i][pAdmin] == 2)    { admtext "Junior Administrator"; }
                        else if(
PlayerInfo[i][pAdmin] == 1) { admtext "Moderator"; }
                        
GetPlayerName(isendernamesizeof(sendername));
                        if(
AdminDuty[i] == 0)
                        {
                            
format(string256"{FF0000}( %s ) {FFFFFF}%s "admtextsendername);
                            
SendClientMessage(playeridCOLOR_WHITEstring);
                        }
                        else
                        {
                            
format(string256"{FF0000}( %s ) {FFFFFF}%s "admtextsendername);
                            
SendClientMessage(playeridCOLOR_WHITEstring);
                        }
                    }
                }
            }
        }
        return 
1;
    } 



Re: /admins command - 0_o - 06.08.2011

Remove
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
            {
And All "i". You Do This For All Players. Mean If You Got 25 Players You See 25 Players Name This Way In Admins : ()Test


Re: /admins command - DannySnoopy - 06.08.2011

Ehm... it gives me an error when i remove it..


Re: /admins command - 0_o - 06.08.2011

Np


Re: /admins command - DannySnoopy - 06.08.2011

Quote:
Originally Posted by 0_o
Посмотреть сообщение
Np
eh.. it says an error -.-


Re: /admins command - 0_o - 06.08.2011

Post It Here.


Re: /admins command - dowster - 06.08.2011

pawn Код:
if (strcmp(cmd, "/admins", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            SendClientMessage(playerid, COLOR_WHITE, " ");
            SendClientMessage(playerid, COLOR_WHITE, "||~||..::{FF0000}Los Angeles RP Admins{FFFFFF}::..||~||");
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
            if(PlayerInfo[i][pAdmin] != 0) 
                    {
                        new admtext[64];
                         if(PlayerInfo[i][pAdmin] == 10000) { admtext = "Owner"; }
                        else if(PlayerInfo[i][pAdmin] == 99999) { admtext = "Server Manager"; }
                        else if(PlayerInfo[i][pAdmin] == 1337) { admtext = "Head Administrator"; }
                        else if(PlayerInfo[i][pAdmin] == 4) { admtext = "High Administrator"; }
                        else if(PlayerInfo[i][pAdmin] == 3) { admtext = "Senior Administrator"; }
                        else if(PlayerInfo[i][pAdmin] == 2)    { admtext = "Junior Administrator"; }
                        else if(PlayerInfo[i][pAdmin] == 1) { admtext = "Moderator"; }
                        GetPlayerName(i, sendername, sizeof(sendername));
                        if(AdminDuty[i] == 0)
                        {
                            format(string, 256, "{FF0000}( %s ) {FFFFFF}%s ", admtext, sendername);
                            SendClientMessage(playerid, COLOR_WHITE, string);
                        }
                        else
                        {
                            format(string, 256, "{FF0000}( %s ) {FFFFFF}%s ", admtext, sendername);
                            SendClientMessage(playerid, COLOR_WHITE, string);
                        }
                    }
                }
            }
        }
        return 1;
    }
The if(PlayerInfo[i][pAdmin] != 0) checks if the player is an admin before processing all that code, will also be faster becuase then for non admin players it doesn't have to process all that.


Re: /admins command - DannySnoopy - 06.08.2011

Quote:
Originally Posted by dowster
Посмотреть сообщение
pawn Код:
if (strcmp(cmd, "/admins", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            SendClientMessage(playerid, COLOR_WHITE, " ");
            SendClientMessage(playerid, COLOR_WHITE, "||~||..::{FF0000}Los Angeles RP Admins{FFFFFF}::..||~||");
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
            if(PlayerInfo[i][pAdmin] != 0) 
                    {
                        new admtext[64];
                         if(PlayerInfo[i][pAdmin] == 10000) { admtext = "Owner"; }
                        else if(PlayerInfo[i][pAdmin] == 99999) { admtext = "Server Manager"; }
                        else if(PlayerInfo[i][pAdmin] == 1337) { admtext = "Head Administrator"; }
                        else if(PlayerInfo[i][pAdmin] == 4) { admtext = "High Administrator"; }
                        else if(PlayerInfo[i][pAdmin] == 3) { admtext = "Senior Administrator"; }
                        else if(PlayerInfo[i][pAdmin] == 2)    { admtext = "Junior Administrator"; }
                        else if(PlayerInfo[i][pAdmin] == 1) { admtext = "Moderator"; }
                        GetPlayerName(i, sendername, sizeof(sendername));
                        if(AdminDuty[i] == 0)
                        {
                            format(string, 256, "{FF0000}( %s ) {FFFFFF}%s ", admtext, sendername);
                            SendClientMessage(playerid, COLOR_WHITE, string);
                        }
                        else
                        {
                            format(string, 256, "{FF0000}( %s ) {FFFFFF}%s ", admtext, sendername);
                            SendClientMessage(playerid, COLOR_WHITE, string);
                        }
                    }
                }
            }
        }
        return 1;
    }
The if(PlayerInfo[i][pAdmin] != 0) checks if the player is an admin before processing all that code, will also be faster becuase then for non admin players it doesn't have to process all that.
Thanks a lot!! it worked!! thank you both guys!!