Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CMD:setlevel(playerid, params[])
- {
- if(!IsAuth(playerid, 6) && !IsPlayerAdmin(playerid)) return NoAuth(playerid);
- new playerb, level;
- if(sscanf(params, "ui", playerb, level)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setlevel [playerid] [level]");
- if(!IsPlayerConnected(playerb)) return SendClientMessage(playerid, COLOR_WHITE, "Invalid ID.");
- if(level < 0 || level > 7) return SendClientMessage(playerid, COLOR_WHITE, "Admin levels are between 0 to 7.");
- if(aInfo[playerb][aLevel] == level) return SendClientMessage(playerid, COLOR_WHITE, "This player already has that Admin level.");
- new string[128], query[200];
- format(string, sizeof(string), "AdmCmd: %s %s has set %s's Admin Level to %d.", RPARN(playerid), RPN(playerid), RPN(playerb), level);
- SendAMessage(1, string);
- Log("logs/makeadmin.log", string);
- if(!aInfo[playerb][aLevel])
- {
- mysql_format(mysql, query, sizeof(query), "INSERT INTO `Admins` (`Username`, `ALogin`, `APassword`, `AdminLevel`, `IP`) VALUES ('%e', '0', '', '%d', '%s')", RPN(playerb), level, RPIP(playerb));
- mysql_tquery(mysql, query);
- format(string, sizeof(string), "Congratulations, You have been promoted to level %d Admin by %s %s.", level, RPARN(playerid), RPN(playerid));
- SendClientMessage(playerb, COLOR_RED, string);
- SendClientMessage(playerb, COLOR_RED, "Please set your private admin password using /AdmPass, You cannot receieve your powers until then.");
- AdminChat[playerid] = 1;
- }
- aInfo[playerb][aLevel] = level;
- aInfo[playerb][aALogin] = 0;
- if(!aInfo[playerb][aLevel])
- {
- mysql_format(mysql, query, sizeof(query), "DELETE FROM `Admins` WHERE `Username`='%e'", RPN(playerid));
- mysql_tquery(mysql, query);
- format(string, sizeof(string), "You have been removed from the Administration team by %s %s.", RPARN(playerid), RPN(playerid));
- SendClientMessage(playerb, COLOR_RED, string);
- ClearAdmin(playerid);
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement