03.02.2016, 19:46
PHP Code:
if(adlvl[i] >= 6 && UndercoverAdmin[i] == 0)
PHP Code:
CMD:admins(playerid, params[])
{
new playername[MAX_PLAYER_NAME];
if(GetPlayerScore(playerid) < 50) return SendClientMessage(playerid, COLOR_RED, "You need 50 score to see online administrators");
new count = 0, string[128], AdmRank[128];
new ChangeColor;
SendClientMessage(playerid, COLOR_GREEN, " ");
SendClientMessage(playerid, COLOR_GREEN, "___________ |- Online Admins -| ___________");
SendClientMessage(playerid, COLOR_GREEN, " ");
for(new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerConnected(i))
{
if(UndercoverAdmin[i] == 0)
{
if (adlvl[i] >= 1)
{
GetPlayerName(i, playername, MAX_PLAYER_NAME);
if(adlvl[i] >= 6)
{
AdmRank = "Server Owner/Developer";
ChangeColor = COL_LEVEL4;
}
else
{
switch(adlvl[i])
{
case 1: {
AdmRank = "Moderator";
ChangeColor = COL_LEVEL1;
}
case 2: {
AdmRank = "Senior Moderator";
ChangeColor = COL_LEVEL2;
}
case 3: {
AdmRank = "Administrator";
ChangeColor = COL_LEVEL3;
}
case 4: {
AdmRank = "Lead Administrator";
ChangeColor = COL_LEVEL4;
}
case 5: {
AdmRank = "Lead Administrator";
ChangeColor = COL_LEVEL4;
}
}
}
}
format(string, 128, "%s | %s", playername, AdmRank);
SendClientMessage(playerid, ChangeColor, string);
count ++;
}
}
}
if(count == 0)
SendClientMessage(playerid, ADMINSONLINE, "There are currently no administrators online.");
return 1;
}
Edit 2: Also make sure to change the ChangeColor variable to a local variable. As a global variable, it will change per individual, meaning the last admin who gets counted will be the deciding factor of the colour displayed. What you need to do is basically this;
PHP Code:
new ChangeColor[MAX_PLAYERS];
PHP Code:
new ChangeColor;
PHP Code:
ChangeColor(i)