24.06.2013, 06:29
how do i do /makeadmin command for rcon and the command use zcmd ?
CMD:makeadmin(playerid, params[])
{
//a check to make sure they're the level you want
if(!IsPlayerAdmin(playerid) && AdminLevel[playerid] < 3) return SendClientMessage(playerid, 0xCC0000AA, "You aren't the required level!");
//variables we need to do this
new target, level;
//r = player name or id, i = integer
if(sscanf(params, "ri", target, level)) return SendClientMessage(playerid, 0xCC0000AA, "USAGE: /makeadmin [player] [level]");
//check to make sure they aren't setting a higher level admins level
if(AdminLevel[target] >= AdminLevel[playerid]) return SendClientMessage(playerid, 0xCC0000AA, "That player is a higher level admin or the same level admin as you!");
//a string array so we can format the message with variables along with an array to store the players name in
new string[128], name[MAX_PLAYER_NAME];
//Here we set the players level
AdminLevel[target] = level;
//get the name of the admin, format the string, then send the string here
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s has set your level to %i", name, level);
SendClientMessage(target, 0x00CCCCAA, string);
//same as above but this time for the admin that set the players level
GetPlayerName(target, name, sizeof(name));
format(string, sizeof(string), "You set the admin level of %s to %i", name, level);
SendClientMessage(playerid, 0x00CCCCAA, string);
return 1;
}
new AdminLevel[MAX_PLAYERS];
#undef MAX_PLAYERS
#define MAX_PLAYERS (SomeNumber)