Advertisement
Guest User

Untitled

a guest
Sep 30th, 2016
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. CMD:setlevel(playerid, params[])
  2. {
  3. if(!IsAuth(playerid, 6) && !IsPlayerAdmin(playerid)) return NoAuth(playerid);
  4. new playerb, level;
  5. if(sscanf(params, "ui", playerb, level)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setlevel [playerid] [level]");
  6. if(!IsPlayerConnected(playerb)) return SendClientMessage(playerid, COLOR_WHITE, "Invalid ID.");
  7. if(level < 0 || level > 7) return SendClientMessage(playerid, COLOR_WHITE, "Admin levels are between 0 to 7.");
  8. if(aInfo[playerb][aLevel] == level) return SendClientMessage(playerid, COLOR_WHITE, "This player already has that Admin level.");
  9. new string[128], query[200];
  10. format(string, sizeof(string), "AdmCmd: %s %s has set %s's Admin Level to %d.", RPARN(playerid), RPN(playerid), RPN(playerb), level);
  11. SendAMessage(1, string);
  12. Log("logs/makeadmin.log", string);
  13. if(!aInfo[playerb][aLevel])
  14. {
  15. mysql_format(mysql, query, sizeof(query), "INSERT INTO `Admins` (`Username`, `ALogin`, `APassword`, `AdminLevel`, `IP`) VALUES ('%e', '0', '', '%d', '%s')", RPN(playerb), level, RPIP(playerb));
  16. mysql_tquery(mysql, query);
  17. format(string, sizeof(string), "Congratulations, You have been promoted to level %d Admin by %s %s.", level, RPARN(playerid), RPN(playerid));
  18. SendClientMessage(playerb, COLOR_RED, string);
  19. SendClientMessage(playerb, COLOR_RED, "Please set your private admin password using /AdmPass, You cannot receieve your powers until then.");
  20. AdminChat[playerid] = 1;
  21. }
  22. aInfo[playerb][aLevel] = level;
  23. aInfo[playerb][aALogin] = 0;
  24. if(!aInfo[playerb][aLevel])
  25. {
  26. mysql_format(mysql, query, sizeof(query), "DELETE FROM `Admins` WHERE `Username`='%e'", RPN(playerid));
  27. mysql_tquery(mysql, query);
  28. format(string, sizeof(string), "You have been removed from the Administration team by %s %s.", RPARN(playerid), RPN(playerid));
  29. SendClientMessage(playerb, COLOR_RED, string);
  30. ClearAdmin(playerid);
  31. }
  32. return 1;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement