if (strcmp(cmd, "/admins", true) == 0)
{
new string[256];
new player[250];
SendClientMessage(playerid, COLOR_FINALSCORE, "|---------------Online Admins---------------|");
new count=0;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(PlayerInfo[playerid][pAdmin] >= 1 && PlayerInfo[playerid][pAdmin] <= 6)
{
GetPlayerName(i, player, sizeof(player));
format(string, 256, "Administrators: %s(%d)-%d",player, i, PlayerInfo[playerid][pAdmin]);
SendClientMessage(playerid, COLOR_CYAN, string);
count++;
}
}
}
if(count == 0)
{
SendClientMessage(playerid, COLOR_CYAN, "No admin online at the moment.");
}
SendClientMessage(playerid, COLOR_FINALSCORE, "|--------------------------------------------------|");
return 1;
}
warning 219: local variable "i" shadows a variable at a preceding level
for(new i = 0; i < MAX_PLAYERS; i++)
for(new i = 0; i < MAX_PLAYERS; i++)
Originally Posted by LyQue
Oh thanks © Tђэ LυxυяiσN™ !! Now I don't have warnings...
Only when I do /admins Still shows as no admin online, what to do please help!? ![]() |
if (strcmp(cmd, "/admins", true) == 0)
{
new string[256];
new player[250];
SendClientMessage(playerid, COLOR_FINALSCORE, "|---------------Online Admins---------------|");
new count;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pAdmin] >= 1 && PlayerInfo[i][pAdmin] <= 6)
{
GetPlayerName(i, player, sizeof(player));
format(string, 256, "Administrators: %s(%d)-%d",player, i, PlayerInfo[playerid][pAdmin]);
SendClientMessage(playerid, COLOR_CYAN, string);
count++;
}
}
}
if(count == 0)
{
SendClientMessage(playerid, COLOR_CYAN, "No admin online at the moment.");
}
SendClientMessage(playerid, COLOR_FINALSCORE, "|--------------------------------------------------|");
return 1;
}
Originally Posted by LyQue
Thanks for the replies, but I still get "No admin online at the moment"... :'(
Anybody know what's the problem? It's simply not counting admins... :'( |
dcmd_admins(playerid, params[])
{
if(strlen(params)) return SendClientMessage(playerid, COLOR_RED, "Use /admins");
new count = 0;
new string[128];
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(IsPlayerConnected(i))
{
new player[24];
GetPlayerName(i, player, 24);
if(PlayerInfo[playerid][pAdmin] >= 1 && PlayerInfo[playerid][pAdmin] <= 6)
{
format(string, sizeof(string), "Present Admins: %s(%i)-%i ",player,i,PlayerInfo[playerid][pAdmin]);
SendClientMessage(playerid, COLOR_CYAN, string);
count++;
}
}
}
if(count == 0)
{
SendClientMessage(playerid, COLOR_CYAN, "No admins online at the moment");
}
return 1;
}