GammixSAMP

vehicleplus.inc R2 - By Gammix

Jun 11th, 2015
498
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 81.29 KB | None | 0 0
  1. /*
  2. Vehicles Plus Include (vehicleplus.inc)
  3. * Add new features to your vehicles system and have the missing or actually the correct word is needed vehicle functions
  4. * Gives you advantage over ordinary vehicle manager includes, this is compatiable with other scripts (using property function)
  5. * Now EditVehicle avalaible with this include
  6.  
  7. Author: (creator)
  8. * Gammix
  9.  
  10. Contributors:
  11. * Admigo - a_OPSVP include (offsets of vehicle bodyparts)
  12. * Emmet_ - random car colors and top speed array
  13.  
  14. (c) Copyright 2015
  15. * This file is provided as is (no warranties).
  16. */
  17.  
  18. /*
  19. FUNCTIONS:
  20. native CreateVehicle(modelid, Float:x, Float:y, Float:z, Float:rotation, color1 = -1, color2 = -1, respawn_delay = -1, addsiren = 0, worldid = 0, interiorid = 0, bool:unoccupied_damage = false);
  21. native GetVehicleInterior(vehicleid);
  22. native GetVehicleColor(vehicleid, &color1, &color2);
  23. native GetVehiclePaintjob(vehicleid);
  24. native RemoveVehiclePaintjob(vehicleid);
  25. native SetVehicleHorn(vehicleid, soundid);
  26. native GetVehicleHorn(vehicleid);
  27. native RestoreVehicleHorn(vehicleid);
  28. native ToggleVehicleDamageUpdate(vehicleid, type, bool:toggle);
  29. native IsVehicleDamageToggled(vehicleid, type);
  30. native UpdateVehicleDamageStatusEx(vehicleid, type, update);
  31. native GetVehicleDamageStatusEx(vehicleid, type);
  32. native IsVehicleOccupied(vehicleid);
  33. native GetVehicleDriverID(vehicleid);
  34. native EditVehicle(playerid, vehicleid);
  35. native IsValidVehicle(vehicleid);
  36. native GetVehicleName(vehicleid, string[], len = sizeof(string));
  37. native GetVehicleModelName(modelid, string[], len = sizeof(string));
  38. native SetVehicleParams(vehicleid, type, set);
  39. native GetVehicleParams(vehicleid, type);
  40. native Float:GetVehicleSpeed(vehicleid, bool:kmh = true, Float:velx = 0.0, Float:vely = 0.0, Float:velz = 0.0);
  41. native IsObjectAttachedToVehicle(objectid, vehicleid);
  42. native GetVehicleSlotAttachedObject(vehicleid, slot);
  43. native TeleportVehicle(vehicleid, Float:x, Float:y, Float:z, Float:rotation, worldid = -1, interiorid = -1);
  44. native SetVehicleSpeedCap(vehicleid, Float:maxspeed);
  45. native Float:GetVehicleSpeedCap(vehicleid);
  46. native DisableVehicleSpeedCap(vehicleid);
  47. native GetVehicleTopSpeed(vehicleid);
  48. native GetVehicleModelTopSpeed(modelid);
  49. native SetVehicleSpawnInfo(vehicleid, Float:x, Float:y, Float:z, Float:rotation, worldid, interiorid);
  50. native GetVehicleSpawnInfo(vehicleid, &Float:x, &Float:y, &Float:z, &Float:rotation, &worldid, &interiorid);
  51. native ToggleUnoccupiedVehicleDamage(vehicleid, bool:toggle);
  52. native IsUnoccupiedDamageToggled(vehicleid);
  53. native ToggleVehiclePetrolCapDestroy(vehicleid, bool:toggle);
  54. native IsPetrolCapDestroyToggled(vehicleid);
  55. native SetVehicleBomb(vehicleid, time = 1000);
  56. native GetVehicleBomb(vehicleid);
  57. native RemoveVehicleBomb(vehicleid);
  58. native IsVehicleBombed(vehicleid);
  59. native IsVehicleBombActivated(vehicleid);
  60. native ToggleVehicleSticky(vehicleid, bool:toggle);
  61. native IsVehicleSticky(vehicleid);
  62. native CountAllVehicles();
  63. native DestroyAllVehicles();
  64.  
  65. CALLBACKS:
  66. public OnPlayerShotVehicle(playerid, vehicleid, weaponid, Float:amount, bodypart)
  67. public OnPlayerEditVehicle(playerid, vehicleid, response, Float:fX, Float:fY, Float:fZ, Float:fRotZ)
  68. public OnPlayerReachSpeedCapLimit(playerid, vehicleid, Float:speed)
  69. public OnVehicleBombActivate(vehicleid)
  70. public OnVehicleBombDeactivate(vehicleid)
  71. public OnVehicleBombExplode(vehicleid)
  72. public OnVehiclePosChange(vehicleid, Float:newx, Float:newy, Float:newz, Float:newrotation, Float:oldx, Float:oldy, Float:oldz, Float:oldrotation)
  73. public OnVehicleVelocityChange(vehicleid, Float:newx, Float:newy, Float:newz, Float:oldx, Float:oldy, Float:oldz)
  74. public OnVehicleHealthChange(vehicleid, Float:newhealth, Float:oldhealth)
  75. */
  76.  
  77. #define VEHICLE_DAMAGE_PANELS 0
  78. #define VEHICLE_DAMAGE_DOORS 1
  79. #define VEHICLE_DAMAGE_LIGHTS 2
  80. #define VEHICLE_DAMAGE_TIRES 3
  81.  
  82. #define VEHICLE_BODYPART_FRONT_LEFT_WHEEL 0
  83. #define VEHICLE_BODYPART_FRONT_RIGHT_WHEEL 1
  84. #define VEHICLE_BODYPART_BACK_LEFT_WHEEL 2
  85. #define VEHICLE_BODYPART_BACK_RIGHT_WHEEL 3
  86. #define VEHICLE_BODYPART_PETROLCAP 4
  87. #define VEHICLE_BODYPART_UNKNOWN 5
  88.  
  89. #define VEHICLE_PARAMS_ENGINE 0
  90. #define VEHICLE_PARAMS_LIGHTS 1
  91. #define VEHICLE_PARAMS_ALARM 2
  92. #define VEHICLE_PARAMS_DOORS 3
  93. #define VEHICLE_PARAMS_BONNET 4
  94. #define VEHICLE_PARAMS_BOOT 5
  95. #define VEHICLE_PARAMS_OBJECTIVE 6
  96.  
  97. #if ! defined MAX_VEHICLE_ATTACHED_OBJECTS
  98. #define MAX_VEHICLE_ATTACHED_OBJECTS 30
  99. #endif
  100.  
  101. #define MAX_VEHICLE_MODELS 212
  102.  
  103. #define VEHICLE_UPDATE_INTERVAL 250
  104.  
  105. enum VehicleTempDataEnum
  106. {
  107. e_attached_object[MAX_VEHICLE_ATTACHED_OBJECTS],
  108. Float:e_vel_x,
  109. Float:e_vel_y,
  110. Float:e_vel_z,
  111. Float:e_pos_x,
  112. Float:e_pos_y,
  113. Float:e_pos_z,
  114. Float:e_pos_a,
  115. Float:e_health,
  116. };
  117. static gVehicleTempData[MAX_VEHICLES][VehicleTempDataEnum];
  118. static gPlayerVehicleEditer[MAX_PLAYERS] = INVALID_VEHICLE_ID;
  119.  
  120. stock static const gVehicleTempDataNames[MAX_VEHICLE_MODELS][] =
  121. {
  122. "Landstalker",
  123. "Bravura",
  124. "Buffalo",
  125. "Linerunner",
  126. "Perrenial",
  127. "Sentinel",
  128. "Dumper",
  129. "Firetruck",
  130. "Trashmaster",
  131. "Stretch",
  132. "Manana",
  133. "Infernus",
  134. "Voodoo",
  135. "Pony",
  136. "Mule",
  137. "Cheetah",
  138. "Ambulance",
  139. "Leviathan",
  140. "Moonbeam",
  141. "Esperanto",
  142. "Taxi",
  143. "Washington",
  144. "Bobcat",
  145. "Mr Whoopee",
  146. "BF Injection",
  147. "Hunter",
  148. "Premier",
  149. "Enforcer",
  150. "Securicar",
  151. "Banshee",
  152. "Predator",
  153. "Bus",
  154. "Rhino",
  155. "Barracks",
  156. "Hotknife",
  157. "Trailer 1",
  158. "Previon",
  159. "Coach",
  160. "Cabbie",
  161. "Stallion",
  162. "Rumpo",
  163. "RC Bandit",
  164. "Romero",
  165. "Packer",
  166. "Monster",
  167. "Admiral",
  168. "Squalo",
  169. "Seasparrow",
  170. "Pizzaboy",
  171. "Tram",
  172. "Trailer 2",
  173. "Turismo",
  174. "Speeder",
  175. "Reefer",
  176. "Tropic",
  177. "Flatbed",
  178. "Yankee",
  179. "Caddy",
  180. "Solair",
  181. "Berkley's RC Van",
  182. "Skimmer",
  183. "PCJ-600",
  184. "Faggio",
  185. "Freeway",
  186. "RC Baron",
  187. "RC Raider",
  188. "Glendale",
  189. "Oceanic",
  190. "Sanchez",
  191. "Sparrow",
  192. "Patriot",
  193. "Quad",
  194. "Coastguard",
  195. "Dinghy",
  196. "Hermes",
  197. "Sabre",
  198. "Rustler",
  199. "ZR-350",
  200. "Walton",
  201. "Regina",
  202. "Comet",
  203. "BMX",
  204. "Burrito",
  205. "Camper",
  206. "Marquis",
  207. "Baggage",
  208. "Dozer",
  209. "Maverick",
  210. "News Chopper",
  211. "Rancher",
  212. "FBI Rancher",
  213. "Virgo",
  214. "Greenwood",
  215. "Jetmax",
  216. "Hotring",
  217. "Sandking",
  218. "Blista Compact",
  219. "Police Maverick",
  220. "Boxville","Benson",
  221. "Mesa",
  222. "RC Goblin",
  223. "Hotring Racer A",
  224. "Hotring Racer B",
  225. "Bloodring Banger",
  226. "Rancher",
  227. "Super GT",
  228. "Elegant",
  229. "Journey",
  230. "Bike",
  231. "Mountain Bike",
  232. "Beagle",
  233. "Cropdust",
  234. "Stunt",
  235. "Tanker",
  236. "Roadtrain",
  237. "Nebula",
  238. "Majestic",
  239. "Buccaneer",
  240. "Shamal",
  241. "Hydra",
  242. "FCR-900",
  243. "NRG-500",
  244. "HPV1000",
  245. "Cement Truck",
  246. "Tow Truck",
  247. "Fortune",
  248. "Cadrona",
  249. "FBI Truck",
  250. "Willard",
  251. "Forklift",
  252. "Tractor",
  253. "Combine",
  254. "Feltzer",
  255. "Remington",
  256. "Slamvan",
  257. "Blade",
  258. "Freight",
  259. "Streak",
  260. "Vortex",
  261. "Vincent",
  262. "Bullet",
  263. "Clover",
  264. "Sadler",
  265. "Firetruck LA",
  266. "Hustler",
  267. "Intruder",
  268. "Primo",
  269. "Cargobob",
  270. "Tampa",
  271. "Sunrise",
  272. "Merit",
  273. "Utility",
  274. "Nevada",
  275. "Yosemite",
  276. "Windsor",
  277. "Monster A",
  278. "Monster B",
  279. "Uranus","Jester",
  280. "Sultan",
  281. "Stratum",
  282. "Elegy",
  283. "Raindance",
  284. "RC Tiger",
  285. "Flash",
  286. "Tahoma",
  287. "Savanna",
  288. "Bandito",
  289. "Freight Flat",
  290. "Streak Carriage",
  291. "Kart","Mower",
  292. "Duneride",
  293. "Sweeper",
  294. "Broadway",
  295. "Tornado",
  296. "AT-400",
  297. "DFT-30",
  298. "Huntley",
  299. "Stafford",
  300. "BF-400",
  301. "Newsvan",
  302. "Tug",
  303. "Trailer 3",
  304. "Emperor",
  305. "Wayfarer",
  306. "Euros",
  307. "Hotdog",
  308. "Club",
  309. "Freight Carriage",
  310. "Trailer 3",
  311. "Andromada",
  312. "Dodo",
  313. "RC Cam",
  314. "Launch",
  315. "Police Car (LSPD)",
  316. "Police Car (SFPD)",
  317. "Police Car (LVPD)",
  318. "Police Ranger",
  319. "Picador",
  320. "S.W.A.T. Van",
  321. "Alpha",
  322. "Phoenix",
  323. "Glendale",
  324. "Sadler",
  325. "Luggage Trailer A",
  326. "Luggage Trailer B",
  327. "Stair Trailer",
  328. "Boxville",
  329. "Farm Plow",
  330. "Utility Trailer"
  331. };
  332.  
  333. stock static const Float:gVehiclePetrolCapOffsets[MAX_VEHICLE_MODELS][3] =
  334. {
  335. {-1.06, -2.07, -0.03},
  336. {1.25, -0.91, 0.05},
  337. {1.11, -1.92, 0.17},
  338. {-1.46, 0.02, -0.66},
  339. {-1.03, -2.37, 0.06},
  340. {-0.86, -2.16, -0.08},
  341. {0.00, 0.00, 0.00},
  342. {-1.07, -3.74, -0.42},
  343. {-1.46, 1.24, -0.57},
  344. {-1.04, -2.82, 0.14},
  345. {-0.96, -1.66, 0.23},
  346. {1.06, -2.10, 0.09},
  347. {0.00, 0.00, 0.00},
  348. {-0.46, 0.53, -0.79},
  349. {-0.66, -0.71, -0.70},
  350. {-1.07, -2.06, 0.05},
  351. {-1.16, -2.72, -0.21},
  352. {0.00, 0.00, 0.00},
  353. {-1.24, -1.76, 0.03},
  354. {-1.09, -1.99, 0.06},
  355. {-1.03, -2.14, 0.08},
  356. {-1.02, -2.43, -0.14},
  357. {-0.93, -0.41, -0.19},
  358. {-1.13, -1.90, -0.28},
  359. {-1.11, -0.54, -0.10},
  360. {0.00, 0.00, 0.00},
  361. {-1.00, -2.16, 0.06},
  362. {-1.27, -3.18, -0.18},
  363. {-1.01, -2.65, -0.56},
  364. {0.00, 0.00, 0.00},
  365. {0.00, 0.00, 0.00},
  366. {-1.32, -5.47, -0.12},
  367. {0.00, 0.00, 0.00},
  368. {-1.51, 0.15, -0.67},
  369. {0.00, 0.00, 0.00},
  370. {0.00, 0.00, 0.00},
  371. {-1.02, -1.81, 0.16},
  372. {-1.24, -4.98, -0.51},
  373. {-1.06, -1.93, -0.00},
  374. {-1.07, -1.50, 0.07},
  375. {-0.89, -0.47, -0.46},
  376. {0.00, 0.00, 0.00},
  377. {-1.17, -2.20, 0.08},
  378. {-1.24, 1.25, -0.91},
  379. {0.00, 0.00, 0.00},
  380. {-1.07, -1.95, 0.13},
  381. {0.00, 0.00, 0.00},
  382. {0.00, 0.00, 0.00},
  383. {0.00, 0.00, 0.00},
  384. {0.00, 0.00, 0.00},
  385. {0.00, 0.00, 0.00},
  386. {1.08, -1.21, -0.03},
  387. {0.00, 0.00, 0.00},
  388. {0.00, 0.00, 0.00},
  389. {0.00, 0.00, 0.00},
  390. {-1.52, 0.00, -0.74},
  391. {0.73, -0.05, -0.59},
  392. {0.00, 0.00, 0.00},
  393. {-1.11, -2.04, -0.09},
  394. {-0.97, -2.30, 0.21},
  395. {0.00, 0.00, 0.00},
  396. {0.00, 0.00, 0.00},
  397. {0.00, 0.00, 0.00},
  398. {-0.25, 0.20, -0.17},
  399. {0.00, 0.00, 0.00},
  400. {0.00, 0.00, 0.00},
  401. {0.00, 0.00, 0.00},
  402. {-0.92, -2.30, 0.08},
  403. {-0.07, 0.17, 0.69},
  404. {0.00, 0.00, 0.00},
  405. {-1.17, -2.37, 0.24},
  406. {0.00, 0.00, 0.00},
  407. {0.00, 0.00, 0.00},
  408. {0.00, 0.00, 0.00},
  409. {0.00, 0.00, 0.00},
  410. {-1.09, -1.60, 0.13},
  411. {0.00, 0.00, 0.00},
  412. {-1.03, -1.52, 0.15},
  413. {1.01, -0.33, 0.23},
  414. {-1.09, -1.98, 0.09},
  415. {-1.12, -0.88, 0.14},
  416. {0.00, 0.00, 0.00},
  417. {1.03, -2.26, 0.00},
  418. {0.80, -2.50, -0.05},
  419. {0.00, 0.00, 0.00},
  420. {-0.88, 0.71, 0.03},
  421. {-0.66, -3.17, 0.58},
  422. {0.00, 0.00, 0.00},
  423. {0.00, 0.00, 0.00},
  424. {1.22, -0.74, 0.02},
  425. {0.00, 0.00, 0.00},
  426. {-1.05, -2.18, 0.02},
  427. {-1.07, -2.09, 0.17},
  428. {0.00, 0.00, 0.00},
  429. {-1.00, -2.20, 0.14},
  430. {1.16, -1.91, -0.11},
  431. {1.08, -1.83, 0.15},
  432. {0.00, 0.00, 0.00},
  433. {-1.21, -0.01, 0.09},
  434. {-1.19, -1.09, -0.31},
  435. {-0.91, -1.70, -0.06},
  436. {0.00, 0.00, 0.00},
  437. {-0.96, -1.88, 0.13},
  438. {-0.98, -2.03, 0.04},
  439. {-1.14, -1.82, 0.13},
  440. {1.22, -0.74, 0.00},
  441. {0.96, -1.11, -0.11},
  442. {-1.08, -2.30, 0.08},
  443. {-1.35, -3.05, -0.67},
  444. {0.00, 0.00, 0.00},
  445. {0.00, 0.00, 0.00},
  446. {0.00, 0.00, 0.00},
  447. {0.00, 0.00, 0.00},
  448. {0.00, 0.00, 0.00},
  449. {-1.50, -0.88, -0.24},
  450. {-1.08, 0.51, -1.43},
  451. {-1.13, -2.44, -0.01},
  452. {-1.11, -1.95, 0.08},
  453. {1.09, -2.19, -0.08},
  454. {0.00, 0.00, 0.00},
  455. {0.00, 0.00, 0.00},
  456. {-0.17, 0.13, 0.52},
  457. {-0.14, 0.18, 0.53},
  458. {-0.18, 0.24, 0.49},
  459. {1.24, 0.46, -1.06},
  460. {-1.31, -0.50, -0.07},
  461. {-0.94, -1.94, 0.05},
  462. {-1.13, -1.70, 0.16},
  463. {-0.51, -2.07, 0.01},
  464. {-1.15, -2.20, 0.22},
  465. {0.00, 0.00, 0.00},
  466. {0.00, 0.00, 0.00},
  467. {0.00, -2.43, -0.91},
  468. {0.91, -1.97, 0.11},
  469. {-1.01, -0.83, -0.20},
  470. {-1.13, -0.55, 0.28},
  471. {-0.98, -1.69, 0.06},
  472. {0.00, 0.00, 0.00},
  473. {0.00, 0.00, 0.00},
  474. {0.00, 0.00, 0.00},
  475. {-1.23, -2.51, -0.03},
  476. {0.00, 0.00, 0.00},
  477. {-0.97, -1.92, 0.31},
  478. {-0.96, -0.94, -0.01},
  479. {-1.15, 2.04, 0.32},
  480. {0.00, 0.00, 0.00},
  481. {1.22, -1.99, 0.16},
  482. {-1.09, -2.00, 0.13},
  483. {0.00, 0.00, 0.00},
  484. {-0.89, -1.14, 0.18},
  485. {-1.10, -2.40, -0.02},
  486. {-1.03, -2.66, 0.07},
  487. {-0.95, -0.94, 0.45},
  488. {0.00, 0.00, 0.00},
  489. {1.27, -2.37, 0.13},
  490. {-0.80, -1.47, 0.17},
  491. {0.00, 0.00, 0.00},
  492. {0.00, 0.00, 0.00},
  493. {-0.84, -1.92, 0.23},
  494. {-1.01, -1.76, 0.25},
  495. {0.98, -1.83, 0.20},
  496. {1.13, -2.28, 0.11},
  497. {0.93, -0.71, 0.05},
  498. {0.00, 0.00, 0.00},
  499. {0.00, 0.00, 0.00},
  500. {0.95, -0.86, 0.09},
  501. {1.18, -2.26, 0.06},
  502. {0.00, 0.00, 0.00},
  503. {0.00, 0.00, 0.00},
  504. {0.00, 0.00, 0.00},
  505. {0.00, 0.00, 0.00},
  506. {0.62, -0.37, 0.46},
  507. {-0.35, -1.03, 0.24},
  508. {0.00, 0.00, 0.00},
  509. {-0.59, -0.94, 0.26},
  510. {0.00, 0.00, 0.00},
  511. {0.00, 0.00, 0.00},
  512. {0.00, 0.00, 0.00},
  513. {-1.33, 2.89, -0.02},
  514. {1.13, -2.29, 0.16},
  515. {1.23, -1.77, 0.29},
  516. {-0.22, 0.01, 0.54},
  517. {-0.90, 0.15, -0.32},
  518. {-0.62, 0.37, -0.12},
  519. {0.00, 0.00, 0.00},
  520. {1.07, -2.29, 0.20},
  521. {0.00, 0.00, 0.00},
  522. {-1.22, -1.21, 0.12},
  523. {-1.20, -2.12, 0.23},
  524. {0.98, -0.89, 0.10},
  525. {0.00, 0.00, 0.00},
  526. {0.00, 0.00, 0.00},
  527. {0.00, 0.00, 0.00},
  528. {0.00, 0.00, 0.00},
  529. {0.00, 0.00, 0.00},
  530. {0.00, 0.00, 0.00},
  531. {-0.97, -2.16, 0.06},
  532. {-1.02, -2.16, 0.07},
  533. {-1.08, -1.95, 0.18},
  534. {0.00, 0.00, 0.00},
  535. {0.95, -2.01, 0.06},
  536. {-1.36, -1.69, 0.92},
  537. {0.97, -1.95, 0.08},
  538. {1.24, -2.20, -0.04},
  539. {0.00, 0.00, 0.00},
  540. {-0.95, -0.93, -0.02},
  541. {0.00, 0.00, 0.00},
  542. {0.00, 0.00, 0.00},
  543. {0.00, 0.00 ,0.00},
  544. {-1.26, -0.03, 0.09},
  545. {0.00, 0.00, 0.00},
  546. {0.00, 0.00, 0.00}
  547. };
  548.  
  549. stock static const gVehicleTempDataColors[MAX_VEHICLE_MODELS][] =
  550. {
  551. {16, 004, 001, 123, 001, 113, 001, 101, 001, 075, 001, 062, 001, 040, 001, 036, 001},
  552. {16, 041, 041, 047, 047, 052, 052, 066, 066, 074, 074, 087, 087, 091, 091, 113, 113},
  553. {16, 010, 010, 013, 013, 022, 022, 030, 030, 039, 039, 090, 090, 098, 098, 110, 110},
  554. {16, 036, 001, 037, 001, 030, 001, 028, 001, 025, 001, 040, 001, 101, 001, 113, 001},
  555. {16, 113, 039, 119, 050, 123, 092, 109, 100, 101, 101, 095, 105, 083, 110, 066, 025},
  556. {16, 011, 001, 024, 001, 036, 001, 040, 001, 075, 001, 091, 001, 123, 001, 004, 001},
  557. {2, 001, 001},
  558. {2, 003, 001},
  559. {2, 026, 026},
  560. {2, 001, 001},
  561. {16, 004, 001, 009, 001, 010, 001, 025, 001, 036, 001, 040, 001, 045, 001, 084, 001},
  562. {16, 012, 001, 064, 001, 123, 001, 116, 001, 112, 001, 106, 001, 080, 001, 075, 001},
  563. {16, 009, 001, 010, 008, 011, 001, 025, 008, 027, 001, 029, 008, 030, 001, 037, 008},
  564. {16, 087, 001, 088, 001, 091, 001, 105, 001, 109, 001, 119, 001, 004, 001, 025, 001},
  565. {16, 025, 001, 028, 001, 043, 001, 067, 001, 072, 001, 009, 001, 095, 001, 024, 001},
  566. {16, 020, 001, 025, 001, 036, 001, 040, 001, 062, 001, 075, 001, 092, 001, 000, 001},
  567. {2, 001, 003},
  568. {0, 000, 000},
  569. {16, 119, 119, 117, 227, 114, 114, 108, 108, 095, 095, 081, 081, 061, 061, 041, 041},
  570. {16, 045, 075, 047, 076, 033, 075, 013, 076, 054, 075, 069, 076, 059, 075, 087, 076},
  571. {2, 006, 001},
  572. {16, 004, 001, 013, 001, 025, 001, 030, 001, 036, 001, 040, 001, 075, 001, 095, 001},
  573. {14, 096, 025, 097, 025, 101, 025, 111, 031, 113, 036, 083, 057, 067, 059},
  574. {12, 001, 016, 001, 056, 001, 017, 001, 053, 001, 005, 001, 035},
  575. {16, 001, 000, 002, 002, 003, 002, 003, 006, 006, 016, 015, 030, 024, 053, 035, 061},
  576. {2, 043, 000},
  577. {16, 037, 037, 042, 042, 053, 053, 062, 062, 007, 007, 010, 010, 011, 011, 015, 015},
  578. {2, 000, 001},
  579. {2, 004, 075},
  580. {16, 012, 012, 013, 013, 014, 014, 001, 002, 002, 001, 001, 003, 003, 001, 010, 010},
  581. {2, 046, 026},
  582. {16, 071, 059, 075, 059, 092, 072, 047, 074, 055, 083, 059, 083, 071, 087, 082, 087},
  583. {2, 043, 000},
  584. {2, 043, 000},
  585. {14, 001, 001, 012, 012, 002, 002, 006, 006, 004, 004, 046, 046, 053, 053},
  586. {2, 001, 001},
  587. {14, 083, 001, 087, 001, 092, 001, 095, 001, 109, 001, 119, 045, 011, 001},
  588. {16, 054, 007, 079, 007, 087, 007, 095, 016, 098, 020, 105, 020, 123, 020, 125, 021},
  589. {2, 006, 076},
  590. {16, 057, 008, 008, 017, 043, 021, 054, 038, 067, 008, 037, 078, 065, 079, 025, 078},
  591. {16, 034, 034, 032, 032, 020, 020, 110, 110, 066, 066, 084, 084, 118, 118, 121, 121},
  592. {16, 002, 096, 079, 042, 082, 054, 067, 086, 126, 096, 070, 096, 110, 054, 067, 098},
  593. {16, 000, 000, 011, 105, 025, 109, 036, 000, 040, 036, 075, 036, 000, 036, 000, 109},
  594. {16, 004, 001, 020, 001, 024, 001, 025, 001, 036, 001, 040, 001, 054, 001, 084, 001},
  595. {12, 032, 036, 032, 042, 032, 053, 032, 066, 032, 014, 032, 032},
  596. {16, 034, 034, 035, 035, 037, 037, 039, 039, 041, 041, 043, 043, 045, 045, 047, 047},
  597. {32, 000, 000, 000, 001, 001, 005, 001, 001, 003, 003, 000, 001, 001, 022, 001, 001, 001, 035, 001, 001, 001, 044, 001, 001, 001, 053, 001, 001, 001, 057, 001, 001},
  598. {2, 075, 002},
  599. {2, 001, 003},
  600. {2, 001, 074},
  601. {2, 001, 001},
  602. {16, 123, 123, 125, 125, 036, 036, 016, 016, 018, 018, 046, 046, 061, 061, 075, 075},
  603. {16, 001, 003, 001, 005, 001, 016, 001, 022, 001, 035, 001, 044, 001, 053, 001, 057},
  604. {2, 056, 056},
  605. {2, 026, 026},
  606. {16, 084, 015, 084, 058, 084, 031, 032, 074, 043, 031, 001, 031, 077, 031, 032, 074},
  607. {16, 084, 063, 091, 063, 102, 065, 105, 072, 110, 093, 121, 093, 012, 095, 023, 001},
  608. {16, 058, 001, 002, 001, 063, 001, 018, 001, 032, 001, 045, 001, 013, 001, 034, 001},
  609. {16, 091, 001, 101, 001, 109, 001, 113, 001, 004, 001, 025, 001, 030, 001, 036, 001},
  610. {16, 026, 026, 028, 028, 044, 044, 051, 051, 057, 057, 072, 072, 106, 106, 112, 112},
  611. {16, 001, 003, 001, 009, 001, 018, 001, 030, 017, 023, 046, 023, 046, 032, 057, 034},
  612. {16, 036, 001, 037, 001, 043, 001, 053, 001, 061, 001, 075, 001, 079, 001, 088, 001},
  613. {16, 012, 012, 013, 013, 014, 014, 001, 002, 002, 001, 001, 003, 003, 001, 010, 010},
  614. {16, 079, 079, 084, 084, 007, 007, 011, 011, 019, 019, 022, 022, 036, 036, 053, 053},
  615. {2, 014, 075},
  616. {2, 014, 075},
  617. {16, 067, 076, 068, 076, 078, 076, 002, 076, 016, 076, 018, 076, 025, 076, 045, 088},
  618. {16, 051, 001, 058, 008, 060, 001, 068, 008, 002, 001, 013, 008, 022, 001, 036, 008},
  619. {8, 006, 006, 046, 046, 053, 053, 003, 003},
  620. {0, 000, 000},
  621. {2, 043, 000},
  622. {16, 120, 117, 103, 111, 120, 114, 074, 091, 120, 112, 074, 083, 120, 113, 066, 071},
  623. {4, 056, 015, 056, 053},
  624. {4, 056, 015, 056, 053},
  625. {16, 097, 001, 081, 001, 105, 001, 110, 001, 091, 001, 074, 001, 084, 001, 083, 001},
  626. {16, 002, 039, 009, 039, 017, 001, 021, 001, 033, 000, 037, 000, 041, 029, 056, 029},
  627. {16, 006, 007, 007, 006, 001, 006, 089, 091, 119, 117, 103, 102, 077, 087, 071, 077},
  628. {16, 092, 001, 094, 001, 101, 001, 121, 001, 000, 001, 022, 001, 036, 001, 075, 001},
  629. {16, 072, 001, 066, 001, 059, 001, 045, 001, 040, 001, 039, 001, 035, 001, 020, 001},
  630. {16, 027, 036, 059, 036, 060, 035, 055, 041, 054, 031, 049, 023, 045, 032, 040, 029},
  631. {14, 073, 045, 012, 012, 002, 002, 006, 006, 004, 004, 046, 046, 053, 053},
  632. {16, 001, 001, 003, 003, 006, 006, 046, 046, 065, 009, 014, 001, 012, 009, 026, 001},
  633. {16, 041, 041, 048, 048, 052, 052, 064, 064, 071, 071, 085, 085, 010, 010, 062, 062},
  634. {32, 001, 031, 001, 000, 001, 031, 001, 000, 001, 020, 003, 000, 001, 005, 000, 000, 000, 006, 003, 000, 003, 006, 003, 000, 016, 000, 008, 000, 017, 000, 120, 000},
  635. {8, 012, 035, 050, 032, 040, 026, 066, 036},
  636. {14, 001, 073, 001, 074, 001, 075, 001, 076, 001, 077, 001, 078, 001, 079},
  637. {2, 001, 001},
  638. {16, 026, 014, 029, 042, 026, 057, 054, 029, 026, 003, 003, 029, 012, 039, 074, 035},
  639. {4, 002, 026, 002, 029},
  640. {12, 013, 118, 014, 123, 120, 123, 112, 120, 084, 110, 076, 102},
  641. {2, 000, 000},
  642. {12, 040, 065, 071, 072, 052, 066, 064, 072, 030, 072, 060, 072},
  643. {16, 030, 026, 077, 026, 081, 027, 024, 055, 028, 056, 049, 059, 052, 069, 071, 107},
  644. {2, 036, 013},
  645. {16, 007, 094, 036, 088, 051, 075, 053, 075, 058, 067, 075, 067, 075, 061, 079, 062},
  646. {16, 123, 124, 119, 122, 118, 117, 116, 115, 114, 108, 101, 106, 088, 099, 005, 006},
  647. {16, 074, 072, 066, 072, 053, 056, 037, 019, 022, 022, 020, 020, 009, 014, 000, 000},
  648. {2, 000, 001},
  649. {16, 011, 123, 013, 120, 020, 117, 024, 112, 027, 107, 036, 105, 037, 107, 043, 093},
  650. {16, 109, 025, 109, 032, 112, 032, 010, 032, 030, 044, 032, 052, 084, 066, 084, 069},
  651. {16, 075, 084, 040, 084, 040, 110, 028, 119, 025, 119, 021, 119, 013, 119, 004, 119},
  652. {2, 014, 075},
  653. {16, 083, 066, 087, 074, 087, 075, 098, 083, 101, 100, 103, 101, 117, 116, 123, 036},
  654. {16, 036, 117, 036, 013, 042, 030, 042, 033, 054, 036, 075, 079, 092, 101, 098, 109},
  655. {16, 051, 039, 057, 038, 045, 029, 034, 009, 065, 009, 014, 001, 012, 009, 026, 001},
  656. {12, 013, 118, 014, 123, 120, 123, 112, 120, 084, 110, 076, 102},
  657. {10, 003, 003, 006, 006, 007, 007, 052, 052, 076, 076},
  658. {16, 037, 037, 042, 042, 053, 053, 062, 062, 007, 007, 010, 010, 011, 011, 015, 015},
  659. {2, 001, 001},
  660. {16, 007, 001, 074, 001, 061, 001, 016, 001, 025, 001, 030, 001, 036, 001, 053, 001},
  661. {16, 043, 043, 046, 046, 039, 039, 028, 028, 016, 016, 006, 006, 005, 005, 002, 002},
  662. {16, 003, 090, 004, 090, 007, 068, 008, 066, 012, 060, 027, 097, 034, 051, 037, 051},
  663. {16, 017, 039, 015, 123, 032, 112, 045, 088, 052, 071, 057, 067, 061, 096, 096, 096},
  664. {16, 038, 051, 021, 036, 021, 034, 030, 034, 054, 034, 055, 020, 048, 018, 051, 006},
  665. {16, 010, 001, 025, 001, 028, 001, 036, 001, 040, 001, 054, 001, 075, 001, 113, 001},
  666. {16, 013, 076, 024, 077, 063, 078, 042, 076, 054, 077, 039, 078, 011, 076, 062, 077},
  667. {16, 116, 001, 119, 001, 122, 001, 004, 001, 009, 001, 024, 001, 027, 001, 036, 001},
  668. {16, 037, 036, 036, 036, 040, 036, 043, 041, 047, 041, 051, 072, 054, 075, 055, 084},
  669. {16, 002, 039, 009, 039, 017, 001, 021, 001, 033, 000, 037, 000, 041, 029, 056, 029},
  670. {2, 001, 001},
  671. {0, 000, 000},
  672. {16, 074, 074, 075, 013, 087, 118, 092, 003, 115, 118, 025, 118, 036, 000, 118, 118},
  673. {16, 003, 003, 003, 008, 006, 025, 007, 079, 008, 082, 036, 105, 039, 106, 051, 118},
  674. {0, 000, 000},
  675. {32, 060, 024, 023, 000, 061, 027, 123, 000, 065, 031, 031, 000, 061, 061, 030, 000, 081, 035, 023, 000, 062, 061, 062, 000, 083, 066, 064, 000, 083, 064, 064, 000},
  676. {14, 001, 001, 017, 020, 018, 020, 022, 030, 036, 043, 044, 051, 052, 054},
  677. {16, 002, 039, 009, 039, 017, 001, 021, 001, 033, 000, 037, 000, 041, 029, 056, 029},
  678. {16, 052, 001, 053, 001, 066, 001, 075, 001, 076, 001, 081, 001, 095, 001, 109, 001},
  679. {0, 000, 000},
  680. {16, 037, 037, 042, 042, 053, 053, 062, 062, 007, 007, 010, 010, 011, 011, 015, 015},
  681. {16, 110, 001, 111, 001, 112, 001, 114, 001, 119, 001, 122, 001, 004, 001, 013, 001},
  682. {12, 002, 035, 036, 002, 051, 053, 091, 002, 011, 022, 040, 035},
  683. {0, 000, 000},
  684. {16, 073, 001, 074, 001, 075, 001, 077, 001, 079, 001, 083, 001, 084, 001, 091, 001},
  685. {16, 037, 037, 042, 042, 053, 053, 062, 062, 007, 007, 010, 010, 011, 011, 015, 015},
  686. {16, 003, 001, 028, 001, 031, 001, 055, 001, 066, 001, 097, 001, 123, 001, 118, 001},
  687. {16, 009, 001, 012, 001, 026, 096, 030, 096, 032, 001, 037, 001, 057, 096, 071, 096},
  688. {2, 001, 001},
  689. {2, 001, 001},
  690. {14, 096, 067, 086, 070, 079, 074, 070, 086, 061, 098, 075, 075, 075, 091},
  691. {16, 037, 037, 042, 042, 053, 053, 062, 062, 007, 007, 010, 010, 011, 011, 015, 015},
  692. {16, 051, 001, 058, 008, 060, 001, 068, 008, 002, 001, 013, 008, 022, 001, 036, 008},
  693. {16, 013, 118, 024, 118, 031, 093, 032, 092, 045, 092, 113, 092, 119, 113, 122, 113},
  694. {16, 076, 008, 032, 008, 043, 008, 067, 008, 011, 011, 008, 090, 002, 002, 083, 013},
  695. {2, 003, 001},
  696. {16, 050, 001, 047, 001, 044, 096, 040, 096, 039, 001, 030, 001, 028, 096, 009, 096},
  697. {16, 062, 037, 078, 038, 002, 062, 003, 087, 002, 078, 113, 078, 119, 062, 007, 078},
  698. {16, 122, 001, 123, 001, 125, 001, 010, 001, 024, 001, 037, 001, 055, 001, 066, 001},
  699. {2, 001, 001},
  700. {16, 074, 039, 072, 039, 075, 039, 079, 039, 083, 036, 084, 036, 089, 035, 091, 035},
  701. {16, 037, 037, 042, 042, 053, 053, 062, 062, 007, 007, 010, 010, 011, 011, 015, 015},
  702. {16, 067, 001, 072, 001, 075, 001, 083, 001, 091, 001, 101, 001, 109, 001, 020, 001},
  703. {6, 056, 056, 049, 049, 026, 124},
  704. {16, 038, 009, 055, 023, 061, 074, 071, 087, 091, 087, 098, 114, 102, 119, 111, 003},
  705. {16, 053, 032, 015, 032, 045, 032, 034, 030, 065, 032, 014, 032, 012, 032, 043, 032},
  706. {16, 051, 001, 058, 001, 060, 001, 068, 001, 002, 001, 013, 001, 022, 001, 036, 001},
  707. {2, 001, 001},
  708. {2, 001, 001},
  709. {16, 112, 001, 116, 001, 117, 001, 024, 001, 030, 001, 035, 001, 036, 001, 040, 001},
  710. {16, 051, 001, 058, 008, 060, 001, 068, 008, 002, 001, 013, 008, 022, 001, 036, 008},
  711. {16, 052, 039, 009, 039, 017, 001, 021, 001, 033, 000, 037, 000, 041, 029, 056, 029},
  712. {16, 057, 008, 008, 017, 043, 021, 054, 038, 067, 008, 037, 078, 065, 079, 025, 078},
  713. {16, 036, 001, 035, 001, 017, 001, 011, 001, 116, 001, 113, 001, 101, 001, 092, 001},
  714. {2, 001, 006},
  715. {0, 000, 000},
  716. {16, 037, 037, 042, 042, 053, 053, 062, 062, 007, 007, 010, 010, 011, 011, 015, 015},
  717. {16, 109, 001, 030, 008, 095, 001, 084, 008, 083, 001, 072, 008, 071, 001, 052, 008},
  718. {16, 097, 096, 088, 064, 090, 096, 093, 064, 097, 096, 099, 081, 102, 114, 114, 001},
  719. {16, 002, 039, 009, 039, 017, 001, 021, 001, 033, 000, 037, 000, 041, 029, 056, 029},
  720. {0, 000, 000},
  721. {2, 001, 001},
  722. {12, 002, 035, 036, 002, 051, 053, 091, 002, 011, 022, 040, 035},
  723. {16, 094, 001, 101, 001, 116, 001, 117, 001, 004, 001, 025, 001, 030, 001, 037, 001},
  724. {16, 091, 038, 115, 043, 085, 006, 079, 007, 078, 008, 077, 018, 079, 018, 086, 024},
  725. {2, 026, 026},
  726. {16, 012, 001, 019, 096, 031, 064, 025, 096, 038, 001, 051, 096, 057, 001, 066, 096},
  727. {16, 067, 001, 068, 096, 072, 001, 074, 008, 075, 096, 076, 008, 079, 001, 084, 096},
  728. {12, 001, 003, 008, 007, 008, 010, 008, 016, 023, 031, 040, 044},
  729. {2, 001, 001},
  730. {16, 037, 037, 042, 042, 053, 053, 062, 062, 007, 007, 010, 010, 011, 011, 015, 015},
  731. {18, 092, 092, 081, 081, 067, 067, 066, 066, 061, 061, 053, 053, 051, 051, 047, 047, 043, 043},
  732. {16, 054, 001, 058, 001, 066, 001, 072, 001, 075, 001, 087, 001, 101, 001, 036, 001},
  733. {16, 041, 010, 041, 020, 049, 011, 056, 123, 110, 113, 112, 116, 114, 118, 119, 101},
  734. {2, 001, 001},
  735. {2, 001, 001},
  736. {16, 037, 037, 042, 042, 053, 053, 062, 062, 007, 007, 010, 010, 011, 011, 015, 015},
  737. {16, 119, 001, 122, 001, 008, 001, 010, 001, 013, 001, 025, 001, 027, 001, 032, 001},
  738. {16, 036, 001, 040, 001, 043, 001, 053, 001, 072, 001, 075, 001, 095, 001, 101, 001},
  739. {2, 001, 001},
  740. {16, 037, 037, 031, 031, 023, 023, 022, 022, 007, 007, 124, 124, 114, 114, 112, 112},
  741. {0, 000, 000},
  742. {2, 001, 001},
  743. {2, 001, 001},
  744. {16, 051, 001, 058, 008, 060, 001, 068, 008, 002, 001, 013, 008, 022, 001, 036, 008},
  745. {0, 000, 000},
  746. {2, 112, 020},
  747. {2, 000, 001},
  748. {2, 000, 001},
  749. {2, 000, 001},
  750. {2, 000, 001},
  751. {16, 081, 008, 032, 008, 043, 008, 067, 008, 011, 011, 008, 090, 002, 002, 083, 013},
  752. {2, 001, 001},
  753. {16, 058, 001, 069, 001, 075, 077, 018, 001, 032, 001, 045, 045, 013, 001, 034, 001},
  754. {16, 058, 001, 069, 001, 075, 077, 018, 001, 032, 001, 045, 045, 013, 001, 034, 001},
  755. {16, 067, 076, 068, 076, 078, 076, 002, 076, 016, 076, 018, 076, 025, 076, 045, 088},
  756. {16, 061, 008, 032, 008, 043, 008, 067, 008, 011, 011, 008, 090, 002, 002, 083, 013},
  757. {0, 000, 000},
  758. {0, 000, 000},
  759. {2, 001, 001},
  760. {2, 036, 036},
  761. {0, 000, 000},
  762. {0, 000, 000}
  763. };
  764.  
  765. stock static const gVehicleTempDataTopSpeed[MAX_VEHICLE_MODELS] =
  766. {
  767. 157,
  768. 147,
  769. 186,
  770. 110,
  771. 133,
  772. 164,
  773. 110,
  774. 148,
  775. 100,
  776. 158,
  777. 129,
  778. 221,
  779. 168,
  780. 110,
  781. 105,
  782. 192,
  783. 154,
  784. 270,
  785. 115,
  786. 149,
  787. 145,
  788. 154,
  789. 140,
  790. 99,
  791. 135,
  792. 270,
  793. 173,
  794. 165,
  795. 157,
  796. 201,
  797. 190,
  798. 130,
  799. 94,
  800. 110,
  801. 167,
  802. 0,
  803. 149,
  804. 158,
  805. 142,
  806. 168,
  807. 136,
  808. 145,
  809. 139,
  810. 126,
  811. 110,
  812. 164,
  813. 270,
  814. 270,
  815. 111,
  816. 0,
  817. 0,
  818. 193,
  819. 270,
  820. 60,
  821. 135,
  822. 157,
  823. 106,
  824. 95,
  825. 157,
  826. 136,
  827. 270,
  828. 160,
  829. 111,
  830. 142,
  831. 145,
  832. 145,
  833. 147,
  834. 140,
  835. 144,
  836. 270,
  837. 157,
  838. 110,
  839. 190,
  840. 190,
  841. 149,
  842. 173,
  843. 270,
  844. 186,
  845. 117,
  846. 140,
  847. 184,
  848. 73,
  849. 156,
  850. 122,
  851. 190,
  852. 99,
  853. 64,
  854. 270,
  855. 270,
  856. 139,
  857. 157,
  858. 149,
  859. 140,
  860. 270,
  861. 214,
  862. 176,
  863. 162,
  864. 270,
  865. 108,
  866. 123,
  867. 140,
  868. 145,
  869. 216,
  870. 216,
  871. 173,
  872. 140,
  873. 179,
  874. 166,
  875. 108,
  876. 79,
  877. 101,
  878. 270,
  879. 270,
  880. 270,
  881. 120,
  882. 142,
  883. 157,
  884. 157,
  885. 164,
  886. 270,
  887. 270,
  888. 160,
  889. 176,
  890. 151,
  891. 130,
  892. 160,
  893. 158,
  894. 149,
  895. 176,
  896. 149,
  897. 60,
  898. 70,
  899. 110,
  900. 167,
  901. 168,
  902. 158,
  903. 173,
  904. 0,
  905. 0,
  906. 270,
  907. 149,
  908. 203,
  909. 164,
  910. 151,
  911. 150,
  912. 147,
  913. 149,
  914. 142,
  915. 270,
  916. 153,
  917. 145,
  918. 157,
  919. 121,
  920. 270,
  921. 144,
  922. 158,
  923. 113,
  924. 113,
  925. 156,
  926. 178,
  927. 169,
  928. 154,
  929. 178,
  930. 270,
  931. 145,
  932. 165,
  933. 160,
  934. 173,
  935. 146,
  936. 0,
  937. 0,
  938. 93,
  939. 60,
  940. 110,
  941. 60,
  942. 158,
  943. 158,
  944. 270,
  945. 130,
  946. 158,
  947. 153,
  948. 151,
  949. 136,
  950. 85,
  951. 0,
  952. 153,
  953. 142,
  954. 165,
  955. 108,
  956. 162,
  957. 0,
  958. 0,
  959. 270,
  960. 270,
  961. 130,
  962. 190,
  963. 175,
  964. 175,
  965. 175,
  966. 158,
  967. 151,
  968. 110,
  969. 169,
  970. 171,
  971. 148,
  972. 152,
  973. 0,
  974. 0,
  975. 0,
  976. 108,
  977. 0,
  978. 0
  979. };
  980.  
  981. #define v_interior 0
  982. #define v_color<%1> (%1 + 1)
  983. #define v_paintjob 3
  984. #define v_horn 4
  985. #define v_damage<%1> (%1 + 5)
  986. #define v_editor 9
  987. #define v_speedcap 10
  988. #define v_spawn<%1> (%1 + 11)
  989. #define v_spawn_interiorid 15
  990. #define v_spawn_worldid 16
  991. #define v_spawn_uno_damage 17
  992. #define v_petrolcap 18
  993. #define v_bomb 19
  994. #define v_bomb_timer 20
  995. #define v_sticky 21
  996. #define v_update_timer 22
  997.  
  998. stock static Vehicle_SetPropertyInt(vehicleid, type, set)
  999. {
  1000. new string[35];
  1001. switch(type)
  1002. {
  1003. case v_interior: format(string, sizeof(string), "%i_v_interior", vehicleid);
  1004. case v_color<0>: format(string, sizeof(string), "%i_v_color_1", vehicleid);
  1005. case v_color<1>: format(string, sizeof(string), "%i_v_color_2", vehicleid);
  1006. case v_paintjob: format(string, sizeof(string), "%i_v_paintjob", vehicleid);
  1007. case v_horn: format(string, sizeof(string), "%i_v_horn", vehicleid);
  1008. case v_damage<0>: format(string, sizeof(string), "%i_v_damage_1", vehicleid);
  1009. case v_damage<1>: format(string, sizeof(string), "%i_v_damage_2", vehicleid);
  1010. case v_damage<2>: format(string, sizeof(string), "%i_v_damage_3", vehicleid);
  1011. case v_damage<3>: format(string, sizeof(string), "%i_v_damage_4", vehicleid);
  1012. case v_editor: format(string, sizeof(string), "%i_v_editor", vehicleid);
  1013. case v_spawn_interiorid:format(string, sizeof(string), "%i_v_spawn_interiorid", vehicleid);
  1014. case v_spawn_worldid: format(string, sizeof(string), "%i_v_spawn_worldid", vehicleid);
  1015. case v_spawn_uno_damage:format(string, sizeof(string), "%i_v_spawn_uno_damage", vehicleid);
  1016. case v_petrolcap: format(string, sizeof(string), "%i_v_petrolcap", vehicleid);
  1017. case v_bomb: format(string, sizeof(string), "%i_v_bomb", vehicleid);
  1018. case v_bomb_timer: format(string, sizeof(string), "%i_v_bomb_timer", vehicleid);
  1019. case v_sticky: format(string, sizeof(string), "%i_v_sticky", vehicleid);
  1020. case v_update_timer: format(string, sizeof(string), "%i_v_update_timer", vehicleid);
  1021. }
  1022.  
  1023. return setproperty(.name = string, .value = set);
  1024. }
  1025.  
  1026. stock static Vehicle_GetPropertyInt(vehicleid, type)
  1027. {
  1028. new string[35];
  1029. switch(type)
  1030. {
  1031. case v_interior: format(string, sizeof(string), "%i_v_interior", vehicleid);
  1032. case v_color<0>: format(string, sizeof(string), "%i_v_color_1", vehicleid);
  1033. case v_color<1>: format(string, sizeof(string), "%i_v_color_2", vehicleid);
  1034. case v_paintjob: format(string, sizeof(string), "%i_v_paintjob", vehicleid);
  1035. case v_horn: format(string, sizeof(string), "%i_v_horn", vehicleid);
  1036. case v_damage<0>: format(string, sizeof(string), "%i_v_damage_1", vehicleid);
  1037. case v_damage<1>: format(string, sizeof(string), "%i_v_damage_2", vehicleid);
  1038. case v_damage<2>: format(string, sizeof(string), "%i_v_damage_3", vehicleid);
  1039. case v_damage<3>: format(string, sizeof(string), "%i_v_damage_4", vehicleid);
  1040. case v_editor: format(string, sizeof(string), "%i_v_editor", vehicleid);
  1041. case v_spawn_interiorid:format(string, sizeof(string), "%i_v_spawn_interiorid", vehicleid);
  1042. case v_spawn_worldid: format(string, sizeof(string), "%i_v_spawn_worldid", vehicleid);
  1043. case v_spawn_uno_damage:format(string, sizeof(string), "%i_v_spawn_uno_damage", vehicleid);
  1044. case v_petrolcap: format(string, sizeof(string), "%i_v_petrolcap", vehicleid);
  1045. case v_bomb: format(string, sizeof(string), "%i_v_bomb", vehicleid);
  1046. case v_bomb_timer: format(string, sizeof(string), "%i_v_bomb_timer", vehicleid);
  1047. case v_sticky: format(string, sizeof(string), "%i_v_sticky", vehicleid);
  1048. case v_update_timer: format(string, sizeof(string), "%i_v_update_timer", vehicleid);
  1049. }
  1050.  
  1051. return getproperty(.name = string);
  1052. }
  1053.  
  1054. stock static Vehicle_EncodeString(string[])
  1055. {
  1056. new source[2];
  1057. for(new i, j = strlen(string); i < j; i++)
  1058. {
  1059. source[0] = (source[0] + string[i]) % 65521;
  1060. source[1] = (source[1] + source[0]) % 65521;
  1061. }
  1062. return (source[1] << 16) + source[0];
  1063. }
  1064.  
  1065. stock static Vehicle_SetPropertyFloat(vehicleid, type, Float:set)
  1066. {
  1067. new string[35];
  1068. switch(type)
  1069. {
  1070. case v_speedcap: format(string, sizeof(string), "%i_v_speedcap", vehicleid);
  1071. case v_spawn<0>: format(string, sizeof(string), "%i_v_spawn_x", vehicleid);
  1072. case v_spawn<1>: format(string, sizeof(string), "%i_v_spawn_y", vehicleid);
  1073. case v_spawn<2>: format(string, sizeof(string), "%i_v_spawn_z", vehicleid);
  1074. case v_spawn<3>: format(string, sizeof(string), "%i_v_spawn_rotation", vehicleid);
  1075. }
  1076.  
  1077. new value[8];
  1078. format(value, sizeof(value), "%f", set);
  1079.  
  1080. return setproperty(.value = Vehicle_EncodeString(string), .string = value);
  1081. }
  1082.  
  1083. stock static Float:Vehicle_GetPropertyFloat(vehicleid, type)
  1084. {
  1085. new string[35];
  1086. switch(type)
  1087. {
  1088. case v_speedcap: format(string, sizeof(string), "%i_v_speedcap", vehicleid);
  1089. case v_spawn<0>: format(string, sizeof(string), "%i_v_spawn_x", vehicleid);
  1090. case v_spawn<1>: format(string, sizeof(string), "%i_v_spawn_y", vehicleid);
  1091. case v_spawn<2>: format(string, sizeof(string), "%i_v_spawn_z", vehicleid);
  1092. case v_spawn<3>: format(string, sizeof(string), "%i_v_spawn_rotation", vehicleid);
  1093. }
  1094.  
  1095. new value[8];
  1096. getproperty(.value = Vehicle_EncodeString(string), .string = value);
  1097.  
  1098. return floatstr(value);
  1099. }
  1100.  
  1101. stock static Vehicle_DeleteProperty(vehicleid, type)
  1102. {
  1103. new string[35];
  1104. switch(type)
  1105. {
  1106. case v_interior: format(string, sizeof(string), "%i_v_interior", vehicleid);
  1107. case v_color<0>: format(string, sizeof(string), "%i_v_color_1", vehicleid);
  1108. case v_color<1>: format(string, sizeof(string), "%i_v_color_2", vehicleid);
  1109. case v_paintjob: format(string, sizeof(string), "%i_v_paintjob", vehicleid);
  1110. case v_horn: format(string, sizeof(string), "%i_v_horn", vehicleid);
  1111. case v_damage<0>: format(string, sizeof(string), "%i_v_damage_1", vehicleid);
  1112. case v_damage<1>: format(string, sizeof(string), "%i_v_damage_2", vehicleid);
  1113. case v_damage<2>: format(string, sizeof(string), "%i_v_damage_3", vehicleid);
  1114. case v_damage<3>: format(string, sizeof(string), "%i_v_damage_4", vehicleid);
  1115. case v_editor: format(string, sizeof(string), "%i_v_editor", vehicleid);
  1116. case v_speedcap: format(string, sizeof(string), "%i_v_speedcap", vehicleid);
  1117. case v_spawn<0>:
  1118. {
  1119. format(string, sizeof(string), "%i_v_spawn_x", vehicleid);
  1120. return deleteproperty(.value = Vehicle_EncodeString(string));
  1121. }
  1122. case v_spawn<1>:
  1123. {
  1124. format(string, sizeof(string), "%i_v_spawn_y", vehicleid);
  1125. return deleteproperty(.value = Vehicle_EncodeString(string));
  1126. }
  1127. case v_spawn<2>:
  1128. {
  1129. format(string, sizeof(string), "%i_v_spawn_z", vehicleid);
  1130. return deleteproperty(.value = Vehicle_EncodeString(string));
  1131. }
  1132. case v_spawn<3>:
  1133. {
  1134. format(string, sizeof(string), "%i_v_spawn_rotation", vehicleid);
  1135. return deleteproperty(.value = Vehicle_EncodeString(string));
  1136. }
  1137. case v_spawn<4>: format(string, sizeof(string), "%i_v_spawn_interiorid", vehicleid);
  1138. case v_spawn<5>: format(string, sizeof(string), "%i_v_spawn_worldid", vehicleid);
  1139. case v_spawn_uno_damage:format(string, sizeof(string), "%i_v_spawn_uno_damage", vehicleid);
  1140. case v_petrolcap: format(string, sizeof(string), "%i_v_petrolcap", vehicleid);
  1141. case v_bomb: format(string, sizeof(string), "%i_v_bomb", vehicleid);
  1142. case v_bomb_timer: format(string, sizeof(string), "%i_v_bomb_timer", vehicleid);
  1143. case v_sticky: format(string, sizeof(string), "%i_v_sticky", vehicleid);
  1144. case v_update_timer:format(string, sizeof(string), "%i_v_update_timer", vehicleid);
  1145. }
  1146.  
  1147. return deleteproperty(.name = string);
  1148. }
  1149.  
  1150. stock Vehicle_CreateVehicle(modelid, Float:x, Float:y, Float:z, Float:rotation, color1 = -1, color2 = -1, respawn_delay = -1, addsiren = 0, worldid = 0, interiorid = 0, bool:unoccupied_damage = false)
  1151. {
  1152. if(modelid < 400 || modelid > 610) return false;
  1153.  
  1154. if( (color1 == -1 || color2 == -1) &&
  1155. gVehicleTempDataColors[(modelid - 400)][0])
  1156. {
  1157. if(gVehicleTempDataColors[(modelid - 400)][0] == 2)
  1158. {
  1159. color1 = gVehicleTempDataColors[(modelid - 400)][1];
  1160. color2 = gVehicleTempDataColors[(modelid - 400)][2];
  1161. }
  1162. else
  1163. {
  1164. new index = random(gVehicleTempDataColors[(modelid - 400)][0]) & -2;
  1165.  
  1166. color1 = gVehicleTempDataColors[(modelid - 400)][++index];
  1167. color2 = gVehicleTempDataColors[(modelid - 400)][++index];
  1168. }
  1169. }
  1170.  
  1171. new vehicleid;
  1172. switch(modelid)
  1173. {
  1174. case 569, 570, 537, 538: vehicleid = AddStaticVehicleEx(modelid, x, y, z, rotation, color1, color2, respawn_delay, addsiren);
  1175. default: vehicleid = CreateVehicle(modelid, Float:x, Float:y, Float:z, Float:rotation, color1, color2, respawn_delay, addsiren);
  1176. }
  1177.  
  1178. LinkVehicleToInterior(vehicleid, interiorid);
  1179. SetVehicleVirtualWorld(vehicleid, worldid);
  1180.  
  1181. Vehicle_SetPropertyInt(vehicleid, v_interior, interiorid);
  1182.  
  1183. Vehicle_SetPropertyInt(vehicleid, v_color<0>, color1);
  1184. Vehicle_SetPropertyInt(vehicleid, v_color<1>, color2);
  1185.  
  1186. Vehicle_SetPropertyInt(vehicleid, v_paintjob, 3);
  1187.  
  1188. Vehicle_SetPropertyInt(vehicleid, v_horn, 0);
  1189.  
  1190. for(new i; i < 4; i++)
  1191. {
  1192. Vehicle_SetPropertyInt(vehicleid, v_damage<i>, 1);
  1193. }
  1194.  
  1195. Vehicle_SetPropertyInt(vehicleid, v_editor, INVALID_OBJECT_ID);
  1196.  
  1197. for(new i; i < MAX_VEHICLE_ATTACHED_OBJECTS; i++)
  1198. {
  1199. gVehicleTempData[vehicleid][e_attached_object][i] = INVALID_OBJECT_ID;
  1200. }
  1201.  
  1202. Vehicle_SetPropertyFloat(vehicleid, v_speedcap, 0.0);
  1203.  
  1204. Vehicle_SetPropertyFloat(vehicleid, v_spawn<0>, x);
  1205. Vehicle_SetPropertyFloat(vehicleid, v_spawn<1>, y);
  1206. Vehicle_SetPropertyFloat(vehicleid, v_spawn<2>, z);
  1207. Vehicle_SetPropertyFloat(vehicleid, v_spawn<3>, rotation);
  1208.  
  1209. Vehicle_SetPropertyInt(vehicleid, v_spawn_worldid, worldid);
  1210. Vehicle_SetPropertyInt(vehicleid, v_spawn_interiorid, interiorid);
  1211.  
  1212. Vehicle_SetPropertyInt(vehicleid, v_spawn_uno_damage, _:unoccupied_damage);
  1213.  
  1214. Vehicle_SetPropertyInt(vehicleid, v_petrolcap, 0);
  1215.  
  1216. Vehicle_SetPropertyInt(vehicleid, v_bomb, 0);
  1217. Vehicle_SetPropertyInt(vehicleid, v_bomb_timer, -1);
  1218.  
  1219. Vehicle_SetPropertyInt(vehicleid, v_sticky, 0);
  1220.  
  1221. Vehicle_SetPropertyInt(vehicleid, v_update_timer, -1);
  1222.  
  1223. gVehicleTempData[vehicleid][e_pos_x] = x;
  1224. gVehicleTempData[vehicleid][e_pos_y] = y;
  1225. gVehicleTempData[vehicleid][e_pos_z] = z;
  1226. gVehicleTempData[vehicleid][e_pos_a] = rotation;
  1227.  
  1228. gVehicleTempData[vehicleid][e_vel_x] = 0.0;
  1229. gVehicleTempData[vehicleid][e_vel_y] = 0.0;
  1230. gVehicleTempData[vehicleid][e_vel_z] = 0.0;
  1231.  
  1232. gVehicleTempData[vehicleid][e_health] = 1000.0;
  1233.  
  1234. return vehicleid;
  1235. }
  1236. #if defined _ALS_CreateVehicle
  1237. #undef CreateVehicle
  1238. #else
  1239. #define _ALS_CreateVehicle
  1240. #endif
  1241. #define CreateVehicle Vehicle_CreateVehicle
  1242. //
  1243. #if defined _ALS_AddStaticVehicleEx
  1244. #undef AddStaticVehicleEx
  1245. #else
  1246. #define _ALS_AddStaticVehicleEx
  1247. #endif
  1248. #define AddStaticVehicleEx Vehicle_CreateVehicle
  1249. //
  1250. #if defined _ALS_AddStaticVehicle
  1251. #undef AddStaticVehicle
  1252. #else
  1253. #define _ALS_AddStaticVehicle
  1254. #endif
  1255. #define AddStaticVehicle Vehicle_CreateVehicle
  1256. //
  1257.  
  1258. stock Vehicle_SetVehiclePos(vehicleid, Float:x, Float:y, Float:z)
  1259. {
  1260. if(SetVehiclePos(vehicleid, Float:x, Float:y, Float:z))
  1261. {
  1262. gVehicleTempData[vehicleid][e_pos_x] = x;
  1263. gVehicleTempData[vehicleid][e_pos_y] = y;
  1264. gVehicleTempData[vehicleid][e_pos_z] = z;
  1265. return true;
  1266. }
  1267. return false;
  1268. }
  1269. #if defined _ALS_SetVehiclePos
  1270. #undef SetVehiclePos
  1271. #else
  1272. #define _ALS_SetVehiclePos
  1273. #endif
  1274. #define SetVehiclePos Vehicle_SetVehiclePos
  1275.  
  1276. stock Vehicle_SetVehicleZAngle(vehicleid, Float:angle)
  1277. {
  1278. if(SetVehicleZAngle(vehicleid, angle))
  1279. {
  1280. gVehicleTempData[vehicleid][e_pos_a] = angle;
  1281. return true;
  1282. }
  1283. return false;
  1284. }
  1285. #if defined _ALS_SetVehicleZAngle
  1286. #undef SetVehicleZAngle
  1287. #else
  1288. #define _ALS_SetVehicleZAngle
  1289. #endif
  1290. #define SetVehicleZAngle Vehicle_SetVehicleZAngle
  1291.  
  1292. stock Vehicle_DestroyVehicle(vehicleid)
  1293. {
  1294. if(DestroyVehicle(vehicleid))
  1295. {
  1296. for(new i; i <= GetPlayerPoolSize(); i++)
  1297. {
  1298. if(IsPlayerConnected(i))
  1299. {
  1300. if(gPlayerVehicleEditer[i] == Vehicle_GetPropertyInt(vehicleid, v_editor))
  1301. {
  1302. CancelEdit(i);
  1303. }
  1304. }
  1305. }
  1306. DestroyObject(Vehicle_GetPropertyInt(vehicleid, v_editor));
  1307.  
  1308. Vehicle_DeleteProperty(vehicleid, v_interior);
  1309.  
  1310. Vehicle_DeleteProperty(vehicleid, v_color<0>);
  1311. Vehicle_DeleteProperty(vehicleid, v_color<1>);
  1312.  
  1313. Vehicle_DeleteProperty(vehicleid, v_paintjob);
  1314.  
  1315. Vehicle_DeleteProperty(vehicleid, v_horn);
  1316.  
  1317. Vehicle_DeleteProperty(vehicleid, v_damage<0>);
  1318. Vehicle_DeleteProperty(vehicleid, v_damage<1>);
  1319. Vehicle_DeleteProperty(vehicleid, v_damage<2>);
  1320. Vehicle_DeleteProperty(vehicleid, v_damage<3>);
  1321.  
  1322. Vehicle_DeleteProperty(vehicleid, v_editor);
  1323.  
  1324. for(new i; i < MAX_VEHICLE_ATTACHED_OBJECTS; i++)
  1325. {
  1326. if(IsValidObject(gVehicleTempData[vehicleid][e_attached_object][i]))
  1327. {
  1328. DestroyObject(gVehicleTempData[vehicleid][e_attached_object][i]);
  1329. gVehicleTempData[vehicleid][e_attached_object][i] = INVALID_OBJECT_ID;
  1330. }
  1331. }
  1332.  
  1333. Vehicle_DeleteProperty(vehicleid, v_speedcap);
  1334.  
  1335. Vehicle_DeleteProperty(vehicleid, v_spawn<0>);
  1336. Vehicle_DeleteProperty(vehicleid, v_spawn<1>);
  1337. Vehicle_DeleteProperty(vehicleid, v_spawn<2>);
  1338. Vehicle_DeleteProperty(vehicleid, v_spawn<3>);
  1339.  
  1340. Vehicle_DeleteProperty(vehicleid, v_spawn_worldid);
  1341. Vehicle_DeleteProperty(vehicleid, v_spawn_interiorid);
  1342.  
  1343. Vehicle_DeleteProperty(vehicleid, v_spawn_uno_damage);
  1344.  
  1345. Vehicle_DeleteProperty(vehicleid, v_petrolcap);
  1346.  
  1347. Vehicle_DeleteProperty(vehicleid, v_bomb);
  1348. Vehicle_DeleteProperty(vehicleid, v_bomb_timer);
  1349.  
  1350. Vehicle_DeleteProperty(vehicleid, v_sticky);
  1351.  
  1352. Vehicle_DeleteProperty(vehicleid, v_update_timer);
  1353.  
  1354. vehicleid = INVALID_VEHICLE_ID;
  1355. return true;
  1356. }
  1357. return false;
  1358. }
  1359. #if defined _ALS_DestroyVehicle
  1360. #undef DestroyVehicle
  1361. #else
  1362. #define _ALS_DestroyVehicle
  1363. #endif
  1364. #define DestroyVehicle Vehicle_DestroyVehicle
  1365.  
  1366. stock Vehicle_LinkVehicleToInterior(vehicleid, interiorid)
  1367. {
  1368. if(LinkVehicleToInterior(vehicleid, interiorid))
  1369. {
  1370. Vehicle_SetPropertyInt(vehicleid, v_interior, interiorid);
  1371. return true;
  1372. }
  1373. return false;
  1374. }
  1375. #if defined _ALS_LinkVehicleToInterior
  1376. #undef LinkVehicleToInterior
  1377. #else
  1378. #define _ALS_LinkVehicleToInterior
  1379. #endif
  1380. #define LinkVehicleToInterior Vehicle_LinkVehicleToInterior
  1381. //
  1382. #if ! defined SetVehicleInterior
  1383. #define SetVehicleInterior Vehicle_LinkVehicleToInterior
  1384. #endif
  1385. //
  1386.  
  1387. stock GetVehicleInterior(vehicleid)
  1388. {
  1389. return Vehicle_GetPropertyInt(vehicleid, v_interior);
  1390. }
  1391.  
  1392. stock Vehicle_ChangeVehicleColor(vehicleid, color1, color2)
  1393. {
  1394. new modelid = GetVehicleModel(vehicleid);
  1395.  
  1396. if( (color1 == -1 || color2 == -1) &&
  1397. gVehicleTempDataColors[(modelid - 400)][0])
  1398. {
  1399. if(gVehicleTempDataColors[(modelid - 400)][0] == 2)
  1400. {
  1401. color1 = gVehicleTempDataColors[(modelid - 400)][1];
  1402. color2 = gVehicleTempDataColors[(modelid - 400)][2];
  1403. }
  1404. else
  1405. {
  1406. new index = random(gVehicleTempDataColors[(modelid - 400)][0]) & -2;
  1407.  
  1408. color1 = gVehicleTempDataColors[(modelid - 400)][++index];
  1409. color2 = gVehicleTempDataColors[(modelid - 400)][++index];
  1410. }
  1411. }
  1412.  
  1413. if(ChangeVehicleColor(vehicleid, color1, color2))
  1414. {
  1415. Vehicle_SetPropertyInt(vehicleid, v_color<0>, color1);
  1416. Vehicle_SetPropertyInt(vehicleid, v_color<1>, color2);
  1417. return true;
  1418. }
  1419. return false;
  1420. }
  1421. #if defined _ALS_ChangeVehicleColor
  1422. #undef ChangeVehicleColor
  1423. #else
  1424. #define _ALS_ChangeVehicleColor
  1425. #endif
  1426. #define ChangeVehicleColor Vehicle_ChangeVehicleColor
  1427.  
  1428. #if ! defined SetVehicleColor
  1429. #define SetVehicleColor ChangeVehicleColor
  1430. #endif
  1431.  
  1432. stock GetVehicleColor(vehicleid, &color1, &color2)
  1433. {
  1434. color1 = Vehicle_GetPropertyInt(vehicleid, v_color<0>);
  1435. color2 = Vehicle_GetPropertyInt(vehicleid, v_color<1>);
  1436. return true;
  1437. }
  1438.  
  1439. stock Vehicle_ChangeVehiclePaintjob(vehicleid, paintjobid)
  1440. {
  1441. if(ChangeVehiclePaintjob(vehicleid, paintjobid))
  1442. {
  1443. Vehicle_SetPropertyInt(vehicleid, v_paintjob, paintjobid);
  1444.  
  1445. if(paintjobid == 3)
  1446. {
  1447. new colors[2];
  1448. GetVehicleColor(vehicleid, colors[0], colors[1]);
  1449. ChangeVehicleColor(vehicleid, colors[0], colors[1]);
  1450. }
  1451. return true;
  1452. }
  1453. return false;
  1454. }
  1455. #if defined _ALS_ChangeVehiclePaintjob
  1456. #undef ChangeVehiclePaintjob
  1457. #else
  1458. #define _ALS_ChangeVehiclePaintjob
  1459. #endif
  1460. #define ChangeVehiclePaintjob Vehicle_ChangeVehiclePaintjob
  1461.  
  1462. #if ! defined SetVehiclePaintjob
  1463. #define SetVehiclePaintjob Vehicle_ChangeVehiclePaintjob
  1464. #endif
  1465.  
  1466. stock GetVehiclePaintjob(vehicleid)
  1467. {
  1468. return Vehicle_GetPropertyInt(vehicleid, v_paintjob);
  1469. }
  1470.  
  1471. stock RemoveVehiclePaintjob(vehicleid)
  1472. {
  1473. return ChangeVehiclePaintjob(vehicleid, 3);
  1474. }
  1475.  
  1476. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  1477. {
  1478. Vehicle_SetPropertyInt(vehicleid, v_paintjob, paintjobid);
  1479.  
  1480. #if defined Vehicle_OnVehiclePaintjob
  1481. return Vehicle_OnVehiclePaintjob(playerid, vehicleid, paintjobid);
  1482. #else
  1483. return 1;
  1484. #endif
  1485. }
  1486. #if defined Vehicle_OnVehiclePaintjob
  1487. forward Vehicle_OnVehiclePaintjob(playerid, vehicleid, paintjobid);
  1488. #endif
  1489. #if defined _ALS_OnVehiclePaintjob
  1490. #undef OnVehiclePaintjob
  1491. #else
  1492. #define _ALS_OnVehiclePaintjob
  1493. #endif
  1494. #define OnVehiclePaintjob Vehicle_OnVehiclePaintjob
  1495.  
  1496. public OnVehicleSpawn(vehicleid)
  1497. {
  1498. Vehicle_SetPropertyInt(vehicleid, v_paintjob, 3);
  1499.  
  1500. new colors[2];
  1501. colors[0] = Vehicle_GetPropertyInt(vehicleid, v_color<0>);
  1502. colors[1] = Vehicle_GetPropertyInt(vehicleid, v_color<1>);
  1503. ChangeVehicleColor(vehicleid, colors[0], colors[1]);
  1504.  
  1505. new Float:pos[3];
  1506. GetVehiclePos(vehicleid, pos[0], pos[1], pos[2]);
  1507.  
  1508. new Float:angle;
  1509. GetVehicleZAngle(vehicleid, angle);
  1510.  
  1511. new Float:vehicle_pos[3], Float:vehicle_angle, vehicle_worldid, vehicle_interiorid;
  1512. GetVehicleSpawnInfo(vehicleid, vehicle_pos[0], vehicle_pos[1], vehicle_pos[2], vehicle_angle, vehicle_worldid, vehicle_interiorid);
  1513.  
  1514. if( pos[0] != vehicle_pos[0] ||
  1515. pos[1] != vehicle_pos[1] ||
  1516. pos[2] != vehicle_pos[2] ||
  1517. angle != vehicle_angle ||
  1518. vehicle_worldid != GetVehicleVirtualWorld(vehicleid) ||
  1519. vehicle_interiorid != GetVehicleInterior(vehicleid))
  1520. {
  1521. TeleportVehicle(vehicleid, vehicle_pos[0], vehicle_pos[1], vehicle_pos[2], vehicle_angle, vehicle_worldid, vehicle_interiorid);
  1522. }
  1523.  
  1524. #if defined Vehicle_OnVehicleSpawn
  1525. return Vehicle_OnVehicleSpawn(vehicleid);
  1526. #else
  1527. return 1;
  1528. #endif
  1529. }
  1530. #if defined Vehicle_OnVehicleSpawn
  1531. forward Vehicle_OnVehicleSpawn(vehicleid);
  1532. #endif
  1533. #if defined _ALS_OnVehicleSpawn
  1534. #undef OnVehicleSpawn
  1535. #else
  1536. #define _ALS_OnVehicleSpawn
  1537. #endif
  1538. #define OnVehicleSpawn Vehicle_OnVehicleSpawn
  1539.  
  1540. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  1541. {
  1542. Vehicle_SetPropertyInt(vehicleid, v_color<0>, color1);
  1543. Vehicle_SetPropertyInt(vehicleid, v_color<1>, color2);
  1544.  
  1545. #if defined Vehicle_OnVehicleRespray
  1546. return Vehicle_OnVehicleRespray(playerid, vehicleid, color1, color2);
  1547. #else
  1548. return 1;
  1549. #endif
  1550. }
  1551. #if defined Vehicle_OnVehicleRespray
  1552. forward Vehicle_OnVehicleRespray(playerid, vehicleid, color1, color2);
  1553. #endif
  1554. #if defined _ALS_OnVehicleRespray
  1555. #undef OnVehicleRespray
  1556. #else
  1557. #define _ALS_OnVehicleRespray
  1558. #endif
  1559. #define OnVehicleRespray Vehicle_OnVehicleRespray
  1560.  
  1561. stock SetVehicleHorn(vehicleid, soundid)
  1562. {
  1563. Vehicle_SetPropertyInt(vehicleid, v_horn, soundid);
  1564. return true;
  1565. }
  1566.  
  1567. stock GetVehicleHorn(vehicleid)
  1568. {
  1569. return Vehicle_GetPropertyInt(vehicleid, v_horn);
  1570. }
  1571.  
  1572. stock RestoreVehicleHorn(vehicleid)
  1573. {
  1574. return SetVehicleHorn(vehicleid, 0);
  1575. }
  1576.  
  1577. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  1578. {
  1579. if(newkeys & KEY_CROUCH)
  1580. {
  1581. if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  1582. {
  1583. new horn = Vehicle_GetPropertyInt(GetPlayerVehicleID(playerid), v_horn);
  1584. if(horn != 0)
  1585. {
  1586. new Float:pos[3];
  1587. GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
  1588.  
  1589. for(new i; i < MAX_PLAYERS; i++)
  1590. {
  1591. if(IsPlayerInRangeOfPoint(i, 35.0, pos[0], pos[1], pos[2]))
  1592. {
  1593. PlayerPlaySound(playerid, horn, pos[0], pos[1], pos[2]);
  1594. }
  1595. }
  1596. }
  1597. }
  1598. }
  1599.  
  1600. #if defined Vehicle_OnPlayerKeyStateChange
  1601. return Vehicle_OnPlayerKeyStateChange(playerid, newkeys, oldkeys);
  1602. #else
  1603. return 1;
  1604. #endif
  1605. }
  1606. #if defined Vehicle_OnPlayerKeyStateChange
  1607. forward Vehicle_OnPlayerKeyStateChange(playerid, newkeys, oldkeys);
  1608. #endif
  1609. #if defined _ALS_OnPlayerKeyStateChange
  1610. #undef OnPlayerKeyStateChange
  1611. #else
  1612. #define _ALS_OnPlayerKeyStateChange
  1613. #endif
  1614. #define OnPlayerKeyStateChange Vehicle_OnPlayerKeyStateChange
  1615.  
  1616. stock ToggleVehicleDamageUpdate(vehicleid, type, bool:toggle)
  1617. {
  1618. if(! toggle)
  1619. {
  1620. if(GetVehicleParams(vehicleid, VEHICLE_PARAMS_ENGINE) == VEHICLE_PARAMS_ON)
  1621. {
  1622. SetVehicleParams(vehicleid, VEHICLE_PARAMS_ENGINE, VEHICLE_PARAMS_OFF);
  1623. }
  1624. }
  1625. return Vehicle_SetPropertyInt(vehicleid, v_damage<type>, _:toggle);
  1626. }
  1627.  
  1628. stock IsVehicleDamageToggled(vehicleid, type)
  1629. {
  1630. return Vehicle_GetPropertyInt(vehicleid, v_damage<type>);
  1631. }
  1632.  
  1633. stock Vehicle_SetVehicleHealth(vehicleid, Float:health)
  1634. {
  1635. if(SetVehicleHealth(vehicleid, health))
  1636. {
  1637. gVehicleTempData[vehicleid][e_health] = health;
  1638. return true;
  1639. }
  1640. return false;
  1641. }
  1642. #if defined _ALS_SetVehicleHealth
  1643. #undef SetVehicleHealth
  1644. #else
  1645. #define _ALS_SetVehicleHealth
  1646. #endif
  1647. #define SetVehicleHealth Vehicle_SetVehicleHealth
  1648.  
  1649. stock UpdateVehicleDamageStatusEx(vehicleid, type, update)
  1650. {
  1651. new panels, doors, lights, tires;
  1652. GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
  1653.  
  1654. switch(type)
  1655. {
  1656. case VEHICLE_DAMAGE_PANELS: return UpdateVehicleDamageStatus(vehicleid, update, doors, lights, tires);
  1657. case VEHICLE_DAMAGE_DOORS: return UpdateVehicleDamageStatus(vehicleid, panels, update, lights, tires);
  1658. case VEHICLE_DAMAGE_LIGHTS: return UpdateVehicleDamageStatus(vehicleid, panels, doors, update, tires);
  1659. case VEHICLE_DAMAGE_TIRES: return UpdateVehicleDamageStatus(vehicleid, panels, doors, lights, update);
  1660. }
  1661. return false;
  1662. }
  1663.  
  1664. stock GetVehicleDamageStatusEx(vehicleid, type)
  1665. {
  1666. new panels, doors, lights, tires;
  1667. GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
  1668.  
  1669. switch(type)
  1670. {
  1671. case VEHICLE_DAMAGE_PANELS: return panels;
  1672. case VEHICLE_DAMAGE_DOORS: return doors;
  1673. case VEHICLE_DAMAGE_LIGHTS: return lights;
  1674. case VEHICLE_DAMAGE_TIRES: return tires;
  1675. }
  1676. return -1;
  1677. }
  1678.  
  1679. public OnVehicleDamageStatusUpdate(vehicleid, playerid)
  1680. {
  1681. new panels, doors, lights, tires;
  1682. GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
  1683.  
  1684. if(! IsVehicleDamageToggled(vehicleid, VEHICLE_DAMAGE_PANELS)) UpdateVehicleDamageStatusEx(vehicleid, VEHICLE_DAMAGE_PANELS, 0);
  1685. if(! IsVehicleDamageToggled(vehicleid, VEHICLE_DAMAGE_DOORS)) UpdateVehicleDamageStatusEx(vehicleid, VEHICLE_DAMAGE_DOORS, 0);
  1686. if(! IsVehicleDamageToggled(vehicleid, VEHICLE_DAMAGE_LIGHTS)) UpdateVehicleDamageStatusEx(vehicleid, VEHICLE_DAMAGE_LIGHTS, 0);
  1687. if(! IsVehicleDamageToggled(vehicleid, VEHICLE_DAMAGE_TIRES)) UpdateVehicleDamageStatusEx(vehicleid, VEHICLE_DAMAGE_TIRES, 0);
  1688.  
  1689. #if defined V_OnVehicleDamageStatusUpdate
  1690. return V_OnVehicleDamageStatusUpdate(vehicleid, playerid);
  1691. #else
  1692. return 1;
  1693. #endif
  1694. }
  1695. #if defined V_OnVehicleDamageStatusUpdate
  1696. forward V_OnVehicleDamageStatusUpdate(vehicleid, playerid);
  1697. #endif
  1698. #if defined _ALS_OnVehicleDamageStatusU
  1699. #undef OnVehicleDamageStatusUpdate
  1700. #else
  1701. #define _ALS_OnVehicleDamageStatusU
  1702. #endif
  1703. #define OnVehicleDamageStatusUpdate V_OnVehicleDamageStatusUpdate
  1704.  
  1705. stock static encode_lights(light1, light2, light3, light4)
  1706. {
  1707. return light1 | (light2 << 1) | (light3 << 2) | (light4 << 3);
  1708. }
  1709. stock static encode_panels(flp, frp, rlp, rrp, windshield, front_bumper, rear_bumper)
  1710. {
  1711. return flp | (frp << 4) | (rlp << 8) | (rrp << 12) | (windshield << 16) | (front_bumper << 20) | (rear_bumper << 24);
  1712. }
  1713.  
  1714. stock static encode_doors(bonnet, boot, driver_door, passenger_door, behind_driver_door, behind_passenger_door)
  1715. {
  1716. #pragma unused behind_driver_door
  1717. #pragma unused behind_passenger_door
  1718. return bonnet | (boot << 8) | (driver_door << 16) | (passenger_door << 24);
  1719. }
  1720.  
  1721. stock static Vehicle_UpdateVehicleDamage(vehicleid, type)
  1722. {
  1723. new panels, doors, lights, tires;
  1724. GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
  1725. switch(type)
  1726. {
  1727. case VEHICLE_DAMAGE_PANELS: panels = encode_panels(1, 1, 1, 1, 3, 3, 3);
  1728. case VEHICLE_DAMAGE_DOORS: doors = encode_doors(4, 4, 4, 4, 0, 0);
  1729. case VEHICLE_DAMAGE_LIGHTS: lights = encode_lights(1, 1, 1, 1);
  1730. }
  1731. UpdateVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
  1732. return 1;
  1733. }
  1734.  
  1735. public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
  1736. {
  1737. if(hittype == BULLET_HIT_TYPE_VEHICLE)
  1738. {
  1739. new Float:fHealth;
  1740. GetVehicleHealth(hitid, fHealth);
  1741.  
  1742. if(fHealth > (250 - 1))
  1743. {
  1744. new
  1745. fModelid = GetVehicleModel(hitid),
  1746. Float:fOffSet[3],
  1747. Float:fDamage
  1748. ;
  1749.  
  1750. switch(GetPlayerWeapon(playerid))
  1751. {
  1752. case 22: fDamage = 40.0;
  1753. case 23: fDamage = 40.0;
  1754. case 24: fDamage = 140.0;
  1755. case 25: fDamage = 80.0;
  1756. case 26: fDamage = 80.0;
  1757. case 27: fDamage = 80.0;
  1758. case 28: fDamage = 25.0;
  1759. case 29: fDamage = 25.0;
  1760. case 30: fDamage = 30.0;
  1761. case 31: fDamage = 30.0;
  1762. case 32: fDamage = 25.0;
  1763. case 33: fDamage = 75.0;
  1764. case 34: fDamage = 125.0;
  1765. case 35: fDamage = 751.0;
  1766. case 36: fDamage = 751.0;
  1767. case 38: fDamage = 50.0;
  1768. }
  1769.  
  1770. //front wheels
  1771. GetVehicleModelInfo(fModelid, VEHICLE_MODEL_INFO_WHEELSFRONT, fOffSet[0], fOffSet[1], fOffSet[2]);
  1772. //left
  1773. if( fX >= fOffSet[0] - 2.4 &&
  1774. fX <= fOffSet[0] &&
  1775. fY >= fOffSet[1] - 0.4 &&
  1776. fY <= fOffSet[1] + 0.4 &&
  1777. fZ >= fOffSet[2] - 0.4 &&
  1778. fZ <= fOffSet[2] + 0.4)
  1779. {
  1780. if( CallLocalFunction("OnPlayerShotVehicle", "iiifi", playerid, hitid, weaponid, fDamage, VEHICLE_BODYPART_FRONT_LEFT_WHEEL) ||
  1781. funcidx("OnPlayerShotVehicle") == -1)
  1782. {
  1783. if(IsUnoccupiedDamageToggled(hitid))
  1784. {
  1785. switch(GetVehicleDamageStatusEx(hitid, VEHICLE_DAMAGE_TIRES))
  1786. {
  1787. case 0: UpdateVehicleDamageStatusEx(hitid, VEHICLE_DAMAGE_TIRES, 8);
  1788. case 1: UpdateVehicleDamageStatusEx(hitid, VEHICLE_DAMAGE_TIRES, 9);
  1789. case 2: UpdateVehicleDamageStatusEx(hitid, VEHICLE_DAMAGE_TIRES, 10);
  1790. case 3: UpdateVehicleDamageStatusEx(hitid, VEHICLE_DAMAGE_TIRES, 11);
  1791. case 4: UpdateVehicleDamageStatusEx(hitid, VEHICLE_DAMAGE_TIRES, 12);
  1792. case 5: UpdateVehicleDamageStatusEx(hitid, VEHICLE_DAMAGE_TIRES, 13);
  1793. case 6: UpdateVehicleDamageStatusEx(hitid, VEHICLE_DAMAGE_TIRES, 14);
  1794. case 7: UpdateVehicleDamageStatusEx(hitid, VEHICLE_DAMAGE_TIRES, 15);
  1795. }
  1796. return 1;
  1797. }
  1798. }
  1799. else return 0;
  1800. }
  1801. //right
  1802. if( fX >= fOffSet[0] - 0.4 &&
  1803. fX <= fOffSet[0] + 0.4 &&
  1804. fY >= fOffSet[1] - 0.4 &&
  1805. fY <= fOffSet[1] + 0.4 &&
  1806. fZ >= fOffSet[2] - 0.4 &&
  1807. fZ <= fOffSet[2] + 0.4)
  1808. {
  1809. if( CallLocalFunction("OnPlayerShotVehicle", "iiifi", playerid, hitid, weaponid, fDamage, VEHICLE_BODYPART_FRONT_RIGHT_WHEEL) ||
  1810. funcidx("OnPlayerShotVehicle") == -1)
  1811. {
  1812. if(IsUnoccupiedDamageToggled(hitid))
  1813. {
  1814. switch(GetVehicleDamageStatusEx(hitid, VEHICLE_DAMAGE_TIRES))
  1815. {
  1816. case 0: UpdateVehicleDamageStatusEx(hitid, VEHICLE_DAMAGE_TIRES, 2);
  1817. case 1: UpdateVehicleDamageStatusEx(hitid, VEHICLE_DAMAGE_TIRES, 3);
  1818. case 4: UpdateVehicleDamageStatusEx(hitid, VEHICLE_DAMAGE_TIRES, 6);
  1819. case 5: UpdateVehicleDamageStatusEx(hitid, VEHICLE_DAMAGE_TIRES, 7);
  1820. case 8: UpdateVehicleDamageStatusEx(hitid, VEHICLE_DAMAGE_TIRES, 10);
  1821. case 9: UpdateVehicleDamageStatusEx(hitid, VEHICLE_DAMAGE_TIRES, 11);
  1822. case 12: UpdateVehicleDamageStatusEx(hitid, VEHICLE_DAMAGE_TIRES, 14);
  1823. case 13: UpdateVehicleDamageStatusEx(hitid, VEHICLE_DAMAGE_TIRES, 15);
  1824. }
  1825. return 1;
  1826. }
  1827. }
  1828. else return 0;
  1829. }
  1830.  
  1831. //back wheels
  1832. GetVehicleModelInfo(fModelid, VEHICLE_MODEL_INFO_WHEELSREAR, fOffSet[0], fOffSet[1], fOffSet[2]);
  1833. //left
  1834. if( fX >= fOffSet[0] - 2.4 &&
  1835. fX <= fOffSet[0] &&
  1836. fY >= fOffSet[1] - 0.4 &&
  1837. fY <= fOffSet[1] + 0.4 &&
  1838. fZ >= fOffSet[2] - 0.4 &&
  1839. fZ <= fOffSet[2] + 0.4)
  1840. {
  1841. if( CallLocalFunction("OnPlayerShotVehicle", "iiifi", playerid, hitid, weaponid, fDamage, VEHICLE_BODYPART_BACK_LEFT_WHEEL) ||
  1842. funcidx("OnPlayerShotVehicle") == -1)
  1843. {
  1844. if(IsUnoccupiedDamageToggled(hitid))
  1845. {
  1846. switch(GetVehicleDamageStatusEx(hitid, VEHICLE_DAMAGE_TIRES))
  1847. {
  1848. case 0: UpdateVehicleDamageStatusEx(hitid, VEHICLE_DAMAGE_TIRES, 4);
  1849. case 1: UpdateVehicleDamageStatusEx(hitid, VEHICLE_DAMAGE_TIRES, 5);
  1850. case 2: UpdateVehicleDamageStatusEx(hitid, VEHICLE_DAMAGE_TIRES, 6);
  1851. case 3: UpdateVehicleDamageStatusEx(hitid, VEHICLE_DAMAGE_TIRES, 7);
  1852. case 8: UpdateVehicleDamageStatusEx(hitid, VEHICLE_DAMAGE_TIRES, 12);
  1853. case 9: UpdateVehicleDamageStatusEx(hitid, VEHICLE_DAMAGE_TIRES, 13);
  1854. case 10: UpdateVehicleDamageStatusEx(hitid, VEHICLE_DAMAGE_TIRES, 14);
  1855. case 11: UpdateVehicleDamageStatusEx(hitid, VEHICLE_DAMAGE_TIRES, 15);
  1856. }
  1857. return 1;
  1858. }
  1859. }
  1860. else return 0;
  1861. }
  1862. //right
  1863. if( fX >= fOffSet[0] - 0.4 &&
  1864. fX <= fOffSet[0] + 0.4 &&
  1865. fY >= fOffSet[1] - 0.4 &&
  1866. fY <= fOffSet[1] + 0.4 &&
  1867. fZ >= fOffSet[2] - 0.4 &&
  1868. fZ <= fOffSet[2] + 0.4)
  1869. {
  1870. if( CallLocalFunction("OnPlayerShotVehicle", "iiifi", playerid, hitid, weaponid, fDamage, VEHICLE_BODYPART_BACK_RIGHT_WHEEL) ||
  1871. funcidx("OnPlayerShotVehicle") == -1)
  1872. {
  1873. if(IsUnoccupiedDamageToggled(hitid))
  1874. {
  1875. switch(GetVehicleDamageStatusEx(hitid, VEHICLE_DAMAGE_TIRES))
  1876. {
  1877. case 0: UpdateVehicleDamageStatusEx(hitid, VEHICLE_DAMAGE_TIRES, 1);
  1878. case 2: UpdateVehicleDamageStatusEx(hitid, VEHICLE_DAMAGE_TIRES, 3);
  1879. case 4: UpdateVehicleDamageStatusEx(hitid, VEHICLE_DAMAGE_TIRES, 5);
  1880. case 6: UpdateVehicleDamageStatusEx(hitid, VEHICLE_DAMAGE_TIRES, 7);
  1881. case 8: UpdateVehicleDamageStatusEx(hitid, VEHICLE_DAMAGE_TIRES, 9);
  1882. case 10: UpdateVehicleDamageStatusEx(hitid, VEHICLE_DAMAGE_TIRES, 11);
  1883. case 12: UpdateVehicleDamageStatusEx(hitid, VEHICLE_DAMAGE_TIRES, 13);
  1884. case 14: UpdateVehicleDamageStatusEx(hitid, VEHICLE_DAMAGE_TIRES, 15);
  1885. }
  1886. return 1;
  1887. }
  1888. }
  1889. else return 0;
  1890. }
  1891.  
  1892. //petrol cap
  1893. fModelid -= 400;
  1894. if( fX >= gVehiclePetrolCapOffsets[fModelid][0] - 0.15 &&
  1895. fX <= gVehiclePetrolCapOffsets[fModelid][0] + 0.15 &&
  1896. fY >= gVehiclePetrolCapOffsets[fModelid][1] - 0.15 &&
  1897. fY <= gVehiclePetrolCapOffsets[fModelid][1] + 0.15 &&
  1898. fZ >= gVehiclePetrolCapOffsets[fModelid][2] - 0.15 &&
  1899. fZ <= gVehiclePetrolCapOffsets[fModelid][2] + 0.15)
  1900. {
  1901. if( CallLocalFunction("OnPlayerShotVehicle", "iiifi", playerid, hitid, weaponid, fDamage, VEHICLE_BODYPART_PETROLCAP) ||
  1902. funcidx("OnPlayerShotVehicle") == -1)
  1903. {
  1904. if(IsPetrolCapDestroyToggled(hitid))
  1905. {
  1906. if( IsUnoccupiedDamageToggled(hitid) ||
  1907. IsVehicleOccupied(hitid))
  1908. {
  1909. new Float:pos[3];
  1910. GetVehiclePos(hitid, pos[0], pos[1], pos[2]);
  1911. CreateExplosion(pos[0], pos[1], pos[2], 3, 25.0);
  1912. return SetVehicleToRespawn(hitid);
  1913. }
  1914. }
  1915. else
  1916. {
  1917. fHealth -= fDamage;
  1918. SetVehicleHealth(hitid, fHealth);
  1919.  
  1920. switch(fHealth)
  1921. {
  1922. case 251..399: return Vehicle_UpdateVehicleDamage(hitid, VEHICLE_DAMAGE_DOORS);
  1923. case 400..599: return Vehicle_UpdateVehicleDamage(hitid, VEHICLE_DAMAGE_PANELS);
  1924. case 600..700: return Vehicle_UpdateVehicleDamage(hitid, VEHICLE_DAMAGE_LIGHTS);
  1925. }
  1926. }
  1927. }
  1928. else return 0;
  1929. }
  1930.  
  1931. if( CallLocalFunction("OnPlayerShotVehicle", "iiifi", playerid, hitid, weaponid, fDamage, VEHICLE_BODYPART_UNKNOWN) ||
  1932. funcidx("OnPlayerShotVehicle") == -1)
  1933. {
  1934. if(IsUnoccupiedDamageToggled(hitid))
  1935. {
  1936. fHealth -= fDamage;
  1937. SetVehicleHealth(hitid, fHealth);
  1938.  
  1939. switch(floatround(fHealth))
  1940. {
  1941. case 251..399: return Vehicle_UpdateVehicleDamage(hitid, VEHICLE_DAMAGE_DOORS);
  1942. case 400..599: return Vehicle_UpdateVehicleDamage(hitid, VEHICLE_DAMAGE_PANELS);
  1943. case 600..700: return Vehicle_UpdateVehicleDamage(hitid, VEHICLE_DAMAGE_LIGHTS);
  1944. }
  1945. }
  1946. }
  1947. else return 0;
  1948. }
  1949. }
  1950.  
  1951. #if defined Vehicle_OnPlayerWeaponShot
  1952. return Vehicle_OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ);
  1953. #else
  1954. return 1;
  1955. #endif
  1956. }
  1957. #if defined Vehicle_OnPlayerWeaponShot
  1958. forward Vehicle_OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ);
  1959. #endif
  1960. #if defined _ALS_OnPlayerWeaponShot
  1961. #undef OnPlayerWeaponShot
  1962. #else
  1963. #define _ALS_OnPlayerWeaponShot
  1964. #endif
  1965. #define OnPlayerWeaponShot Vehicle_OnPlayerWeaponShot
  1966.  
  1967. forward OnPlayerShotVehicle(playerid, vehicleid, weaponid, Float:amount, bodypart);
  1968.  
  1969. stock IsVehicleOccupied(vehicleid)
  1970. {
  1971. for(new i; i < MAX_PLAYERS; i++)
  1972. {
  1973. if( IsPlayerConnected(i) &&
  1974. IsPlayerInVehicle(i, vehicleid))
  1975. {
  1976. return true;
  1977. }
  1978. }
  1979. return false;
  1980. }
  1981.  
  1982. stock GetVehicleDriverID(vehicleid)
  1983. {
  1984. for(new i; i <= GetPlayerPoolSize(); i++)
  1985. {
  1986. if( GetPlayerVehicleID(i) == vehicleid &&
  1987. GetPlayerVehicleSeat(i) == 0)
  1988. {
  1989. return i;
  1990. }
  1991. }
  1992. return INVALID_PLAYER_ID;
  1993. }
  1994.  
  1995. stock EditVehicle(playerid, vehicleid)
  1996. {
  1997. if(IsValidObject(Vehicle_GetPropertyInt(vehicleid, v_editor))) return false;
  1998.  
  1999. new Float:pos[3];
  2000. GetVehiclePos(vehicleid, pos[0], pos[1], pos[2]);
  2001. Vehicle_SetPropertyInt(vehicleid, v_editor, CreateObject(19300, pos[0], pos[1], pos[2], 0.0, 0.0, 0.0));
  2002.  
  2003. EditObject(playerid, Vehicle_GetPropertyInt(vehicleid, v_editor));
  2004.  
  2005. gPlayerVehicleEditer[playerid] = vehicleid;
  2006. return true;
  2007. }
  2008.  
  2009. #if ! defined IsValidVehicle
  2010. native IsValidVehicle(vehicleid);
  2011. #endif
  2012.  
  2013. public OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ)
  2014. {
  2015. if(IsValidVehicle(gPlayerVehicleEditer[playerid]))
  2016. {
  2017. if(Vehicle_GetPropertyInt(gPlayerVehicleEditer[playerid], v_editor) == objectid)
  2018. {
  2019. SetVehiclePos(gPlayerVehicleEditer[playerid], fX, fY, fZ);
  2020. SetVehicleZAngle(gPlayerVehicleEditer[playerid], fRotZ);
  2021.  
  2022. CallLocalFunction("OnPlayerEditVehicle", "iiiffff", playerid, gPlayerVehicleEditer[playerid], response, fX, fY, fZ, fRotZ);
  2023.  
  2024. switch(response)
  2025. {
  2026. case EDIT_RESPONSE_CANCEL, EDIT_RESPONSE_FINAL:
  2027. {
  2028. DestroyObject(objectid);
  2029. Vehicle_SetPropertyInt(gPlayerVehicleEditer[playerid], v_editor, INVALID_OBJECT_ID);
  2030.  
  2031. SetVehicleVelocity(gPlayerVehicleEditer[playerid], 0.0, 0.0, 0.0);
  2032.  
  2033. gPlayerVehicleEditer[playerid] = INVALID_VEHICLE_ID;
  2034. }
  2035. }
  2036. }
  2037. }
  2038.  
  2039. #if defined Vehicle_OnPlayerEditObject
  2040. return Vehicle_OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ);
  2041. #else
  2042. return 1;
  2043. #endif
  2044. }
  2045. #if defined Vehicle_OnPlayerEditObject
  2046. forward Vehicle_OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ);
  2047. #endif
  2048. #if defined _ALS_OnPlayerEditObject
  2049. #undef OnPlayerEditObject
  2050. #else
  2051. #define _ALS_OnPlayerEditObject
  2052. #endif
  2053. #define OnPlayerEditObject Vehicle_OnPlayerEditObject
  2054.  
  2055. forward OnPlayerEditVehicle(playerid, vehicleid, response, Float:fX, Float:fY, Float:fZ, Float:fRotZ);
  2056.  
  2057. stock GetVehicleName(vehicleid, string[], len = sizeof(string))
  2058. {
  2059. strcat(string, gVehicleTempDataNames[GetVehicleModel(vehicleid) - 400], len);
  2060. return true;
  2061. }
  2062.  
  2063. stock GetVehicleModelName(modelid, string[], len = sizeof(string))
  2064. {
  2065. strcat(string, gVehicleTempDataNames[modelid - 400], len);
  2066. return true;
  2067. }
  2068.  
  2069. stock SetVehicleParams(vehicleid, type, set)
  2070. {
  2071. new params[7];
  2072.  
  2073. if(GetVehicleParamsEx(vehicleid, params[0], params[1], params[2], params[3], params[4], params[5], params[6]))
  2074. {
  2075. params[type] = set;
  2076. SetVehicleParamsEx(vehicleid, params[0], params[1], params[2], params[3], params[4], params[5], params[6]);
  2077. return true;
  2078. }
  2079. return false;
  2080. }
  2081.  
  2082. stock GetVehicleParams(vehicleid, type)
  2083. {
  2084. new params[7];
  2085. GetVehicleParamsEx(vehicleid, params[0], params[1], params[2], params[3], params[4], params[5], params[6]);
  2086. return params[type];
  2087. }
  2088.  
  2089. stock Float:GetVehicleSpeed(vehicleid, bool:kmh = true, Float:velx = 0.0, Float:vely = 0.0, Float:velz = 0.0)
  2090. {
  2091. if( velx == 0.0 &&
  2092. vely == 0.0 &&
  2093. velz == 0.0)
  2094. {
  2095. GetVehicleVelocity(vehicleid, velx, vely, velz);
  2096. }
  2097.  
  2098. new Float:speed;
  2099.  
  2100. if(kmh) speed = floatsqroot(((velx * velx) + (vely * vely)) + (velz * velz)) * 136.666667;
  2101. else speed = floatsqroot(((velx * velx) + (vely * vely)) + (velz * velz)) * 85.4166672;
  2102.  
  2103. floatround(speed, floatround_round);
  2104. return speed;
  2105. }
  2106.  
  2107. stock Vehicle_AttachObjectToVehicle(objectid, vehicleid, Float:OffsetX, Float:OffsetY, Float:OffsetZ, Float:RotX, Float:RotY, Float:RotZ)
  2108. {
  2109. for(new i; i < MAX_VEHICLE_ATTACHED_OBJECTS; i++)
  2110. {
  2111. if(! IsValidObject(gVehicleTempData[vehicleid][e_attached_object][i]))
  2112. {
  2113. if(AttachObjectToVehicle(objectid, vehicleid, OffsetX, OffsetY, OffsetZ, RotX, RotY, RotZ))
  2114. {
  2115. gVehicleTempData[vehicleid][e_attached_object][i] = objectid;
  2116. return true;
  2117. }
  2118. }
  2119. }
  2120.  
  2121. printf("WARNING: The object wasn't attached to the vehicle (id: %i), This may occur because the MAX_VEHICLE_ATTACHED_OBJECT limit was exceeded or the vehicle wasn't created. <vehicleplus.inc>", vehicleid);
  2122. return false;
  2123. }
  2124. #if defined _ALS_AttachObjectToVehicle
  2125. #undef AttachObjectToVehicle
  2126. #else
  2127. #define _ALS_AttachObjectToVehicle
  2128. #endif
  2129. #define AttachObjectToVehicle Vehicle_AttachObjectToVehicle
  2130.  
  2131. stock IsObjectAttachedToVehicle(objectid, vehicleid)
  2132. {
  2133. for(new i; i < MAX_VEHICLE_ATTACHED_OBJECTS; i++)
  2134. {
  2135. if(IsValidObject(gVehicleTempData[vehicleid][e_attached_object][i]))
  2136. {
  2137. if(gVehicleTempData[vehicleid][e_attached_object][i] == objectid) return true;
  2138. }
  2139. }
  2140. return false;
  2141. }
  2142.  
  2143. stock GetVehicleSlotAttachedObject(vehicleid, slot)
  2144. {
  2145. if(! IsValidObject(gVehicleTempData[vehicleid][e_attached_object][slot])) return -1;
  2146.  
  2147. return gVehicleTempData[vehicleid][e_attached_object][slot];
  2148.  
  2149. }
  2150.  
  2151. stock TeleportVehicle(vehicleid, Float:x, Float:y, Float:z, Float:rotation, worldid = -1, interiorid = -1)
  2152. {
  2153. for(new i; i <= GetPlayerPoolSize(); i++)
  2154. {
  2155. if(IsPlayerConnected(i))
  2156. {
  2157. if(GetPlayerVehicleID(i) == vehicleid)
  2158. {
  2159. if(worldid != -1)
  2160. {
  2161. SetPlayerVirtualWorld(i, worldid);
  2162. }
  2163. else
  2164. {
  2165. SetPlayerVirtualWorld(i, GetVehicleVirtualWorld(vehicleid));
  2166. }
  2167. if(interiorid != -1)
  2168. {
  2169. SetPlayerInterior(i, interiorid);
  2170. }
  2171. else
  2172. {
  2173. SetPlayerInterior(i, GetVehicleInterior(vehicleid));
  2174. }
  2175. }
  2176. }
  2177. }
  2178.  
  2179. if(worldid != -1)
  2180. {
  2181. SetVehicleVirtualWorld(vehicleid, worldid);
  2182. }
  2183. if(interiorid != -1)
  2184. {
  2185. SetVehicleInterior(vehicleid, interiorid);
  2186. }
  2187.  
  2188. SetVehiclePos(vehicleid, x, y, z);
  2189. SetVehicleZAngle(vehicleid, rotation);
  2190. return true;
  2191. }
  2192.  
  2193. stock SetVehicleSpeedCap(vehicleid, Float:maxspeed)
  2194. {
  2195. return Vehicle_SetPropertyFloat(vehicleid, v_speedcap, maxspeed);
  2196. }
  2197.  
  2198. stock Float:GetVehicleSpeedCap(vehicleid)
  2199. {
  2200. return Vehicle_GetPropertyFloat(vehicleid, v_speedcap);
  2201. }
  2202.  
  2203. stock DisableVehicleSpeedCap(vehicleid)
  2204. {
  2205. return SetVehicleSpeedCap(vehicleid, 0);
  2206. }
  2207.  
  2208. public OnPlayerUpdate(playerid)
  2209. {
  2210. if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  2211. {
  2212. new vehicleid;
  2213. vehicleid = GetPlayerVehicleID(playerid);
  2214.  
  2215. new Float:speedcap;
  2216. speedcap = GetVehicleSpeedCap(vehicleid);
  2217.  
  2218. new Float:vel[3];
  2219. GetVehicleVelocity(vehicleid, vel[0], vel[1], vel[2]);
  2220.  
  2221. new Float:speed;
  2222. speed = GetVehicleSpeed(vehicleid, true, vel[0], vel[1], vel[2]);
  2223.  
  2224. if(speedcap != 0.0)
  2225. {
  2226. if(speed > speedcap)
  2227. {
  2228. if( funcidx("OnPlayerReachSpeedCapLimit") == -1 ||
  2229. CallLocalFunction("OnPlayerReachSpeedCapLimit", "iif", playerid, vehicleid, speed))
  2230. {
  2231. vel[0] = (vel[0] / speed) * speedcap;
  2232. vel[1] = (vel[1] / speed) * speedcap;
  2233. vel[2] = (vel[2] / speed) * speedcap;
  2234.  
  2235. SetVehicleVelocity(vehicleid, vel[0], vel[1], vel[2]);
  2236. }
  2237. }
  2238. }
  2239. }
  2240.  
  2241. #if defined Vehicle_OnPlayerUpdate
  2242. return Vehicle_OnPlayerUpdate(playerid);
  2243. #else
  2244. return 1;
  2245. #endif
  2246. }
  2247. #if defined Vehicle_OnPlayerUpdate
  2248. forward Vehicle_OnPlayerUpdate(playerid);
  2249. #endif
  2250. #if defined _ALS_OnPlayerUpdate
  2251. #undef OnPlayerUpdate
  2252. #else
  2253. #define _ALS_OnPlayerUpdate
  2254. #endif
  2255. #define OnPlayerUpdate Vehicle_OnPlayerUpdate
  2256.  
  2257. forward OnPlayerReachSpeedCapLimit(playerid, vehicleid, Float:speed);
  2258.  
  2259. stock GetVehicleTopSpeed(vehicleid)
  2260. {
  2261. return gVehicleTempDataTopSpeed[GetVehicleModel(vehicleid) - 400];
  2262. }
  2263.  
  2264. stock GetVehicleModelTopSpeed(modelid)
  2265. {
  2266. return gVehicleTempDataTopSpeed[modelid - 400];
  2267. }
  2268.  
  2269. stock SetVehicleSpawnInfo(vehicleid, Float:x, Float:y, Float:z, Float:rotation, worldid, interiorid)
  2270. {
  2271. Vehicle_SetPropertyFloat(vehicleid, v_spawn<0>, x);
  2272. Vehicle_SetPropertyFloat(vehicleid, v_spawn<1>, y);
  2273. Vehicle_SetPropertyFloat(vehicleid, v_spawn<2>, z);
  2274. Vehicle_SetPropertyFloat(vehicleid, v_spawn<3>, rotation);
  2275.  
  2276. Vehicle_SetPropertyInt(vehicleid, v_spawn_worldid, worldid);
  2277. Vehicle_SetPropertyInt(vehicleid, v_spawn_interiorid, interiorid);
  2278. return true;
  2279. }
  2280.  
  2281. stock GetVehicleSpawnInfo(vehicleid, &Float:x, &Float:y, &Float:z, &Float:rotation, &worldid, &interiorid)
  2282. {
  2283. x = Vehicle_GetPropertyFloat(vehicleid, v_spawn<0>);
  2284. y = Vehicle_GetPropertyFloat(vehicleid, v_spawn<1>);
  2285. z = Vehicle_GetPropertyFloat(vehicleid, v_spawn<2>);
  2286. rotation = Vehicle_GetPropertyFloat(vehicleid, v_spawn<3>);
  2287.  
  2288. worldid = Vehicle_GetPropertyInt(vehicleid, v_spawn_worldid);
  2289. interiorid = Vehicle_GetPropertyInt(vehicleid, v_spawn_interiorid);
  2290. return true;
  2291. }
  2292.  
  2293. stock ToggleUnoccupiedVehicleDamage(vehicleid, bool:toggle)
  2294. {
  2295. return Vehicle_SetPropertyInt(vehicleid, v_spawn_uno_damage, _:toggle);
  2296. }
  2297.  
  2298. stock IsUnoccupiedDamageToggled(vehicleid)
  2299. {
  2300. return Vehicle_GetPropertyInt(vehicleid, v_spawn_uno_damage);
  2301. }
  2302.  
  2303. stock ToggleVehiclePetrolCapDestroy(vehicleid, bool:toggle)
  2304. {
  2305. return Vehicle_SetPropertyInt(vehicleid, v_petrolcap, _:toggle);
  2306. }
  2307.  
  2308. stock IsPetrolCapDestroyToggled(vehicleid)
  2309. {
  2310. return Vehicle_GetPropertyInt(vehicleid, v_petrolcap);
  2311. }
  2312.  
  2313. stock SetVehicleBomb(vehicleid, time = 1000)
  2314. {
  2315. if(IsVehicleBombed(vehicleid))
  2316. {
  2317. SetVehicleParams(vehicleid, VEHICLE_PARAMS_ALARM, VEHICLE_PARAMS_OFF);
  2318. if(Vehicle_GetPropertyInt(vehicleid, v_bomb_timer) != -1)
  2319. {
  2320. KillTimer(Vehicle_GetPropertyInt(vehicleid, v_bomb_timer));
  2321. Vehicle_SetPropertyInt(vehicleid, v_bomb_timer, -1);
  2322. }
  2323. }
  2324. return Vehicle_SetPropertyInt(vehicleid, v_bomb, time);
  2325. }
  2326.  
  2327. stock GetVehicleBomb(vehicleid)
  2328. {
  2329. return Vehicle_GetPropertyInt(vehicleid, v_bomb);
  2330. }
  2331.  
  2332. stock RemoveVehicleBomb(vehicleid)
  2333. {
  2334. return SetVehicleBomb(vehicleid, 0);
  2335. }
  2336.  
  2337. stock IsVehicleBombed(vehicleid)
  2338. {
  2339. if(GetVehicleBomb(vehicleid)) return true;
  2340. return false;
  2341. }
  2342.  
  2343. stock IsVehicleBombActivated(vehicleid)
  2344. {
  2345. if(IsVehicleBombed(vehicleid))
  2346. {
  2347. if(Vehicle_GetPropertyInt(vehicleid, v_bomb_timer) != -1)
  2348. {
  2349. return true;
  2350. }
  2351. }
  2352. return false;
  2353. }
  2354.  
  2355. public OnPlayerStateChange(playerid, newstate, oldstate)
  2356. {
  2357. if(newstate == PLAYER_STATE_DRIVER)
  2358. {
  2359. new vehicleid = GetPlayerVehicleID(playerid);
  2360.  
  2361. if(IsVehicleBombed(vehicleid))
  2362. {
  2363. if(! IsVehicleBombActivated(vehicleid))
  2364. {
  2365. if( CallLocalFunction("OnVehicleBombActivate", "i", vehicleid) ||
  2366. funcidx("OnVehicleBombActivate") == -1)
  2367. {
  2368. new interval = (GetVehicleBomb(vehicleid) - 1750);
  2369. if(interval < 1750)
  2370. {
  2371. SetVehicleParams(vehicleid, VEHICLE_PARAMS_ALARM, VEHICLE_PARAMS_ON);
  2372. Vehicle_SetPropertyInt(vehicleid, v_bomb_timer, SetTimerEx("Vehicle_OnVehicleBombExplode", GetVehicleBomb(vehicleid), false, "ii", playerid, vehicleid));
  2373. }
  2374. else
  2375. {
  2376. Vehicle_SetPropertyInt(vehicleid, v_bomb_timer, SetTimerEx("Vehicle_OnVehicleBombActivate", interval, false, "ii", playerid, vehicleid));
  2377. }
  2378. }
  2379. }
  2380. }
  2381.  
  2382. if(IsVehicleSticky(vehicleid))
  2383. {
  2384. SetVehicleParams(vehicleid, VEHICLE_PARAMS_ENGINE, VEHICLE_PARAMS_OFF);
  2385. }
  2386. }
  2387.  
  2388. if(oldstate == PLAYER_STATE_DRIVER)
  2389. {
  2390. new vehicleid = GetPlayerVehicleID(playerid);
  2391.  
  2392. if(IsVehicleSticky(vehicleid))
  2393. {
  2394. SetVehicleParams(vehicleid, VEHICLE_PARAMS_ENGINE, VEHICLE_PARAMS_ON);
  2395. }
  2396. }
  2397.  
  2398. #if defined Vehicle_OnPlayerStateChange
  2399. return Vehicle_OnPlayerStateChange(playerid, newstate, oldstate);
  2400. #else
  2401. return 1;
  2402. #endif
  2403. }
  2404. #if defined Vehicle_OnPlayerStateChange
  2405. forward Vehicle_OnPlayerStateChange(playerid, newstate, oldstate);
  2406. #endif
  2407. #if defined _ALS_OnPlayerStateChange
  2408. #undef OnPlayerStateChange
  2409. #else
  2410. #define _ALS_OnPlayerStateChange
  2411. #endif
  2412. #define OnPlayerStateChange Vehicle_OnPlayerStateChange
  2413.  
  2414. forward OnVehicleBombActivate(vehicleid);
  2415.  
  2416. forward Vehicle_OnVehicleBombActivate(playerid, vehicleid);
  2417. public Vehicle_OnVehicleBombActivate(playerid, vehicleid)
  2418. {
  2419. SetVehicleParams(vehicleid, VEHICLE_PARAMS_ALARM, VEHICLE_PARAMS_ON);
  2420. Vehicle_SetPropertyInt(vehicleid, v_bomb_timer, SetTimerEx("Vehicle_OnVehicleBombExplode", 1750, false, "ii", playerid, vehicleid));
  2421. return 1;
  2422. }
  2423.  
  2424. forward Vehicle_OnVehicleBombExplode(playerid, vehicleid);
  2425. public Vehicle_OnVehicleBombExplode(playerid, vehicleid)
  2426. {
  2427. if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
  2428. {
  2429. if( ! CallLocalFunction("OnVehicleBombDeactivate", "i", vehicleid) ||
  2430. funcidx("OnVehicleBombDeactivate") == -1)
  2431. {
  2432. return SetVehicleParams(vehicleid, VEHICLE_PARAMS_ALARM, VEHICLE_PARAMS_OFF);
  2433. }
  2434. }
  2435.  
  2436. CallLocalFunction("OnVehicleBombExplode", "i", vehicleid);
  2437.  
  2438. SetVehicleParams(vehicleid, VEHICLE_PARAMS_ALARM, VEHICLE_PARAMS_OFF);
  2439.  
  2440. new Float:pos[3];
  2441. GetVehiclePos(vehicleid, pos[0], pos[1], pos[2]);
  2442. CreateExplosion(pos[0], pos[1], pos[2], 3, 30.0);
  2443. SetVehicleToRespawn(vehicleid);
  2444.  
  2445. if(GetPlayerVehicleID(playerid) == vehicleid)
  2446. {
  2447. SetPlayerHealth(playerid, 0.0);
  2448. GameTextForPlayer(playerid, "~r~Bombed !", 3500, 3);
  2449. }
  2450.  
  2451. Vehicle_SetPropertyInt(vehicleid, v_bomb_timer, -1);
  2452. return 1;
  2453. }
  2454.  
  2455. forward OnVehicleBombDeactivate(vehicleid);
  2456. forward OnVehicleBombExplode(vehicleid);
  2457.  
  2458. stock ToggleVehicleSticky(vehicleid, bool:toggle)
  2459. {
  2460. return Vehicle_SetPropertyInt(vehicleid, v_sticky, _:toggle);
  2461. }
  2462.  
  2463. stock IsVehicleSticky(vehicleid)
  2464. {
  2465. return Vehicle_GetPropertyInt(vehicleid, v_sticky);
  2466. }
  2467.  
  2468. public OnVehicleStreamIn(vehicleid, forplayerid)
  2469. {
  2470. if(Vehicle_GetPropertyInt(vehicleid, v_update_timer) == -1)
  2471. {
  2472. Vehicle_SetPropertyInt(vehicleid, v_update_timer, SetTimerEx("OnVehicleTimeUpdate", VEHICLE_UPDATE_INTERVAL, true, "i", vehicleid));
  2473. }
  2474.  
  2475. #if defined Vehicle_OnVehicleStreamIn
  2476. return Vehicle_OnVehicleStreamIn(vehicleid, forplayerid);
  2477. #else
  2478. return 1;
  2479. #endif
  2480. }
  2481. #if defined Vehicle_OnVehicleStreamIn
  2482. forward Vehicle_OnVehicleStreamIn(vehicleid, forplayerid);
  2483. #endif
  2484. #if defined _ALS_OnVehicleStreamIn
  2485. #undef OnVehicleStreamIn
  2486. #else
  2487. #define _ALS_OnVehicleStreamIn
  2488. #endif
  2489. #define OnVehicleStreamIn Vehicle_OnVehicleStreamIn
  2490.  
  2491. public OnVehicleStreamOut(vehicleid, forplayerid)
  2492. {
  2493. if(Vehicle_GetPropertyInt(vehicleid, v_update_timer) != -1)
  2494. {
  2495. for(new i; i <= GetPlayerPoolSize(); i++)
  2496. {
  2497. if(IsVehicleStreamedIn(vehicleid, i)) break;
  2498.  
  2499. if(i == GetPlayerPoolSize())
  2500. {
  2501. KillTimer(Vehicle_GetPropertyInt(vehicleid, v_update_timer));
  2502. Vehicle_SetPropertyInt(vehicleid, v_update_timer, -1);
  2503. }
  2504. }
  2505. }
  2506.  
  2507. #if defined Vehicle_OnVehicleStreamOut
  2508. return Vehicle_OnVehicleStreamOut(vehicleid, forplayerid);
  2509. #else
  2510. return 1;
  2511. #endif
  2512. }
  2513. #if defined Vehicle_OnVehicleStreamOut
  2514. forward Vehicle_OnVehicleStreamOut(vehicleid, forplayerid);
  2515. #endif
  2516. #if defined _ALS_OnVehicleStreamOut
  2517. #undef OnVehicleStreamOut
  2518. #else
  2519. #define _ALS_OnVehicleStreamOut
  2520. #endif
  2521. #define OnVehicleStreamOut Vehicle_OnVehicleStreamOut
  2522.  
  2523. forward OnVehicleTimeUpdate(vehicleid);
  2524. public OnVehicleTimeUpdate(vehicleid)
  2525. {
  2526. new Float:FloatData[4];
  2527.  
  2528. GetVehiclePos(vehicleid, FloatData[0], FloatData[1], FloatData[2]);
  2529. GetVehicleZAngle(vehicleid, FloatData[3]);
  2530. if(IsVehicleSticky(vehicleid))
  2531. {
  2532. if( (FloatData[0] > gVehicleTempData[vehicleid][e_pos_x] + 0.5 || FloatData[0] < gVehicleTempData[vehicleid][e_pos_x] - 0.5) ||
  2533. (FloatData[1] > gVehicleTempData[vehicleid][e_pos_y] + 0.5 || FloatData[1] < gVehicleTempData[vehicleid][e_pos_y] - 0.5) ||
  2534. (FloatData[2] > gVehicleTempData[vehicleid][e_pos_z] + 0.5 || FloatData[2] < gVehicleTempData[vehicleid][e_pos_z] - 0.5) ||
  2535. (FloatData[3] > gVehicleTempData[vehicleid][e_pos_a] + 0.5 || FloatData[3] < gVehicleTempData[vehicleid][e_pos_a] - 0.5))
  2536. {
  2537. return TeleportVehicle(vehicleid, gVehicleTempData[vehicleid][e_pos_x], gVehicleTempData[vehicleid][e_pos_y], gVehicleTempData[vehicleid][e_pos_z], gVehicleTempData[vehicleid][e_pos_a], GetVehicleInterior(vehicleid), GetVehicleVirtualWorld(vehicleid));
  2538. }
  2539. }
  2540. if(funcidx("OnVehiclePosChange") != -1)
  2541. {
  2542. if( FloatData[0] != gVehicleTempData[vehicleid][e_pos_x] ||
  2543. FloatData[1] != gVehicleTempData[vehicleid][e_pos_y] ||
  2544. FloatData[2] != gVehicleTempData[vehicleid][e_pos_z] ||
  2545. FloatData[3] != gVehicleTempData[vehicleid][e_pos_a])
  2546. {
  2547. if(CallLocalFunction("OnVehiclePosChange", "iffffffff", vehicleid, FloatData[0], FloatData[1], FloatData[2], FloatData[3], gVehicleTempData[vehicleid][e_pos_x], gVehicleTempData[vehicleid][e_pos_y], gVehicleTempData[vehicleid][e_pos_z], gVehicleTempData[vehicleid][e_pos_a]))
  2548. {
  2549. gVehicleTempData[vehicleid][e_pos_x] = FloatData[0];
  2550. gVehicleTempData[vehicleid][e_pos_y] = FloatData[1];
  2551. gVehicleTempData[vehicleid][e_pos_z] = FloatData[2];
  2552. gVehicleTempData[vehicleid][e_pos_a] = FloatData[3];
  2553. }
  2554. else
  2555. {
  2556. return TeleportVehicle(vehicleid, gVehicleTempData[vehicleid][e_pos_x], gVehicleTempData[vehicleid][e_pos_y], gVehicleTempData[vehicleid][e_pos_z], gVehicleTempData[vehicleid][e_pos_a], GetVehicleInterior(vehicleid), GetVehicleVirtualWorld(vehicleid));
  2557. }
  2558. }
  2559. }
  2560.  
  2561. GetVehicleVelocity(vehicleid, FloatData[0], FloatData[1], FloatData[2]);
  2562. if(funcidx("OnVehicleVelocityChange") != -1)
  2563. {
  2564. if( FloatData[0] != gVehicleTempData[vehicleid][e_vel_x] ||
  2565. FloatData[1] != gVehicleTempData[vehicleid][e_vel_y] ||
  2566. FloatData[2] != gVehicleTempData[vehicleid][e_vel_z])
  2567. {
  2568. if(CallLocalFunction("OnVehicleVelocityChange", "iffffff", vehicleid, FloatData[0], FloatData[1], FloatData[2], gVehicleTempData[vehicleid][e_vel_x], gVehicleTempData[vehicleid][e_vel_y], gVehicleTempData[vehicleid][e_vel_z]))
  2569. {
  2570. gVehicleTempData[vehicleid][e_vel_x] = FloatData[0];
  2571. gVehicleTempData[vehicleid][e_vel_y] = FloatData[1];
  2572. gVehicleTempData[vehicleid][e_vel_z] = FloatData[2];
  2573. }
  2574. else
  2575. {
  2576. return SetVehicleVelocity(vehicleid, gVehicleTempData[vehicleid][e_vel_x], gVehicleTempData[vehicleid][e_vel_y], gVehicleTempData[vehicleid][e_vel_z]);
  2577. }
  2578. }
  2579. }
  2580.  
  2581. GetVehicleHealth(vehicleid, FloatData[0]);
  2582. if(funcidx("OnVehicleHealthChange") != -1)
  2583. {
  2584. if(FloatData[0] != gVehicleTempData[vehicleid][e_health])
  2585. {
  2586. if(CallLocalFunction("OnVehicleHealthChange", "iff", vehicleid, FloatData[0], gVehicleTempData[vehicleid][e_health]))
  2587. {
  2588. gVehicleTempData[vehicleid][e_health] = FloatData[0];
  2589. }
  2590. else
  2591. {
  2592. return SetVehicleHealth(vehicleid, gVehicleTempData[vehicleid][e_health]);
  2593. }
  2594. }
  2595. }
  2596. return 1;
  2597. }
  2598.  
  2599. forward OnVehiclePosChange(vehicleid, Float:newx, Float:newy, Float:newz, Float:newrotation, Float:oldx, Float:oldy, Float:oldz, Float:oldrotation);
  2600. forward OnVehicleVelocityChange(vehicleid, Float:newx, Float:newy, Float:newz, Float:oldx, Float:oldy, Float:oldz);
  2601. forward OnVehicleHealthChange(vehicleid, Float:newhealth, Float:oldhealth);
  2602.  
  2603. stock CountAllVehicles()
  2604. {
  2605. new count;
  2606. for(new i; i <= GetVehiclePoolSize(); i++)
  2607. {
  2608. if(IsValidVehicle(i))
  2609. {
  2610. count += 1;
  2611. }
  2612. }
  2613. return count;
  2614. }
  2615.  
  2616. stock DestroyAllVehicles()
  2617. {
  2618. for(new i; i <= GetVehiclePoolSize(); i++)
  2619. {
  2620. if(IsValidVehicle(i))
  2621. {
  2622. DestroyVehicle(i);
  2623. }
  2624. }
  2625. return true;
  2626. }
Advertisement
Add Comment
Please, Sign In to add comment