Guest User

eddy

a guest
Jul 17th, 2009
1,532
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.53 KB | None | 0 0
  1. // Police Officer Job Filterscript made by eddy
  2. // Version 1.1
  3.  
  4. #include <a_samp>
  5.  
  6. #define COLOR_BLUE 0x0000BBAA
  7. #define COLOR_RED 0xFF0000AA
  8. #define COLOR_TRANSPARENT 0xFFFFFF00
  9.  
  10. #define MAX_POLICE_OFFICERS 3
  11.  
  12. #define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
  13.  
  14. enum PlayerInfo
  15. {
  16. PoliceOfficer
  17. }
  18.  
  19. new PlayerData[MAX_PLAYERS][PlayerInfo];
  20.  
  21. new PoliceOfficerLimit;
  22.  
  23. new PlayerScore;
  24.  
  25. new SpawnSkin;
  26.  
  27. new SpawnColor;
  28.  
  29. public OnPlayerConnect(playerid)
  30. {
  31. PlayerData[playerid][PoliceOfficer] = 0;
  32. SendClientMessage(playerid, COLOR_BLUE, "Type /police to become a Police Officer! (Your score must be 15 or higher)");
  33. return 1;
  34. }
  35.  
  36. public OnPlayerDisconnect(playerid)
  37. {
  38. if(PlayerData[playerid][PoliceOfficer] == 1)
  39. {
  40. new string[256];
  41. new PlayerName[MAX_PLAYER_NAME];
  42. GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
  43. format(string, sizeof(string), "%s got demoted from his/her Police Officer Job! (Left Game)", PlayerName);
  44. PlayerData[playerid][PoliceOfficer] = 0;
  45. PoliceOfficerLimit--;
  46. return 1;
  47. }
  48. return 1;
  49. }
  50.  
  51. public OnPlayerSpawn(playerid)
  52. {
  53. SpawnSkin = GetPlayerSkin(playerid);
  54. SpawnColor = GetPlayerColor(playerid);
  55. PlayerData[playerid][PoliceOfficer] = 0;
  56. return 1;
  57. }
  58.  
  59. public OnPlayerDeath(playerid, killerid, reason)
  60. {
  61. if(PlayerData[playerid][PoliceOfficer] == 1)
  62. {
  63. DemotePlayerFromPoliceOfficer(playerid);
  64. return 1;
  65. }
  66. return 1;
  67. }
  68.  
  69. dcmd_police(playerid, params[])
  70. {
  71. #pragma unused params
  72. PlayerScore = GetPlayerScore(playerid);
  73. if(PlayerData[playerid][PoliceOfficer] == 1)
  74. {
  75. SendClientMessage(playerid, COLOR_RED, "You are already a Police Officer");
  76. return 1;
  77. }
  78. if(PoliceOfficerLimit >= MAX_POLICE_OFFICERS)
  79. {
  80. SendClientMessage(playerid, COLOR_RED, "The limit of Police Officers has been reached");
  81. return 1;
  82. }
  83. if(PlayerScore >= 15)
  84. {
  85. PromotePlayerToPoliceOfficer(playerid);
  86. return 1;
  87. }
  88. else return SendClientMessage(playerid, COLOR_RED, "Your score must be 15 or higher before you can become a Police Officer");
  89. }
  90.  
  91. dcmd_quitpolice(playerid, params[])
  92. {
  93. #pragma unused params
  94. if(PlayerData[playerid][PoliceOfficer] == 1)
  95. {
  96. QuitPoliceOfficerJob(playerid);
  97. return 1;
  98. }
  99. else return SendClientMessage(playerid, COLOR_RED, "You are not a Police Officer");
  100. }
  101.  
  102. public OnPlayerCommandText(playerid, cmdtext[])
  103. {
  104. dcmd(police, 6, cmdtext);
  105. dcmd(quitpolice, 10, cmdtext);
  106. return 0;
  107. }
  108.  
  109. forward PromotePlayerToPoliceOfficer(playerid);
  110. public PromotePlayerToPoliceOfficer(playerid)
  111. {
  112. new string[256];
  113. new string2[256];
  114. new PlayerName[MAX_PLAYER_NAME];
  115. PlayerScore = GetPlayerScore(playerid);
  116. GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
  117. SetPlayerSkin(playerid, 285);
  118. GivePlayerWeapon(playerid, 29, 1000);
  119. GivePlayerWeapon(playerid, 31, 1000);
  120. GivePlayerWeapon(playerid, 35, 20);
  121. SetPlayerHealth(playerid, 500);
  122. SetPlayerArmour(playerid, 500);
  123. SetPlayerColor(playerid, COLOR_TRANSPARENT);
  124. format(string, sizeof(string), "%s became a Police Officer! Watch out, he/she could be everywhere... Ready to kill you...", PlayerName);
  125. format(string2, sizeof(string2), "Type /quitjob to quit your Job as a Police Officer");
  126. SendClientMessageToAll(COLOR_BLUE, string);
  127. SendClientMessage(playerid, COLOR_BLUE, string2);
  128. SetPlayerScore(playerid, PlayerScore -15);
  129. PlayerData[playerid][PoliceOfficer] = 1;
  130. PoliceOfficerLimit++;
  131. return 1;
  132. }
  133.  
  134. forward DemotePlayerFromPoliceOfficer(playerid);
  135. public DemotePlayerFromPoliceOfficer(playerid)
  136. {
  137. new string[256];
  138. new PlayerName[MAX_PLAYER_NAME];
  139. GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
  140. SetPlayerHealth(playerid, 100);
  141. SetPlayerArmour(playerid, 0);
  142. SetPlayerSkin(playerid, SpawnSkin);
  143. SetPlayerColor(playerid, SpawnColor);
  144. format(string, sizeof(string), "%s got demoted from his/her Police Officer Job! (Died)", PlayerName);
  145. SendClientMessageToAll(COLOR_BLUE, string);
  146. PlayerData[playerid][PoliceOfficer] = 0;
  147. PoliceOfficerLimit--;
  148. return 1;
  149. }
  150.  
  151. forward QuitPoliceOfficerJob(playerid);
  152. public QuitPoliceOfficerJob(playerid)
  153. {
  154. new string[256];
  155. new PlayerName[MAX_PLAYER_NAME];
  156. GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
  157. SetPlayerHealth(playerid, 100);
  158. SetPlayerArmour(playerid, 0);
  159. SetPlayerSkin(playerid, SpawnSkin);
  160. SetPlayerColor(playerid, SpawnColor);
  161. format(string, sizeof(string), "%s is not a Police Officer anymore! (Left Job)", PlayerName);
  162. SendClientMessageToAll(COLOR_BLUE, string);
  163. PlayerData[playerid][PoliceOfficer] = 0;
  164. PoliceOfficerLimit--;
  165. return 1;
  166. }
Advertisement
Add Comment
Please, Sign In to add comment