Admin name dialog not showing - 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: Admin name dialog not showing (
/showthread.php?tid=409209)
Admin name dialog not showing -
Noles2197 - 20.01.2013
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 i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pAdmin] < 1) continue;
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", "");
Re: Admin name dialog not showing -
oliverrud - 20.01.2013
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.
Re: Admin name dialog not showing -
Chenko - 20.01.2013
You forgot to put this under if(PlayerInfo[i][pAdmin] < 1)
pawn Код:
GetPlayerName(i, name, sizeof(name));