help me
#1

Код:
COMMAND:admins(playerid, params[])
{
        if (playerData[playerid][playerScore] >= 1000)
        {
                new count = 1, string[828];
                for(new i = 0; i < MAX_PLAYERS; i++)
                {
                        if(IsPlayerConnected(i) && playerData[i][playerLevel] >= 1 && playerData[i][playerLevel] < 7 && playerData[i][AHide] == 0)
                        {
                                // If admin level is higher than 1, here it goes...
                                format(string, sizeof(string), "%s%s(%i) - Level: %i\n", string, playerData[i][tempAdminName], i, playerData[i][playerLevel]);
                                count ++;
                        }
                }

                if(count != 1)
                {
                        // Show admins that are presently online, along with their rank
                        ShowPlayerDialog(playerid, 200, DIALOG_STYLE_MSGBOX, "Online Administrators", string, "OK", "");
                }
                else
                {
                        // No admins online - Either this or nothing, either way the user will know admins are offline...
                        ShowPlayerDialog(playerid, 200, DIALOG_STYLE_MSGBOX, "Online Admins", "There are no administrators present.", "OK", "");
                }
        }
        else
        {
            SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}You must have at-least 1000 score to view the admin list.");
        }

        return 1;
}
how i can change the level of admin if they are level 1 returning to 'Moderator' ?

example:

admin - level 1,it must be 'admin - moderator'
Reply
#2

Are you looking for something like this?

Код:
if(IsPlayerConnected(i) && playerData[i][playerLevel] >= 1 && playerData[i][playerLevel] < 7 && playerData[i][AHide] == 0)
{
        // If admin level is higher than 1, here it goes...
        if(playerData[i][playerAdminLevel] == 1){ // If playerAdminLevel is equal to 1
        
	        format(string, sizeof(string), "%s%s(%i) - Moderator", string, playerData[i][tempAdminName], i, playerData[i][playerLevel]);
	        
        }else if(playerData[i][playerAdminLevel] == 2){ 
        
	        format(string, sizeof(string), "%s%s(%i) - Higher Level Moderator", string, playerData[i][tempAdminName], i, playerData[i][playerLevel]);
	        
        }else{ // any other levels
        
        	format(string, sizeof(string), "%s%s(%i) - Level: %i\n", string, playerData[i][tempAdminName], i, playerData[i][playerLevel]);
        	
		}
		count ++;
}
Im confused by your use of "playerLevel" if i'm honest. is playerLevel the admin level of the player?
Reply
#3

pawn Код:
COMMAND:admins(playerid, params[])
{
    if (playerData[playerid][playerScore] < 1000) return SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}You must have at-least 1000 score to view the admin list.");

    new string[828];
    for(new i; i < MAX_PLAYERS; i++)//Use foreach or "GetPlayerPoolSize (0.3.7)" instead
    {
        if(IsPlayerConnected(i) && playerData[i][AHide] == 0)
        {
            switch(playerData[i][playerLevel])
            {
                case 1: format(string, sizeof(string), "%s%s(%i) - Moderator\n", string, playerData[i][tempAdminName], i);
                case 2..7: format(string, sizeof(string), "%s%s(%i) - Administrator\n", string, playerData[i][tempAdminName], i);
                default: continue;
            }
        }
    }
    if(strlen(string)) ShowPlayerDialog(playerid, 200, DIALOG_STYLE_MSGBOX, "Online Administrators", string, "OK", "");
    else ShowPlayerDialog(playerid, 200, DIALOG_STYLE_MSGBOX, "Online Admins", "There are no administrators present.", "OK", "");

    return 1;
}
There are better ways, but this should do the job.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)