Advertisement
Guest User

Untitled

a guest
Sep 6th, 2018
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 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 > 6)
  15. return SCM(playerid, COLOR_GREY, "Invalid admin level. 0-6");
  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. if(adminlevel == 0) {
  27. PlayerInfo[id][pAW] = 0;
  28. UpdateVar(id, "AW", 0);
  29. SpecFaction[id] = 0;
  30. StopFly(playerid);
  31. UsedFly[playerid] = 0;
  32. SetPlayerHealthEx(playerid, 100);
  33.  
  34. Iter_Remove(PlayerAdmins, id);
  35. }
  36.  
  37. Iter_Add(PlayerAdmins, id);
  38.  
  39. finishAchievement(id, 27);
  40. PlayerInfo[id][pAdmin] = adminlevel;
  41.  
  42. new gQuery[180];
  43.  
  44. format(gQuery,sizeof(gQuery),"UPDATE users SET `Admin`='%d' WHERE `ID`='%d'",PlayerInfo[id][pAdmin],PlayerInfo[id][pSQLID]);
  45. mysql_tquery(SQL, gQuery, "", "");
  46.  
  47. return true;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement