Advertisement
Guest User

D-Admin -- By DamonD

a guest
Aug 30th, 2013
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.75 KB | None | 0 0
  1. // D-Admin -- Administration System
  2. // By DamonD(Damon Davidson)
  3. // V1.0
  4.  
  5. #include <a_samp>
  6. #include zcmd
  7.  
  8. #if defined FILTERSCRIPT
  9.  
  10. #define pHelper
  11. #define pAdmin
  12.  
  13. CMD:makeadmin(playerid, params[]) {
  14. if(PlayerInfo[playerid][pAdmin] >= 99998) {
  15.  
  16. new
  17. iAdminValue,
  18. iTargetID;
  19.  
  20. if(sscanf(params, "ui", iTargetID, iAdminValue)) {
  21. SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /makeadmin [playerid] [level]");
  22. }
  23. else if(IsPlayerConnected(iTargetID)) {
  24. if(PlayerInfo[iTargetID][pHelper] >= 1) {
  25. SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot make Community Helpers admins!");
  26. }
  27. else {
  28.  
  29. new
  30. szMessage[47 + (MAX_PLAYER_NAME * 2)];
  31.  
  32. PlayerInfo[iTargetID][pAdmin] = iAdminValue;
  33. format(szMessage, sizeof(szMessage), "You have been promoted to a level %d admin by %s.", iAdminValue, GetPlayerNameEx(playerid));
  34. SendClientMessageEx(iTargetID, COLOR_LIGHTBLUE, szMessage);
  35. format(szMessage, sizeof(szMessage), "You have promoted %s to a level %d admin.", GetPlayerNameEx(iTargetID),iAdminValue);
  36. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, szMessage);
  37. }
  38. }
  39. else SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid player specified.");
  40. }
  41. else SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
  42. return 1;
  43. }
  44. CMD:maketempadmin(playerid, params[])
  45. {
  46. new string[128], giveplayerid, minutes, rank;
  47. if(sscanf(params, "udd[64]", giveplayerid, rank, minutes)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /maketempadmin [playerid] [rank] [minutes]");
  48. if(PlayerInfo[playerid][pAdmin] >= 99998) {
  49. if(IsPlayerConnected(giveplayerid)) {
  50. if(PlayerInfo[giveplayerid][pAdmin] >= PlayerInfo[playerid][pAdmin]) {
  51. SendClientMessageEx(playerid, COLOR_WHITE, "You can't perform this action on an equal or higher level administrator.");
  52. return 1;
  53. }
  54. PlayerInfo[giveplayerid][pAdmin] = rank;
  55. IsTempAdmin[giveplayerid] = 1;
  56. /*new IsTempAdmin[MAX_PLAYERS];*/
  57. PlayerInfo[giveplayerid][pAdminTime] = minutes*60;
  58. /*format(szMessage, sizeof(szMessage), "You have been promoted to a level %d admin by %s for %d minutes.", rank, GetPlayerNameEx(playerid), minutes);
  59. SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, szMessage);*/
  60. }
  61. else SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid player specified.");
  62. }
  63. else SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
  64. return 1;
  65. }
  66.  
  67. CMD:freeze(playerid, params[])
  68. {
  69. if (PlayerInfo[playerid][pAdmin] >= 2)
  70. {
  71. new string[128], giveplayerid;
  72. if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /freeze [playerid]");
  73. if(IsPlayerConnected(giveplayerid))
  74. {
  75. if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin])
  76. {
  77. SendClientMessageEx(playerid, COLOR_GRAD2, "You can't freeze a higher admin.");
  78. return 1;
  79. }
  80. TogglePlayerControllable(giveplayerid, 0);
  81. SetPVarInt(giveplayerid, "IsFrozen", 1);
  82. }
  83. }
  84. else
  85. {
  86. SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
  87. }
  88. return 1;
  89. }
  90.  
  91. CMD:unfreeze(playerid, params[])
  92. {
  93. if (PlayerInfo[playerid][pAdmin] >= 2)
  94. {
  95. new string[128], giveplayerid;
  96. if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /unfreeze [playerid]");
  97. if(IsPlayerConnected(giveplayerid))
  98. {
  99. DeletePVar(giveplayerid, "IsFrozen");
  100. TogglePlayerControllable(giveplayerid, 1);
  101. }
  102. else
  103. {
  104. SendClientMessageEx(playerid, COLOR_WHITE, "Invalid player specified.");
  105. }
  106.  
  107. }
  108. else
  109. {
  110. SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
  111. }
  112. return 1;
  113. }
  114.  
  115. CMD:slap(playerid, params[])
  116. {
  117. if(PlayerInfo[playerid][pAdmin] >= 4)
  118. {
  119. new string[128], giveplayerid;
  120. if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /slap [playerid]");
  121. new Float:shealth;
  122. new Float:slx, Float:sly, Float:slz;
  123.  
  124. if(IsPlayerConnected(giveplayerid))
  125. {
  126.  
  127. GetPlayerHealth(giveplayerid, shealth);
  128. SetPlayerHealth(giveplayerid, shealth-5);
  129. GetPlayerPos(giveplayerid, slx, sly, slz);
  130. SetPlayerPos(giveplayerid, slx, sly, slz+5);
  131. PlayerPlaySound(giveplayerid, 1130, slx, sly, slz+5);
  132. }
  133. }
  134. else
  135. {
  136. SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
  137. }
  138. return 1;
  139. }
  140.  
  141. CMD:playall(playerid, params[])
  142. {
  143. foreach(Player, i)
  144. {
  145. if (PlayerInfo[playerid][pAdmin] >= 9999)
  146. {
  147. if(isnull(params)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /playall [Link]");
  148. PlayAudioStreamForPlayer(i, params);
  149. }
  150. }
  151. return 1;
  152. }
  153.  
  154. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement