Advertisement
Guest User

setadmin

a guest
Jul 13th, 2018
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. YCMD:setadmin(playerid, params[], help) {
  2.  
  3. new id, adminlevel, gString[120];
  4.  
  5. if(PlayerInfo[playerid][pAdmin] < 6)
  6. return SCM(playerid, COLOR_WHITE, AdminOnly);
  7.  
  8. if(sscanf(params, "ui", id, adminlevel))
  9. return SCM(playerid, COLOR_GREY, "USAGE: {FFFFFF}/setadmin <playerid/name> <Admin Level>");
  10.  
  11. if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID)
  12. return SCM(playerid, COLOR_GREY, "Acel player nu este conectat.");
  13.  
  14. if(adminlevel < 0 || adminlevel > 8)
  15. return SCM(playerid, COLOR_GREY, "Nu poti seta nivelul administratorului mai mic de 0 sau mai mare de 8.");
  16.  
  17. if(PlayerInfo[id][pAdmin] > PlayerInfo[playerid][pAdmin])
  18. return SCM(playerid, COLOR_GREY, "Nu poti folosi aceasta comanda pe acel player. Are admin level mai mare.");
  19.  
  20. format(gString, 80, "Ai fost promovat la admin %d de %s", adminlevel, GetName(playerid));
  21. SCM(id, COLOR_LIGHTBLUE, gString);
  22.  
  23. format(gString, 100, "AdmCmd: %s i-a setat lui %s admin level %d.", GetName(playerid), GetName(id), adminlevel);
  24. SendAdminHelperMessage(COLOR_LOGS, gString);
  25.  
  26.  
  27. if(adminlevel == 0) {
  28. PlayerInfo[id][pAW] = 0;
  29. UpdateVar(id, "AW", 0);
  30. SpecFaction[id] = 0;
  31. StopFly(playerid);
  32. UsedFly[playerid] = 0;
  33. SetPlayerHealthEx(playerid, 100);
  34.  
  35. Iter_Remove(PlayerAdmins, id);
  36. }
  37.  
  38. Iter_Add(PlayerAdmins, id);
  39.  
  40. finishAchievement(id, 27);
  41. PlayerInfo[id][pAdmin] = adminlevel;
  42.  
  43. new gQuery[180];
  44.  
  45. format(gQuery, sizeof(gQuery), "INSERT INTO `staff_logs` ('player', 'Text') VALUES ('%d','%d')");
  46. mysql_tquery(SQL, gQuery, "", "");
  47.  
  48. if(adminlevel >= 1)
  49. format(gQuery, sizeof(gQuery), "UPDATE users SET `Admin`='%d', `Security`='%s', `HelpedPlayers`='0' WHERE `ID`='%d'", PlayerInfo[id][pAdmin]/*, MD5_Hash(DEFAULT_PASSWORD)*/, PlayerInfo[id][pSQLID]);
  50. else
  51. UpdateVar(id, "Admin", PlayerInfo[id][pAdmin]);
  52. mysql_tquery(SQL, gQuery, "", "");
  53. SetPVarInt(id, "SecurityPlayer", 0);
  54.  
  55. return true;
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement