Advertisement
Guest User

Untitled

a guest
Sep 29th, 2014
840
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.94 KB | None | 0 0
  1. #define FILTERSCRIPT
  2. #define WHITE 0xFFFFFFFF
  3. #define BLUE 0x0505F5FF
  4. #define YELLOW 0xF5F507FF
  5.  
  6. #include <a_samp>
  7. #include <zcmd>
  8. #include <sscanf2>
  9.  
  10. enum PlayerStatistics
  11. {
  12. PendingInvite,
  13. IsMember,
  14. IsLeader,
  15. Duty,
  16. };
  17.  
  18. new Player[MAX_PLAYERS][PlayerStatistics];
  19.  
  20. public OnFilterScriptInit()
  21. {
  22. print("\n--------------------------------------");
  23. print("Police Department Script by GGRoleplay/Brandon");
  24. print("--------------------------------------\n");
  25. return 1;
  26. }
  27.  
  28. public OnFilterScriptExit()
  29. {
  30. return 1;
  31. }
  32.  
  33.  
  34.  
  35. CMD:pdhelp(playerid)
  36. {
  37. if(Player[playerid][IsMember] == 1)
  38. {
  39. ShowPlayerDialog(playerid, 2376, DIALOG_STYLE_MSGBOX, "PD Commands", "/makeleader\n/invite [id]\n/makeleader\n/invite\n", "Ok", "");
  40. }
  41. else
  42. {
  43. SendClientMessage(playerid, WHITE, "You're not a Police Department member!");
  44. }
  45. }
  46.  
  47. CMD:makeleader(playerid, params[])
  48. {
  49. new id;
  50. if(IsPlayerAdmin(playerid) || Player[playerid][IsLeader] == 1)
  51. {
  52. if(sscanf(params, "n", id)) return SendClientMessage(playerid, WHITE, "USAGE: /makeleader [id]");
  53. {
  54. new string[255];
  55. Player[playerid][IsMember] = 1;
  56. Player[playerid][IsLeader] = 0;
  57.  
  58. Player[id][IsLeader] = 1;
  59. Player[id][IsMember] = 1;
  60. SetPlayerSkin(id, 283);
  61. SendClientMessage(id, YELLOW, "Congratulations! You're the new leader of the Police Department!");
  62.  
  63. for(new i = 0; i < MAX_PLAYERS; i++)
  64. {
  65. if(Player[i][IsMember] == 1)
  66. {
  67. format(string, sizeof(string), "%s is the new Police Department leader!", GetName(id));
  68. SendClientMessage(i, YELLOW, string);
  69. }
  70. }
  71. }
  72. }
  73. else
  74. {
  75. SendClientMessage(playerid, WHITE, "You need to be a RCON admin or leader of the PD to make someone else leader..");
  76. }
  77. return 1;
  78. }
  79.  
  80. CMD:invite(playerid, params[])
  81. {
  82. new id;
  83. if(IsPlayerAdmin(playerid) || Player[playerid][IsLeader] == 1)
  84. {
  85. if(sscanf(params, "n", id)) return SendClientMessage(playerid, WHITE, "USAGE: /invite [id]");
  86. {
  87. new string[255], string2[255];
  88. format(string, sizeof(string), "You have been invited to the Police Department by %s (/acceptinvite)", GetName(playerid));
  89. format(string2, sizeof(string2), "You have invited %s to the Police Department", GetName(id));
  90. SendClientMessage(id, YELLOW, string);
  91. SendClientMessage(playerid, YELLOW, string2);
  92. Player[id][PendingInvite] = 1;
  93. }
  94. }
  95. else
  96. {
  97. SendClientMessage(playerid, WHITE, "You need to be a RCON admin or leader of the PD to invite someone.");
  98. }
  99. return 1;
  100. }
  101.  
  102. CMD:acceptinvite(playerid, params[])
  103. {
  104. if(Player[playerid][PendingInvite] == 1)
  105. {
  106. new string[255];
  107. Player[playerid][PendingInvite] = 0;
  108. Player[playerid][IsMember] = 1;
  109. SetPlayerSkin(playerid, 281);
  110.  
  111. for(new i = 0; i < MAX_PLAYERS; i++)
  112. {
  113. if(Player[i][IsMember] == 1)
  114. {
  115. format(string, sizeof(string), "%s has joined the Police Department.", GetName(playerid));
  116. SendClientMessage(i, YELLOW, string);
  117. }
  118. }
  119. }
  120. else
  121. {
  122. SendClientMessage(playerid, WHITE, "You're not pending an invite!");
  123. }
  124. }
  125.  
  126. CMD:leavepd(playerid, params[])
  127. {
  128. new string[255];
  129. if(Player[playerid][IsMember] == 1)
  130. {
  131. Player[playerid][IsMember] = 0;
  132. Player[playerid][IsLeader] = 0;
  133.  
  134. for(new i = 0; i < MAX_PLAYERS; i++)
  135. {
  136. if(Player[i][IsMember] == 1)
  137. {
  138. format(string, sizeof(string), "%s has left the Police Department.", GetName(playerid));
  139. SendClientMessage(i, YELLOW, string);
  140. }
  141. }
  142. }
  143. else
  144. {
  145. SendClientMessage(playerid, WHITE, "You're not in the Police Department.");
  146. }
  147. }
  148.  
  149. stock GetName(playerid)
  150. {
  151. new Name[MAX_PLAYER_NAME];
  152.  
  153. if(IsPlayerConnected(playerid))
  154. {
  155. GetPlayerName(playerid, Name, sizeof(Name));
  156. }
  157. else
  158. {
  159. Name = "Disconnected/Nothing";
  160. }
  161.  
  162. return Name;
  163. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement