staff command is wrongfully coded, shows only 1 admin instead of more...
#1

hello once again,

recently i've decided to make my own staff command to see how it would go, and it didn't, obviously. even if it doesn't show any errors and successfully compiles, as the title says, it shows 1 player instead of 2+ and when i set myself to 0 level, it still shows me on the dialog...

here's the wrongfully coded command:

Code:
CMD:staff(playerid, params[])
{
	#pragma unused params
	if(PlayerInfo[playerid][LoggedIn] == true)
	{
	    new string[192];
	    new admrank[32];
	    new count;
	    new pname[MAX_PLAYER_NAME];
        for(new i; i<MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
			{
				if(IsPlayerAdmin(i))
				{
       				 admrank = "{FF0000}RCON Admin";
				}
				else
				{
    				switch(PlayerInfo[i][AdminLevel])
					{
				        case 1: admrank = "{FFFF00}Moderator";
				        case 2: admrank = "{008000}Administrator";
				        case 3: admrank = "{3366FF}Manager";
				    }
				    GetPlayerName(i, pname, sizeof(pname));
				    format(string, sizeof(string), "{FFFFFF}%s (ID: %d) | Level: %d | Rank: %s", pname, i, PlayerInfo[i][AdminLevel], admrank);
				    ++count;
				}
			}
		}
		if(!count)
		format(string, sizeof(string), "{FF0000}There are currently no staff online.");
		ShowPlayerDialog(playerid, DIALOGID0+2, DIALOG_STYLE_MSGBOX, "{FFFFFF}Server staff currently online:", string, "Okay", "");
		return 1;
	} else return SendClientMessage(playerid, COLOR_RED, "ERROR: Account must be registered in order to use commands.");
}
cheers
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)