Advertisement
Guest User

Untitled

a guest
Jul 31st, 2018
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. CMD:setadmin(playerid, params[])
  2. {
  3. if(IsPlayerConnected(playerid))
  4. {
  5. if(PlayerInfo[playerid][pAdmin] >= 6)
  6. {
  7. new id,adminlevel,sendername[30],giveplayer[30],string[200];
  8. if(sscanf(params, "ui",id,adminlevel)) return SendClientMessage(playerid, 0xFFFFFFFF, "{AB0000}Syntax: {FFFFFF}/setadmin <Name/Playerid> <Admin Level>");
  9. if(IsPlayerConnected(id))
  10. {
  11. if(id != INVALID_PLAYER_ID)
  12. {
  13. GetPlayerName(id, giveplayer, sizeof(giveplayer));
  14. GetPlayerName(playerid, sendername, sizeof(sendername));
  15. if(PlayerInfo[id][pAdmin] < adminlevel)
  16. {
  17. format(string, sizeof(string), "You've been promoted to level %d admin, by %s.", adminlevel, sendername);
  18. SendClientMessage(id, COLOR_YELLOW, string);
  19. format(string, sizeof(string), "You've promoted %s to a level %d admin.", giveplayer, adminlevel);
  20. SendClientMessage(playerid, COLOR_YELLOW, string);
  21. }
  22. else
  23. {
  24. format(string, sizeof(string), "You've been demoted to level %d admin, by %s.", adminlevel, sendername);
  25. SendClientMessage(id, COLOR_YELLOW, string);
  26. format(string, sizeof(string), "You've demoted %s to a level %d admin.", giveplayer, adminlevel);
  27. SendClientMessage(playerid, COLOR_YELLOW, string);
  28. }
  29. format(string, sizeof(string), "* Admin %s set %s's admin level to %d.", sendername,giveplayer,adminlevel);
  30. AdmChat(COLOR_ADMCHAT,string,1);
  31. PlayerInfo[id][pAdmin] = adminlevel;
  32. Update(playerid, pAdmin);
  33. new str[256];
  34. mysql_format(handle,str,sizeof(str),"UPDATE users SET `Admin`='%d' WHERE `Name`='%s'",PlayerInfo[id][pAdmin], GetName(playerid));
  35. mysql_tquery(handle,str,"","");
  36. }
  37. }
  38. else
  39. {
  40. SendClientMessage(playerid, COLOR_WHITE,"Error: Player not connected.");
  41. }
  42. }
  43. else
  44. {
  45. SendClientMessage(playerid, COLOR_ERROR, AdminOnly);
  46. }
  47. }
  48. return 1;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement