/admins Command Help -
Filbert - 27.05.2016
When I edit my CMD:admins like this >
PHP Code:
CMD:admins(playerid,params[])
{
new string[128];
new n[MAX_PLAYER_NAME];
SendClientMessage(playerid,COLOR_GREEN,"___________|- Online Admins -|___________");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(PlayerInfo[i][Level] == 1)
{
GetPlayerName(i,Name,sizeof(Name));
format(string, 128, "Trial Moderator - %s[ID: %d]",n,i);
SendClientMessage(playerid, COLOR_GREEN1, string);
}
if(PlayerInfo[i][Level] == 2)
{
GetPlayerName(i,Name,sizeof(Name));
format(string, 128, "Moderator - %s[ID: %d]", Name, i);
SendClientMessage(playerid, COLOR_FORESTGREEN, string);
}
if(PlayerInfo[i][Level] == 3)
{
GetPlayerName(i,Name,sizeof(Name));
format(string, 128, "Guard - %s[ID: %d]", Name, i);
SendClientMessage(playerid, yellow, string);
}
if(PlayerInfo[i][Level] == 4)
{
GetPlayerName(i,Name,sizeof(Name));
format(string, 128, "Officer - %s[ID: %d]", Name, i);
SendClientMessage(playerid, COLOR_BLACK, string);
}
if(PlayerInfo[i][Level] == 5)
{
GetPlayerName(i,Name,sizeof(Name));
format(string, 128, "Captain - %s[ID: %d]", Name, i);
SendClientMessage(playerid, blue, string);
}
if(PlayerInfo[i][Level] == 6)
{
GetPlayerName(i,Name,sizeof(Name));
format(string, 128, "Elite Admin - %s[ID: %d]", Name, i);
SendClientMessage(playerid, grey, string);
}
if(PlayerInfo[i][Level] == 7)
{
GetPlayerName(i,Name,sizeof(Name));
format(string, 128, "General - %s[ID: %d]", Name, i);
SendClientMessage(playerid, red, string);
}
if(PlayerInfo[i][Level] == 8)
{
GetPlayerName(i,Name,sizeof(Name));
format(string, 128, "Director - %s[ID: %d]", Name, i);
SendClientMessage(playerid, COLOR_ROYALBLUE, string);
}
}
return 1;
}
PHP Code:
It's Error and send me this errormessage >
D:\Data\Filbert\SA-MP Server\BDR Server\Gamemodes\BBTDM~RP.pwn(31137) : warning 217: loose indentation
D:\Data\Filbert\SA-MP Server\BDR Server\Gamemodes\BBTDM~RP.pwn(31142) : error 035: argument type mismatch (argument 2)
D:\Data\Filbert\SA-MP Server\BDR Server\Gamemodes\BBTDM~RP.pwn(31142) : error 039: constant symbol has no size
D:\Data\Filbert\SA-MP Server\BDR Server\Gamemodes\BBTDM~RP.pwn(31148) : error 035: argument type mismatch (argument 2)
D:\Data\Filbert\SA-MP Server\BDR Server\Gamemodes\BBTDM~RP.pwn(31148) : error 039: constant symbol has no size
D:\Data\Filbert\SA-MP Server\BDR Server\Gamemodes\BBTDM~RP.pwn(31149) : warning 213: tag mismatch
D:\Data\Filbert\SA-MP Server\BDR Server\Gamemodes\BBTDM~RP.pwn(31154) : error 035: argument type mismatch (argument 2)
D:\Data\Filbert\SA-MP Server\BDR Server\Gamemodes\BBTDM~RP.pwn(31154) : error 039: constant symbol has no size
D:\Data\Filbert\SA-MP Server\BDR Server\Gamemodes\BBTDM~RP.pwn(31155) : warning 213: tag mismatch
D:\Data\Filbert\SA-MP Server\BDR Server\Gamemodes\BBTDM~RP.pwn(31160) : error 035: argument type mismatch (argument 2)
D:\Data\Filbert\SA-MP Server\BDR Server\Gamemodes\BBTDM~RP.pwn(31160) : error 039: constant symbol has no size
D:\Data\Filbert\SA-MP Server\BDR Server\Gamemodes\BBTDM~RP.pwn(31161) : warning 213: tag mismatch
D:\Data\Filbert\SA-MP Server\BDR Server\Gamemodes\BBTDM~RP.pwn(31166) : error 035: argument type mismatch (argument 2)
D:\Data\Filbert\SA-MP Server\BDR Server\Gamemodes\BBTDM~RP.pwn(31166) : error 039: constant symbol has no size
D:\Data\Filbert\SA-MP Server\BDR Server\Gamemodes\BBTDM~RP.pwn(31167) : warning 213: tag mismatch
D:\Data\Filbert\SA-MP Server\BDR Server\Gamemodes\BBTDM~RP.pwn(31172) : error 035: argument type mismatch (argument 2)
D:\Data\Filbert\SA-MP Server\BDR Server\Gamemodes\BBTDM~RP.pwn(31172) : error 039: constant symbol has no size
D:\Data\Filbert\SA-MP Server\BDR Server\Gamemodes\BBTDM~RP.pwn(31173) : warning 213: tag mismatch
D:\Data\Filbert\SA-MP Server\BDR Server\Gamemodes\BBTDM~RP.pwn(31178) : error 035: argument type mismatch (argument 2)
D:\Data\Filbert\SA-MP Server\BDR Server\Gamemodes\BBTDM~RP.pwn(31178) : error 039: constant symbol has no size
D:\Data\Filbert\SA-MP Server\BDR Server\Gamemodes\BBTDM~RP.pwn(31179) : warning 213: tag mismatch
D:\Data\Filbert\SA-MP Server\BDR Server\Gamemodes\BBTDM~RP.pwn(31184) : error 035: argument type mismatch (argument 2)
D:\Data\Filbert\SA-MP Server\BDR Server\Gamemodes\BBTDM~RP.pwn(31184) : error 039: constant symbol has no size
D:\Data\Filbert\SA-MP Server\BDR Server\Gamemodes\BBTDM~RP.pwn(31185) : warning 213: tag mismatch
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
16 Errors.
Pls Help Me Who Know My Problem Solution...
Thanks For Reading And Waiting For Reply
God Bless You All
Re: /admins Command Help -
Konstantinos - 27.05.2016
You didn't mention from which lines those errors/warnings come from though. I'll assume that something is wrong with "Name" even though is not used and you declared "n" for the player's name which you used in the format too.
Assuming that all colors are integers too, using constant arrays find it a better way myself:
PHP Code:
CMD:admins(playerid, params[])
{
static const
p_R[][] = {"Trial Moderator", "Moderator", "Guard", "Officer", "Captain", "Elite Admin", "General", "Director"},
p_C[] = {COLOR_GREEN1, COLOR_FORESTGREEN, yellow, COLOR_BLACK, blue, grey, red, COLOR_ROYALBLUE};
new
string[50],
n[MAX_PLAYER_NAME];
SendClientMessage(playerid,COLOR_GREEN,"___________|- Online Admins -|___________");
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++) // foreach(new i : Player)
{
if (!IsPlayerConnected(i)) continue;
if(1 <= PlayerInfo[i][Level] <= 8)
{
GetPlayerName(i, n, sizeof(n));
format(string, sizeof string, "%s - %s[ID: %d]", p_R[PlayerInfo[i][Level] - 1], n, i);
SendClientMessage(playerid, p_C[PlayerInfo[i][Level] - 1], string);
}
}
return 1;
}
foreach is also recommended but if you don't want to use it, atleast use GetPlayerPoolSize. Resetting variables on disconnect will also be better so we won't have to check if the player is connected.