05.03.2017, 19:52
Before you go, let me explain you in comments what was bad, so you learn something instead of just copy-pasting:
Everything else was 'ok'. Please keep learning and reading, do not copy-paste!
PHP код:
CMD:achat(playerid, params[])
{
new string[128],msg[128],id,name[MAX_PLAYER_NAME]; // Variable id here is useless, why did you make it? You already have playerid.
if(pInfo[playerid][Adminlevel] >=1 || IsPlayerAdmin(playerid)) // 'IsPlayerAdmin' You were checking here if the player was RCON admin, I highly doubt you provide the server's RCON password to every admin your server have.
{
if(sscanf(params, "s[128]",msg)) return SCM(playerid,-1,""grey"[SYSTEM]:"red"/achat [Message]");
GetPlayerName(id,name,sizeof(name)); // again, id did not mean anything here, so we changed it for playerid.
format(string,sizeof(string),"[Admins]: %s: %s",pInfo[id][Adminlevel],name,msg); // yor format had two strings but you were trying to add a third one, we removed pInfo[id][Adminlevel] from here as it was not doing anything.
foreach(Player, i)
{
if(pInfo[playerid][Adminlevel] >= 1) // this is inside a loop, the reason you want to loop is to check on every player, hence we changed here player id for 'i'
{
SCM(playerid, -1,string); // same 'i' here
}
}
}
else
{
SCM(playerid, -1, ""red"{FF0000}[SYSTEM]: This command available for administrator only.");
}
return 1;
}