Guest User

Dropcar Command

a guest
Mar 20th, 2015
388
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.34 KB | None | 0 0
  1. /*------------------------------------------------------------------------------------
  2. Filterscript created by Ciaran. You do not have to keep the credits, but it
  3. would be nice if you did. If you want to thank me, the best thing you can do
  4. is +Rep me on the forums as I am releasing a server and I need 15 reputation
  5. to make a SAMP server advertisement. Good luck and enjoy.
  6.  
  7. Link to forum account: http://forum.sa-mp.com/member.php?u=225556
  8. -----------------------------------------------------------------------------------*/
  9.  
  10. #define FILTERSCRIPT
  11.  
  12. #include <a_samp>
  13. #include <zcmd>
  14.  
  15. #if defined FILTERSCRIPT
  16.  
  17. public OnFilterScriptInit()
  18. {
  19. LoadVehicles();
  20. print("Dropcar Vehicles loaded.");
  21. return 1;
  22. }
  23.  
  24. #else
  25.  
  26. #endif
  27.  
  28. //Color Defines
  29. #define COLOR_GREEN 0x33AA33FF
  30. #define COLOR_WHITE 0xFFFFFFFF
  31. #define COLOR_GREY 0xAFAFAFFF
  32.  
  33. //Vehicle Thife Cooldown
  34. new thiefcooldown[MAX_PLAYERS];
  35.  
  36. //Vehicle Thief Cars
  37. new NormalCar[30];
  38. new BigCar[30];
  39. new HugeCar[30];
  40.  
  41. stock LoadVehicles()
  42. {
  43. //NOTE:
  44. /* These vehicles are placed across Las Venturas. Just create your own vehicle locations
  45. and change them below if your server is not in LV. */
  46.  
  47. //Thief Cars - Standard
  48. NormalCar[0] = CreateVehicle(401,1916.3652000,708.3321000,10.4451000,359.7643000,0,0,600);
  49. NormalCar[1] = CreateVehicle(405,2817.5991000,939.3661000,10.3751000,180.9467000,0,0,600);
  50. NormalCar[2] = CreateVehicle(436,2652.4353000,1085.8291000,10.4452000,272.3191000,0,0,600);
  51. NormalCar[3] = CreateVehicle(480,2363.3252000,1668.6544000,10.4453000,90.4974000,0,0,600);
  52. NormalCar[4] = CreateVehicle(496,2594.2485000,1973.7075000,10.4399000,89.0643000,0,0,600);
  53. NormalCar[5] = CreateVehicle(562,1424.5597000,973.3416000,9.8010000,358.6743000,0,0, 600);
  54. NormalCar[6] = CreateVehicle(507,2672.3608000,2000.9481000,10.4531000,269.8076000,0,0,600);
  55. NormalCar[7] = CreateVehicle(541,2186.7891000,1979.1039000,10.4452000,90.1544000,0,0,600);
  56. NormalCar[8] = CreateVehicle(517,2580.5398000,2249.5718000,10.4453000,180.4235000,0,0,600);
  57. NormalCar[9] = CreateVehicle(533,2822.0874000,2232.1304000,10.4454000,271.2804000,0,0,600);
  58. NormalCar[10] = CreateVehicle(566,1906.6366000,2075.6453000,10.4454000,89.9817000,0,0,600);
  59. NormalCar[11] = CreateVehicle(587,2200.9709000,2528.9373000,10.4416000,359.8749000,0,0,600);
  60. NormalCar[12] = CreateVehicle(603,2086.5383000,2398.8909000,10.4441000,90.1794000,0,0,600);
  61. NormalCar[13] = CreateVehicle(410,1413.4421000,711.4407000,10.4452000,90.5417000,0,0,600);
  62. NormalCar[14] = CreateVehicle(545,2069.0674000,2395.9634000,19.0546000,89.5119000,0,0,600);
  63. NormalCar[15] = CreateVehicle(415,2107.2109000,1408.8610000,10.4453000,179.0183000,0,0,600);
  64. NormalCar[16] = CreateVehicle(412,2078.5803000,2419.4592000,27.6484000,271.0032000,0,0,600);
  65.  
  66. //Thief Cars - Medium
  67. BigCar[0] = CreateVehicle(400,2132.3506000,1016.1492000,10.4454000,270.0213000,0,0,600);
  68. BigCar[1] = CreateVehicle(418,1870.0366000,1179.5073000,10.4600000,179.9870000,0,0,600);
  69. BigCar[2] = CreateVehicle(459,1621.6951000,1970.3406000,10.4454000,3.7933000,0,0,600);
  70. BigCar[3] = CreateVehicle(479,1708.7927000,2243.8684000,10.4452000,183.4580000,0,0,600);
  71. BigCar[4] = CreateVehicle(554,2599.2188000,1684.5198000,10.4453000,269.7698000,0,0,600);
  72. BigCar[5] = CreateVehicle(440,1385.6763000,2256.2178000,10.4453000,269.6565000,0,0,600);
  73. BigCar[6] = CreateVehicle(561,2096.3516000,2413.6638000,49.1482000,89.9355000,0,0,600);
  74. BigCar[7] = CreateVehicle(579,1117.9724000,2090.0386000,10.4415000,272.4155000,0,0,600);
  75.  
  76. //Thief Cars - Large
  77. HugeCar[0] = CreateVehicle(414,2042.4340000,2142.8801000,10.4452000,90.9155000,0,0,600);
  78. HugeCar[1] = CreateVehicle(456,1135.7478000,2260.5737000,10.4523000,90.9393000,0,0,600);
  79. HugeCar[2] = CreateVehicle(456,2829.8643000,2309.5530000,10.4452000,0.1173000,0,0,600);
  80. HugeCar[3] = CreateVehicle(498,2104.1272000,2043.1400000,10.4454000,270.4098000,0,0,600);
  81. }
  82.  
  83. /*
  84. If you have a hotwire system orsomething similar on your server, un-comment the code below
  85. to spawn the cars with their engine off. */
  86. public OnVehicleSpawn(vehicleid)
  87. {
  88. if(IsNormalCar(vehicleid))
  89. {
  90. SetVehicleParamsEx(vehicleid, 1, 0, 0, 0, 0, 0, 0);
  91. return 1;
  92. }
  93. return 1;
  94. }
  95.  
  96.  
  97. public OnPlayerEnterCheckpoint(playerid)
  98. {
  99. if(IsPlayerInRangeOfPoint(playerid, 7.0, 1702.9716,960.5179,10.8203))
  100. {
  101. new standardprice, biggerprice, hugeprice, string[128];
  102. new rcash1 = random(150);
  103. new rcash2 = random(200);
  104. new rcash3 = random(250);
  105. new vehicleid = GetPlayerVehicleID(playerid);
  106. if(IsNormalCar(vehicleid))
  107. {
  108. standardprice = rcash1+200;
  109. SendClientMessage(playerid, COLOR_GREY, "---------------------------------------------------------");
  110. //SendClientMessage(playerid, COLOR_GREY, "Type: Standard Vehicle");
  111. format(string, sizeof(string), "Payment: $%d", standardprice);
  112. SendClientMessage(playerid, COLOR_GREEN, string);
  113. SendClientMessage(playerid, COLOR_GREY, "You can drop off another car in five minutes.");
  114. SendClientMessage(playerid, COLOR_GREY, "---------------------------------------------------------");
  115. GivePlayerMoney(playerid, standardprice);
  116. SetVehicleToRespawn(GetPlayerVehicleID(playerid));
  117. DisablePlayerCheckpoint(playerid);
  118. return 1;
  119. }
  120. else if(IsBigCar(vehicleid))
  121. {
  122. biggerprice = rcash2+300;
  123. SendClientMessage(playerid, COLOR_GREY, "---------------------------------------------------------");
  124. //SendClientMessage(playerid, COLOR_GREY, "Type: Big Vehicle");
  125. format(string, sizeof(string), "Payment: $%d", biggerprice);
  126. SendClientMessage(playerid, COLOR_GREEN, string);
  127. SendClientMessage(playerid, COLOR_GREY, "You can drop off another car in five minutes.");
  128. SendClientMessage(playerid, COLOR_GREY, "---------------------------------------------------------");
  129. GivePlayerMoney(playerid, biggerprice);
  130. SetVehicleToRespawn(GetPlayerVehicleID(playerid));
  131. DisablePlayerCheckpoint(playerid);
  132. return 1;
  133. }
  134. else if(IsHugeCar(vehicleid))
  135. {
  136. hugeprice = rcash3+400;
  137. SendClientMessage(playerid, COLOR_GREY, "---------------------------------------------------------");
  138. //SendClientMessage(playerid, COLOR_GREY, "Type: Huge Vehicle");
  139. format(string, sizeof(string), "Payment: $%d", hugeprice);
  140. SendClientMessage(playerid, COLOR_GREEN, string);
  141. SendClientMessage(playerid, COLOR_GREY, "You can drop off another car in five minutes.");
  142. SendClientMessage(playerid, COLOR_GREY, "---------------------------------------------------------");
  143. GivePlayerMoney(playerid, hugeprice);
  144. SetVehicleToRespawn(GetPlayerVehicleID(playerid));
  145. DisablePlayerCheckpoint(playerid);
  146. return 1;
  147. }
  148. }
  149. return 1;
  150. }
  151.  
  152. CMD:dropcar(playerid, params[])
  153. {
  154. if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "You are not driving a vehicle.");
  155. new vehicleid = GetPlayerVehicleID(playerid);
  156. new currenttime = gettime();
  157. if(currenttime >= (thiefcooldown[playerid] + 900))
  158. {
  159. if(IsNormalCar(vehicleid))
  160. {
  161. SetPlayerCheckpoint(playerid, 1702.9716,960.5179,10.8203, 7.0);
  162. SendClientMessage(playerid, COLOR_WHITE, "Drop off the vehicle at the red marker.");
  163. return 1;
  164. }
  165.  
  166. if(IsBigCar(vehicleid))
  167. {
  168. SetPlayerCheckpoint(playerid, 1702.9716,960.5179,10.8203, 7.0);
  169. SendClientMessage(playerid, COLOR_WHITE, "Drop off the vehicle at the red marker.");
  170. return 1;
  171. }
  172.  
  173. if(IsHugeCar(vehicleid))
  174. {
  175. SetPlayerCheckpoint(playerid, 1702.9716,960.5179,10.8203, 7.0);
  176. SendClientMessage(playerid, COLOR_WHITE, "Drop off the vehicle at the red marker.");
  177. return 1;
  178. }
  179. thiefcooldown[playerid] = currenttime;
  180. }
  181. else
  182. {
  183. new str[55];
  184. format(str, sizeof(str), "You cannot use this command for another %d seconds.", ((thiefcooldown[playerid] + 900) - currenttime));
  185. SendClientMessage(playerid, COLOR_GREY, str);
  186. }
  187. return 1;
  188. }
  189.  
  190. stock IsNormalCar(vehicleid)
  191. {
  192. for(new i=0; i<17; i++)
  193. {
  194. if(vehicleid == NormalCar[i]) return 1;
  195. }
  196. return 0;
  197. }
  198.  
  199. stock IsBigCar(vehicleid)
  200. {
  201. for(new i=0; i<8; i++)
  202. {
  203. if(vehicleid == BigCar[i]) return 1;
  204. }
  205. return 0;
  206. }
  207.  
  208. stock IsHugeCar(vehicleid)
  209. {
  210. for(new i=0; i<4; i++)
  211. {
  212. if(vehicleid == HugeCar[i]) return 1;
  213. }
  214. return 0;
  215. }
Advertisement
Add Comment
Please, Sign In to add comment