Quote:
Originally Posted by PepsiCola23
its like you store level ( PlayerData[playerid][level] , you make a new variable for admin ( [playerid][admin], and at the admins commands check if his [admin] level is big enough.
|
Exactly what this guy said above, you need to store the player enumerator.
PHP код:
enum AdminLevel
{
Level
}
new PlayerInfo[MAX_PLAYERS][AdminLevel];
So once we did a enum for the player, it's now going to be like PlayerInfo[playerid][Level], now let's come to the commands (i will use ZCMD because it's faster, simple and pretty much viable compared to strcmp).
PHP код:
CMD:sethp(playerid, params[])
{
if(PlayerInfo[playerid][Level] < 1) return SendClientMessage(playerid, -1, "{C3C3C3}(INFO) You don't have the priviliges to use this command.");
{
new amount, str[128], target;
if(sscanf(params, "ui", target, amount)) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) /sethp [id] [amount]");
format(str, sizeof(str), "{EFB509}(INFO) An admin has set your health to %d", amount);
SendClientMessage(target, -1, str);
SetPlayerHealth(target, amount);
return 1;
}
That's a simple Admin Command, with this
PHP код:
if(PlayerInfo[playerid][Level] < 1)
you check if the player has enough admin level to run the command.
PS: you should just starting learning about player enumerations, you are like stuck on a simple code