zcmd /admins command
#1

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

Код:
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);
PHP код:
stock pname(playerid){
    new 
PNameX[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,PNameX,sizeof(PNameX));
    return 
PNameX;

Reply
#3

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


Forum Jump:


Users browsing this thread: 1 Guest(s)