[HELP]ZCMD, I guess. -
Dirkon - 07.12.2011
Here's my CMD, it works but every time returns "unknown command".
pawn Код:
COMMAND:admins(playerid)
{
new string[64];
new name[MAX_PLAYER_NAME];
for(new i; i < MAX_PLAYERS+1; i++)
{
if(PlayerInfo[i][isAdmin] == 1)
{
GetPlayerName(i, name, sizeof(name));
format(string, sizeof(string), "%d LVL ADMIN: %s", PlayerInfo[i][AdminLvl], name);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
}
return 1;
}
I mean, when I write CMD In-Game it shows like this:
pawn Код:
4 LVL ADMIN: Nickname
5 LVL ADMIN: nickname
SERVER: Unknown command
Re: [HELP]ZCMD, I guess. -
MdeRooy - 07.12.2011
Try this
pawn Код:
COMMAND:admins(playerid)
{
new string[64];
new name[MAX_PLAYER_NAME];
for(new i; i < MAX_PLAYERS+1; i++)
{
if(PlayerInfo[i][isAdmin] == 1)
{
GetPlayerName(i, name, sizeof(name));
format(string, sizeof(string), "%d LVL ADMIN: %s", PlayerInfo[i][AdminLvl], name);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
}
<---- Insert 1 row here
return 1;
}
Re: [HELP]ZCMD, I guess. -
Dirkon - 07.12.2011
Still, the same.
Re: [HELP]ZCMD, I guess. -
AstonDA-G - 07.12.2011
Don't you need params?
Код:
COMMAND:admins(playerid, params[])
{
new string[64];
new name[MAX_PLAYER_NAME];
for(new i; i < MAX_PLAYERS+1; i++)
{
if(PlayerInfo[i][isAdmin] == 1)
{
GetPlayerName(i, name, sizeof(name));
format(string, sizeof(string), "%d LVL ADMIN: %s", PlayerInfo[i][AdminLvl], name);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
}
<---- Insert 1 row here
return 1;
}
If you get a warning about "symbol is never used - params", put #pragma unused params somewhere above the loop.
Hope this helps
Re: [HELP]ZCMD, I guess. -
Dirkon - 07.12.2011
nah, still the same. Everything works fine with commands without loops. And the ones with the loops gives "unknown command"
Re: [HELP]ZCMD, I guess. -
AstonDA-G - 07.12.2011
Hmm, not sure if it'll make a difference, but why the MAX_PLAYERS+1;?
Try
pawn Код:
for(new i; i < MAX_PLAYERS; i++)
Re: [HELP]ZCMD, I guess. -
[Diablo] - 07.12.2011
have you tried using your for loop without
+1?
pawn Код:
for(new i; i < MAX_PLAYERS; i++)
{
// code here
}
Re: [HELP]ZCMD, I guess. -
xMichaelx - 07.12.2011
pawn Код:
COMMAND:admins(playerid, params[])
{
new string[64];
new name[MAX_PLAYER_NAME];
for(new i; i < MAX_PLAYERS+1; i++)
{
if(PlayerInfo[i][isAdmin] == 1)
{
GetPlayerName(i, name, sizeof(name));
format(string, sizeof(string), "%d LVL ADMIN: %s", PlayerInfo[i][AdminLvl], name);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
<----------- insert else return SendClientMessage(playerid,COLOR,"You are not an admin");
}
return 1;
}