24.06.2015, 15:26
PHP код:
CMD:myname(playerid, params[])
{
if(pInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_RED, "No permission.");
if(isnull(params)) return SendClientMessage(playerid, -1, "Usage: /myname [your name]");
if(strlen(params) >= MAX_PLAYER_NAME) return SendClientMessage(playerid, COLOR_RED, "Too long name.");
strcpy(pInfo[playerid][pAdminName], params, MAX_PLAYER_NAME);
// change the size of "pAdminName" in the enum to MAX_PLAYER_NAME
return 1;
}
CMD:admins(playerid, params[])
{
new string[90];
SendClientMessage(playerid, COLOR_GREY, "Admins online:");
foreach(new i : Player) // your syntax was old and deprecated + it loops though connected players ONLY
{
if(pInfo[i][pAdmin] >= 1)
{
format(string, sizeof(string), "(ID: %d) %s %s (Admin level: %d)", i, PlayerName(i), pInfo[i][pAdminName], pInfo[i][pAdmin]);
SendClientMessage(playerid, pInfo[i][pDuty] ? COLOR_ORANGE : COLOR_GREY, string);
}
}
return 1;
}

