Guest User

[FS] CarSpawner

a guest
Oct 29th, 2018
1,855
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.75 KB | None | 0 0
  1. // By Rajat
  2.  
  3. #include <a_samp>
  4. #include <sscanf2>
  5. #include <zcmd>
  6.  
  7. new aVehicleNames[][] =
  8. {
  9. {"Landstalker"},
  10. {"Bravura"},
  11. {"Buffalo"},
  12. {"Linerunner"},
  13. {"Perrenial"},
  14. {"Sentinel"},
  15. {"Dumper"},
  16. {"Firetruck"},
  17. {"Trashmaster"},
  18. {"Stretch"},
  19. {"Manana"},
  20. {"Infernus"},
  21. {"Voodoo"},
  22. {"Pony"},
  23. {"Mule"},
  24. {"Cheetah"},
  25. {"Ambulance"},
  26. {"Leviathan"},
  27. {"Moonbeam"},
  28. {"Esperanto"},
  29. {"Taxi"},
  30. {"Washington"},
  31. {"Bobcat"},
  32. {"Mr Whoopee"},
  33. {"BF Injection"},
  34. {"Hunter"},
  35. {"Premier"},
  36. {"Enforcer"},
  37. {"Securicar"},
  38. {"Banshee"},
  39. {"Predator"},
  40. {"Bus"},
  41. {"Rhino"},
  42. {"Barracks"},
  43. {"Hotknife"},
  44. {"Trailer 1"},
  45. {"Previon"},
  46. {"Coach"},
  47. {"Cabbie"},
  48. {"Stallion"},
  49. {"Rumpo"},
  50. {"RC Bandit"},
  51. {"Romero"},
  52. {"Packer"},
  53. {"Monster"},
  54. {"Admiral"},
  55. {"Squalo"},
  56. {"Seasparrow"},
  57. {"Pizzaboy"},
  58. {"Tram"},
  59. {"Trailer 2"},
  60. {"Turismo"},
  61. {"Speeder"},
  62. {"Reefer"},
  63. {"Tropic"},
  64. {"Flatbed"},
  65. {"Yankee"},
  66. {"Caddy"},
  67. {"Solair"},
  68. {"Berkley's RC Van"},
  69. {"Skimmer"},
  70. {"PCJ-600"},
  71. {"Faggio"},
  72. {"Freeway"},
  73. {"RC Baron"},
  74. {"RC Raider"},
  75. {"Glendale"},
  76. {"Oceanic"},
  77. {"Sanchez"},
  78. {"Sparrow"},
  79. {"Patriot"},
  80. {"Quad"},
  81. {"Coastguard"},
  82. {"Dinghy"},
  83. {"Hermes"},
  84. {"Sabre"},
  85. {"Rustler"},
  86. {"ZR-350"},
  87. {"Walton"},
  88. {"Regina"},
  89. {"Comet"},
  90. {"BMX"},
  91. {"Burrito"},
  92. {"Camper"},
  93. {"Marquis"},
  94. {"Baggage"},
  95. {"Dozer"},
  96. {"Maverick"},
  97. {"News Chopper"},
  98. {"Rancher"},
  99. {"FBI Rancher"},
  100. {"Virgo"},
  101. {"Greenwood"},
  102. {"Jetmax"},
  103. {"Hotring"},
  104. {"Sandking"},
  105. {"Blista Compact"},
  106. {"Police Maverick"},
  107. {"Boxville"},
  108. {"Benson"},
  109. {"Mesa"},
  110. {"RC Goblin"},
  111. {"Hotring Racer A"},
  112. {"Hotring Racer B"},
  113. {"Bloodring Banger"},
  114. {"Rancher"},
  115. {"Super GT"},
  116. {"Elegant"},
  117. {"Journey"},
  118. {"Bike"},
  119. {"Mountain Bike"},
  120. {"Beagle"},
  121. {"Cropdust"},
  122. {"Stunt"},
  123. {"Tanker"},
  124. {"Roadtrain"},
  125. {"Nebula"},
  126. {"Majestic"},
  127. {"Buccaneer"},
  128. {"Shamal"},
  129. {"Hydra"},
  130. {"FCR-900"},
  131. {"NRG-500"},
  132. {"HPV1000"},
  133. {"Cement Truck"},
  134. {"Tow Truck"},
  135. {"Fortune"},
  136. {"Cadrona"},
  137. {"FBI Truck"},
  138. {"Willard"},
  139. {"Forklift"},
  140. {"Tractor"},
  141. {"Combine"},
  142. {"Feltzer"},
  143. {"Remington"},
  144. {"Slamvan"},
  145. {"Blade"},
  146. {"Freight"},
  147. {"Streak"},
  148. {"Vortex"},
  149. {"Vincent"},
  150. {"Bullet"},
  151. {"Clover"},
  152. {"Sadler"},
  153. {"Firetruck LA"},
  154. {"Hustler"},
  155. {"Intruder"},
  156. {"Primo"},
  157. {"Cargobob"},
  158. {"Tampa"},
  159. {"Sunrise"},
  160. {"Merit"},
  161. {"Utility"},
  162. {"Nevada"},
  163. {"Yosemite"},
  164. {"Windsor"},
  165. {"Monster A"},
  166. {"Monster B"},
  167. {"Uranus"},
  168. {"Jester"},
  169. {"Sultan"},
  170. {"Stratum"},
  171. {"Elegy"},
  172. {"Raindance"},
  173. {"RC Tiger"},
  174. {"Flash"},
  175. {"Tahoma"},
  176. {"Savanna"},
  177. {"Bandito"},
  178. {"Freight Flat"},
  179. {"Streak Carriage"},
  180. {"Kart"},
  181. {"Mower"},
  182. {"Duneride"},
  183. {"Sweeper"},
  184. {"Broadway"},
  185. {"Tornado"},
  186. {"AT-400"},
  187. {"DFT-30"},
  188. {"Huntley"},
  189. {"Stafford"},
  190. {"BF-400"},
  191. {"Newsvan"},
  192. {"Tug"},
  193. {"Trailer 3"},
  194. {"Emperor"},
  195. {"Wayfarer"},
  196. {"Euros"},
  197. {"Hotdog"},
  198. {"Club"},
  199. {"Freight Carriage"},
  200. {"Trailer 3"},
  201. {"Andromada"},
  202. {"Dodo"},
  203. {"RC Cam"},
  204. {"Launch"},
  205. {"Police Car (LSPD)"},
  206. {"Police Car (SFPD)"},
  207. {"Police Car (LVPD)"},
  208. {"Police Ranger"},
  209. {"Picador"},
  210. {"S.W.A.T. Van"},
  211. {"Alpha"},
  212. {"Phoenix"},
  213. {"Glendale"},
  214. {"Sadler"},
  215. {"Luggage Trailer A"},
  216. {"Luggage Trailer B"},
  217. {"Stair Trailer"},
  218. {"Boxville"},
  219. {"Farm Plow"},
  220. {"Utility Trailer"}
  221. };
  222.  
  223. GetVehicleModelIDFromName(vname[])
  224. {
  225. for(new i = 0; i < 211; i++)
  226. {
  227. if(strfind(aVehicleNames[i], vname, true) != -1)
  228. return i + 400;
  229. }
  230. return -1;
  231. }
  232.  
  233. stock GetXYInFrontOfPlayer(playerid, &Float:x2, &Float:y2, Float:distance)
  234. {
  235. new Float:a;
  236.  
  237. GetPlayerPos(playerid, x2, y2, a);
  238. GetPlayerFacingAngle(playerid, a);
  239.  
  240. if(GetPlayerVehicleID(playerid))
  241. {
  242. GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
  243. }
  244.  
  245. x2 += (distance * floatsin(-a, degrees));
  246. y2 += (distance * floatcos(-a, degrees));
  247. }
  248.  
  249. CMD:car(playerid, params[])
  250. {
  251. static String[200], tmp[100], Float:x, Float:y, Float:z;
  252. if(sscanf(params, "s[100]", tmp)) return SendClientMessage(playerid, -1, "/car [vehicle name]");
  253.  
  254. new vehicle = GetVehicleModelIDFromName(tmp);
  255. if(vehicle < 400 || vehicle > 611) return SendClientMessage(playerid, -1, "That vehicle name was not found");
  256.  
  257. static Float:a;
  258. GetPlayerFacingAngle(playerid, a);
  259. GetPlayerPos(playerid, x, y, z);
  260.  
  261. if(IsPlayerInAnyVehicle(playerid) == 1)
  262. {
  263. GetXYInFrontOfPlayer(playerid, x, y, 8);
  264. }
  265. else
  266. {
  267. GetXYInFrontOfPlayer(playerid, x, y, 5);
  268. }
  269.  
  270. new PlayersVehicle = CreateVehicle(vehicle, x, y, z, a+90, -1, -1, -1);
  271. LinkVehicleToInterior(PlayersVehicle, GetPlayerInterior(playerid));
  272.  
  273. format(String, sizeof(String), "You have spawned a %s", aVehicleNames[vehicle - 400]);
  274. SendClientMessage(playerid, -1, String);
  275. return 1;
  276. }
Add Comment
Please, Sign In to add comment