Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.97 KB | None | 0 0
  1. CMD:makeadmin(playerid, params[])
  2. {
  3. if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
  4. if(IsPlayerConnected(playerid))
  5. {
  6. if (PlayerInfo[playerid][pAdmin] == 6 || EstiFondator(playerid))
  7.  
  8. {
  9. new id,adminlevel,sendername[30],giveplayer[30],string[200],escape[200];
  10. if(sscanf(params, "ui",id,adminlevel)) return SendClientMessage(playerid, COLOR_WHITE, "Scrie: /makeadmin <Name/Playerid> <Admin Level>");
  11. if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_RED, "Nu esti autorizat sa folosesti comanda.");
  12. if(PlayerInfo[id][pAdmin] >= 6 && !EstiFondator(playerid)) return SendClientMessage(playerid, COLOR_WHITE, "Nu poti modifica admin level-ul unui admin 6+!.");
  13. if(adminlevel > 4 && !EstiFondator(playerid)) return SendClientMessage(playerid, COLOR_WHITE, "Only founders can make admin higher than 4.");
  14. if(IsPlayerConnected(id))
  15. {
  16. if(id != INVALID_PLAYER_ID)
  17. {
  18. GetPlayerName(id, giveplayer, sizeof(giveplayer));
  19. GetPlayerName(playerid, sendername, sizeof(sendername));
  20. printf("({FF6347}AdminStaff{FFFFFF}) %s has promoted %s to a level %d admin.", sendername, giveplayer, adminlevel);
  21. format(string, sizeof(string), "You've been promoted to level %d admin, by %s.", adminlevel, sendername);
  22. SendClientMessage(id, COLOR_WHITE, string);
  23. format(string, sizeof(string), "You have promoted %s to a level %d admin.", giveplayer,adminlevel);
  24. SendClientMessage(playerid, COLOR_YELLOW, string);
  25. format(string, sizeof(string), "* Admin %s set %s's admin level to %d.", sendername,giveplayer,adminlevel);
  26. ABroadCast(COLOR_ADMCHAT,string,1);
  27. HLChat(COLOR_ADMCHAT,string);
  28. mysql_real_escape_string(string, escape);
  29. PlayerInfo[id][pAdmin] = adminlevel;
  30. if(adminlevel == 0)
  31. {
  32. AdminDuty[id] = 0;
  33. }
  34. new str[256];
  35. mysql_format(SQL,str,sizeof(str),"UPDATE users SET `Admin`='%d' WHERE `name`='%s'",PlayerInfo[id]
  36. [pAdmin],PlayerInfo[id][pNormalName]);
  37. mysql_tquery(SQL,str,"","");
  38. mysql_format(SQL,str, sizeof(str), "INSERT INTO staff_logs (`text`) VALUES ('%s')", escape);
  39. mysql_tquery(SQL,str,"","");
  40. }
  41. }
  42. else
  43. {
  44. SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}Error: Player not connected.");
  45. }
  46. }
  47. else
  48. {
  49. SendClientMessage(playerid, COLOR_LIGHTGREEN3, "You need admin 6+ to use this.");
  50. }
  51. }
  52. return 1;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement