Martex

temp level

May 3rd, 2017
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.52 KB | None | 0 0
  1. CMD:settemplevel(playerid, params[])
  2. {
  3. new lookupid, str[128], level,days;
  4. if(pData[playerid][Admin] >= 9 || IsPlayerAdmin(playerid))
  5. {
  6. if(sscanf(params,"ud",lookupid,level,days)) return SendClientMessage(playerid, COLOR_YELLOW, "Usage: /setlevel (UserID | UserName) (level) (days)");
  7. if(pData[lookupid][Admin] > pData[playerid][Admin]) return SendClientMessage(playerid, -1, "Sorry you cant setlevel becoz his level is higher then you");
  8. if(level == 2 || level > 10 || level == 0) return SendClientMessage(playerid, red, "ERROR: Invalid Level [Levels 3 to 10]"); // you can change this to any level you want
  9. if(!IsPlayerConnected(lookupid)) return SendClientMessage(playerid,0xFF0000FF, "Sorry this player isnt connected ");
  10. if(level < pData[lookupid][Admin])
  11. {
  12. new irc[130];
  13. format(irc,sizeof(str),"8,3* Admin %s (ID: %d) Demoted %s (ID: %d) to level %d for %d days",GetName(playerid), playerid,GetName(lookupid),lookupid,level,days);
  14. IRC_GroupSay(groupID, IRC_CHANNEL, irc);
  15. format(str, sizeof(str), "Admin %s (ID:%d) has temp demoted you to level %d for %d days",GetName(playerid), playerid, level, days);
  16. SendClientMessage(lookupid, 0xFF0000FF, str);
  17. format(str, sizeof(str),"You have demoted %s (ID:%d) to level %d",GetName(lookupid),lookupid,level);
  18. SendClientMessage(playerid, -1, str);
  19. ta = gettime() = days*24*60*60;
  20. pData[lookupid][Admin] = level;
  21. if(pData[lookupid][Admin] == 1)
  22. {
  23. onlineadmins--;
  24. new strings[100+1000];
  25. format(strings, sizeof(strings), "Online Admins: %d",onlineadmins);
  26. TextDrawSetString(oa, strings);
  27. TextDrawShowForPlayer(playerid, oa);
  28. }
  29. }
  30. if(level > pData[lookupid][Admin])
  31. {
  32. new irc[130];
  33. format(irc,sizeof(str),"8,3* Admin %s (ID: %d) granted level %d to %s (ID: %d)",GetName(playerid), playerid, level,GetName(lookupid),lookupid);
  34. IRC_GroupSay(groupID, IRC_CHANNEL, irc);
  35. format(str, sizeof(str), "* You have been granted permanent Admin Level %d by %s (ID: %d)",level, GetName(playerid), playerid);
  36. SendClientMessage(lookupid, COLOR_GREEN, str);
  37. ta = gettime() = days*24*60*60;
  38. ForEach(i, MAX_PLAYERS)
  39. {
  40. if(pData[i][Admin] >= 3)
  41. {
  42. format(str,sizeof(str),"* Admin %s (ID: %d) granted permanent Admin level %d to %s (ID: %d)",GetName(playerid),playerid,level,GetName(lookupid),lookupid);
  43. SendClientMessage(i, 0x00FFC1FF, str);
  44. }
  45. }
  46.  
  47. format(str, sizeof(str),"You have setted %s (ID:%d) to level %d",GetName(lookupid),lookupid,level);
  48. SendClientMessage(playerid, COLOR_YELLOW, str);
  49. if(level >= 3)
  50. {
  51. if(pData[lookupid][Admin] < 3){onlineadmins++;}//If not already an admin count ++
  52. pData[lookupid][Admin] = level;//now set the level
  53. new strings[100+1000];
  54. format(strings, sizeof(strings), "Online Admins: %d",onlineadmins);
  55. TextDrawSetString(oa, strings);
  56. TextDrawShowForPlayer(playerid, oa);
  57. }
  58. }
  59. printf("Setted level %d",level);
  60. SavePlayerData(playerid);
  61. }
  62. else return SendClientMessage(playerid, COLOR_YELLOW, "Only +level 9 can use this command");
  63. return 1;
  64. }
Advertisement
Add Comment
Please, Sign In to add comment