/admins command
#1

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;
    } 
Reply
#2

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
Reply
#3

Ehm... it gives me an error when i remove it..
Reply
#4

Np
Reply
#5

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

Post It Here.
Reply
#7

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.
Reply
#8

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!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)