Admin name dialog not showing
#1

When you view the dialog, it shows the admin rank and if they're on duty or not, but it doesn't show their name and leaves a blank space there. Can someone help me fix this issue?

PHP код:
            case 2:
            {
                new 
name[MAX_PLAYER_NAME],string[250],admin[20],duty[20];
                new 
count 0;
                for(new 
0MAX_PLAYERSi++)
                {
                    if(
IsPlayerConnected(i))
                    {
                        if(
PlayerInfo[i][pAdmin] < 1) continue;
                        switch(
PlayerInfo[i][pAdmin])
                        {
                            case 
1admin "Moderator";
                            case 
2admin "Administrator";
                            case 
3admin "Head Administrator";
                        }
                        if(
PlayerInfo[i][pDuty] == 0)
                        {
                            
duty "{FF0000}Off duty.";
                        }
                        else if(
PlayerInfo[i][pDuty] == 1)
                        {
                            
duty "{007F0E}On duty!";
                        }
                        if(
count == 0)
                        {
                            
format(string,sizeof(string),"{FF7FB6}%s {A9C4E4}%s is %s\n",admin,name,duty);
                        } 
// Not showing the player's name
                        
else
                        {
                            
format(string,sizeof(string),"%s{FF7FB6}%s {A9C4E4}%s is %s\n",string,admin,name,duty);
                        }
                        
count++;
                    }
                    if(
count == 0)
                    {
                        
format(string,sizeof(string),"There's no members of the staff team online.");
                    }
                }
                
ShowPlayerDialog(playerid,6,DIALOG_STYLE_MSGBOX,"Staff Team"string"Close"""); 
Reply
#2

pawn Код:
case 2:
            {
                new name[MAX_PLAYER_NAME],string[250],admin[20],duty[20];
                new count = 0;
                for(new i = 0; i < MAX_PLAYERS; i++)
                {
                    if(IsPlayerConnected(i))
                    {
                        if(PlayerInfo[i][pAdmin] < 1) continue;
                        GetPlayerName(i,name,MAX_PLAYER_NAME);
                        switch(PlayerInfo[i][pAdmin])
                        {
                            case 1: admin = "Moderator";
                            case 2: admin = "Administrator";
                            case 3: admin = "Head Administrator";
                        }
                        if(PlayerInfo[i][pDuty] == 0)
                        {
                            duty = "{FF0000}Off duty.";
                        }
                        else if(PlayerInfo[i][pDuty] == 1)
                        {
                            duty = "{007F0E}On duty!";
                        }
                        if(count == 0)
                        {
                            format(string,sizeof(string),"{FF7FB6}%s {A9C4E4}%s is %s\n",admin,name,duty);
                        } // Not showing the player's name
                        else
                        {
                            format(string,sizeof(string),"%s{FF7FB6}%s {A9C4E4}%s is %s\n",string,admin,name,duty);
                        }
                        count++;
                    }
                    if(count == 0)
                    {
                        format(string,sizeof(string),"There's no members of the staff team online.");
                    }
                }
                ShowPlayerDialog(playerid,6,DIALOG_STYLE_MSGBOX,"Staff Team", string, "Close", "");
Try this.

Edit: Ah yeah my bad, forgot, GetPlayerName should be with i instead of playerid, changed the code above to work correctly, user below me pointed it out.
Reply
#3

You forgot to put this under if(PlayerInfo[i][pAdmin] < 1)

pawn Код:
GetPlayerName(i, name, sizeof(name));
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)