PDA

View Full Version : zcmd /admins command


HellixBG
15/07/2017, 11:53 AM
Hello guys. I have problem with /admins command. When a player type /admins it shows all admins right but if my level is 6 on the dialog everybody is showed with 6 help me please
Here is the command:
CMD:admins(playerid,params[])
{
new admins[1024], str[64], count;
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
{
if (!IsPlayerConnected(i))continue;
if (!PlayerInfo[i][pAdmin])continue;
new admin[64];
if(PlayerInfo[i][pAdmin] == 1) { admin = "ADMIN Level[ 1 ]"; }
else if(PlayerInfo[i][pAdmin] == 2) { admin = "ADMIN Level[ 2 ]"; }
else if(PlayerInfo[i][pAdmin] == 3) { admin = "ADMIN Level[ 3 ]"; }
else if(PlayerInfo[i][pAdmin] == 4) { admin = "ADMIN Level[ 4 ]"; }
else if(PlayerInfo[i][pAdmin] == 5) { admin = "HEAD ADMIN";}
GetPlayerName(i, str, 24);
format(str, sizeof(str), "{FFFFFF}Admin Level [ %i ] {FF0000}%s [ID:%d]\r\n", PlayerInfo[playerid][pAdmin], str, i);
strcat(admins, str);
count++;
}
if(!count)return SendClientMessage(playerid,-1,"{FF0000}Няма Онлайн Администратор!");
ShowPlayerDialog(playerid, 21323123, DIALOG_STYLE_MSGBOX, "{00FF00}Онлайн админи", admins, "OK", "");
return 1;
}

DarkBr
15/07/2017, 01:37 PM
switch(PlayerInfo[i][pAdmin])
{
case 1:AdminL = "Admin Level [1]"
case 2:AdminL = "Admin Level [2]"
case 3:AdminL = "Admin Level [3]"
case 4:AdminL = "Admin Level [4]"
}


format(String, 60, "Admin Level %s | %s [ID%d] |\n\r", AdminL, pname(i), i);

stock pname(playerid){
new PNameX[MAX_PLAYER_NAME];
GetPlayerName(playerid,PNameX,sizeof(PNameX));
return PNameX;
}

FailerZ
15/07/2017, 02:05 PM
You are printing the admin variable to the one who used the command instead of detected admins.
Try the following, I have colored the change with red

CMD:admins(playerid,params[])
{
new admins[1024], str[64], count;
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
{
if (!IsPlayerConnected(i))continue;
if (!PlayerInfo[i][pAdmin])continue;
new admin[64];
if(PlayerInfo[i][pAdmin] == 1) { admin = "ADMIN Level[ 1 ]"; }
else if(PlayerInfo[i][pAdmin] == 2) { admin = "ADMIN Level[ 2 ]"; }
else if(PlayerInfo[i][pAdmin] == 3) { admin = "ADMIN Level[ 3 ]"; }
else if(PlayerInfo[i][pAdmin] == 4) { admin = "ADMIN Level[ 4 ]"; }
else if(PlayerInfo[i][pAdmin] == 5) { admin = "HEAD ADMIN";}
GetPlayerName(i, str, 24);
format(str, sizeof(str), "{FFFFFF}Admin Level [ %i ] {FF0000}%s [ID:%d]\r\n", PlayerInfo[i][pAdmin], str, i);
strcat(admins, str);
count++;
}
if(!count)return SendClientMessage(playerid,-1,"{FF0000}Няма Онлайн Администратор!");
ShowPlayerDialog(playerid, 21323123, DIALOG_STYLE_MSGBOX, "{00FF00}Онлайн админи", admins, "OK", "");
return 1;
}