Advertisement
Guest User

Untitled

a guest
Sep 6th, 2015
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 102.09 KB | None | 0 0
  1. //==========================================================
  2. // Advanced Vehicle System version 1.0 by MadeMan
  3. //==========================================================
  4.  
  5. #define FILTERSCRIPT
  6.  
  7. #include <a_samp>
  8.  
  9. //=========================SETTINGS=========================
  10.  
  11. #undef MAX_PLAYERS
  12. #define MAX_PLAYERS 100
  13.  
  14. #define MAX_DVEHICLES 200
  15. #define MAX_DEALERSHIPS 10
  16. #define MAX_FUEL_STATIONS 10
  17.  
  18. #define VEHICLE_FILE_PATH "AVS/Vehicles/"
  19. #define DEALERSHIP_FILE_PATH "AVS/Dealerships/"
  20. #define FUEL_STATION_FILE_PATH "AVS/FuelStations/"
  21.  
  22. #define MAX_PLAYER_VEHICLES 3
  23. #define FUEL_PRICE 5
  24. #define GAS_CAN_PRICE 500
  25. #define ALARM_TIME 10000 // alarm duration in milliseconds (1 second = 1000 milliseconds)
  26. #define DEFAULT_NUMBER_PLATE "123 ABC"
  27.  
  28. //==========================================================
  29.  
  30. #define COLOR_BLACK 0x000000FF
  31. #define COLOR_RED 0xEE0000FF
  32. #define COLOR_GREEN 0x00CC00FF
  33. #define COLOR_BLUE 0x0000FFFF
  34. #define COLOR_ORANGE 0xFF6600FF
  35. #define COLOR_YELLOW 0xFFFF00FF
  36. #define COLOR_LIGHTBLUE 0x00FFFFFF
  37. #define COLOR_PURPLE 0xC2A2DAFF
  38. #define COLOR_GREY 0xC0C0C0FF
  39. #define COLOR_WHITE 0xFFFFFFFF
  40.  
  41. #define VEHICLE_DEALERSHIP 1
  42. #define VEHICLE_PLAYER 2
  43.  
  44. #define DIALOG_NONE 12345
  45. #define DIALOG_ERROR 12346
  46. #define DIALOG_VEHICLE 500
  47. #define DIALOG_VEHICLE_BUY 501
  48. #define DIALOG_VEHICLE_SELL 502
  49. #define DIALOG_FINDVEHICLE 503
  50. #define DIALOG_TRUNK 504
  51. #define DIALOG_TRUNK_ACTION 505
  52. #define DIALOG_VEHICLE_PLATE 507
  53. #define DIALOG_FUEL 510
  54. #define DIALOG_EDITVEHICLE 606
  55.  
  56. #define CMD:%1(%2) \
  57. forward cmd_%1(%2); \
  58. public cmd_%1(%2)
  59.  
  60. #define ShowErrorDialog(%1,%2) ShowPlayerDialog(%1, DIALOG_ERROR, DIALOG_STYLE_MSGBOX, "ERROR", %2, "OK", "")
  61.  
  62. new maintimer;
  63. new speedotimer;
  64. new savetimer;
  65.  
  66. new SaveVehicleIndex;
  67.  
  68. new RefuelTime[MAX_PLAYERS];
  69. new TrackCar[MAX_PLAYERS];
  70. new DialogReturn[MAX_PLAYERS];
  71.  
  72. new Text:SpeedoBox;
  73. new Text:SpeedoText[MAX_PLAYERS];
  74.  
  75. new Float:Fuel[MAX_VEHICLES] = {100.0, ...};
  76. new VehicleSecurity[MAX_VEHICLES];
  77.  
  78. new VehicleCreated[MAX_DVEHICLES];
  79. new VehicleID[MAX_DVEHICLES];
  80. new VehicleModel[MAX_DVEHICLES];
  81. new Float:VehiclePos[MAX_DVEHICLES][4];
  82. new VehicleColor[MAX_DVEHICLES][2];
  83. new VehicleInterior[MAX_DVEHICLES];
  84. new VehicleWorld[MAX_DVEHICLES];
  85. new VehicleOwner[MAX_DVEHICLES][MAX_PLAYER_NAME];
  86. new VehicleNumberPlate[MAX_DVEHICLES][16];
  87. new VehicleValue[MAX_DVEHICLES];
  88. new VehicleTrunk[MAX_DVEHICLES][5][2];
  89. new VehicleMods[MAX_DVEHICLES][14];
  90. new VehiclePaintjob[MAX_DVEHICLES] = {255, ...};
  91. new Text3D:VehicleLabel[MAX_DVEHICLES];
  92.  
  93. new DealershipCreated[MAX_DEALERSHIPS];
  94. new Float:DealershipPos[MAX_DEALERSHIPS][3];
  95. new Text3D:DealershipLabel[MAX_DEALERSHIPS];
  96.  
  97. new FuelStationCreated[MAX_FUEL_STATIONS];
  98. new Float:FuelStationPos[MAX_FUEL_STATIONS][3];
  99. new Text3D:FuelStationLabel[MAX_FUEL_STATIONS];
  100.  
  101. new VehicleNames[][] = {
  102. "Landstalker","Bravura","Buffalo","Linerunner","Perennial","Sentinel","Dumper","Firetruck","Trashmaster","Stretch","Manana","Infernus",
  103. "Voodoo","Pony","Mule","Cheetah","Ambulance","Leviathan","Moonbeam","Esperanto","Taxi","Washington","Bobcat","Mr Whoopee","BF Injection",
  104. "Hunter","Premier","Enforcer","Securicar","Banshee","Predator","Bus","Rhino","Barracks","Hotknife","Trailer","Previon","Coach","Cabbie",
  105. "Stallion","Rumpo","RC Bandit","Romero","Packer","Monster","Admiral","Squalo","Seasparrow","Pizzaboy","Tram","Trailer","Turismo","Speeder",
  106. "Reefer","Tropic","Flatbed","Yankee","Caddy","Solair","Berkley's RC Van","Skimmer","PCJ-600","Faggio","Freeway","RC Baron","RC Raider",
  107. "Glendale","Oceanic","Sanchez","Sparrow","Patriot","Quad","Coastguard","Dinghy","Hermes","Sabre","Rustler","ZR3 50","Walton","Regina",
  108. "Comet","BMX","Burrito","Camper","Marquis","Baggage","Dozer","Maverick","News Chopper","Rancher","FBI Rancher","Virgo","Greenwood",
  109. "Jetmax","Hotring","Sandking","Blista Compact","Police Maverick","Boxville","Benson","Mesa","RC Goblin","Hotring Racer A","Hotring Racer B",
  110. "Bloodring Banger","Rancher","Super GT","Elegant","Journey","Bike","Mountain Bike","Beagle","Cropdust","Stunt","Tanker","RoadTrain",
  111. "Nebula","Majestic","Buccaneer","Shamal","Hydra","FCR-900","NRG-500","HPV1000","Cement Truck","Tow Truck","Fortune","Cadrona","FBI Truck",
  112. "Willard","Forklift","Tractor","Combine","Feltzer","Remington","Slamvan","Blade","Freight","Streak","Vortex","Vincent","Bullet","Clover",
  113. "Sadler","Firetruck","Hustler","Intruder","Primo","Cargobob","Tampa","Sunrise","Merit","Utility","Nevada","Yosemite","Windsor","Monster A",
  114. "Monster B","Uranus","Jester","Sultan","Stratum","Elegy","Raindance","RC Tiger","Flash","Tahoma","Savanna","Bandito","Freight","Trailer",
  115. "Kart","Mower","Duneride","Sweeper","Broadway","Tornado","AT-400","DFT-30","Huntley","Stafford","BF-400","Newsvan","Tug","Trailer A","Emperor",
  116. "Wayfarer","Euros","Hotdog","Club","Trailer B","Trailer C","Andromada","Dodo","RC Cam","Launch","Police Car (LSPD)","Police Car (SFPD)",
  117. "Police Car (LVPD)","Police Ranger","Picador","S.W.A.T. Van","Alpha","Phoenix","Glendale","Sadler","Luggage Trailer A","Luggage Trailer B",
  118. "Stair Trailer","Boxville","Farm Plow","Utility Trailer"
  119. };
  120.  
  121. enum MainZone
  122. {
  123. Zone_Name[28],
  124. Float:Zone_Area[6]
  125. }
  126.  
  127. static const SanAndreasZones[][MainZone] = {
  128.  
  129. {"The Big Ear", {-410.00,1403.30,-3.00,-137.90,1681.20,200.00}},
  130. {"Aldea Malvada", {-1372.10,2498.50,0.00,-1277.50,2615.30,200.00}},
  131. {"Angel Pine", {-2324.90,-2584.20,-6.10,-1964.20,-2212.10,200.00}},
  132. {"Arco del Oeste", {-901.10,2221.80,0.00,-592.00,2571.90,200.00}},
  133. {"Avispa Country Club", {-2646.40,-355.40,0.00,-2270.00,-222.50,200.00}},
  134. {"Avispa Country Club", {-2831.80,-430.20,-6.10,-2646.40,-222.50,200.00}},
  135. {"Avispa Country Club", {-2361.50,-417.10,0.00,-2270.00,-355.40,200.00}},
  136. {"Avispa Country Club", {-2667.80,-302.10,-28.80,-2646.40,-262.30,71.10}},
  137. {"Avispa Country Club", {-2470.00,-355.40,0.00,-2270.00,-318.40,46.10}},
  138. {"Avispa Country Club", {-2550.00,-355.40,0.00,-2470.00,-318.40,39.70}},
  139. {"Back o Beyond", {-1166.90,-2641.10,0.00,-321.70,-1856.00,200.00}},
  140. {"Battery Point", {-2741.00,1268.40,-4.50,-2533.00,1490.40,200.00}},
  141. {"Bayside", {-2741.00,2175.10,0.00,-2353.10,2722.70,200.00}},
  142. {"Bayside Marina", {-2353.10,2275.70,0.00,-2153.10,2475.70,200.00}},
  143. {"Beacon Hill", {-399.60,-1075.50,-1.40,-319.00,-977.50,198.50}},
  144. {"Blackfield", {964.30,1203.20,-89.00,1197.30,1403.20,110.90}},
  145. {"Blackfield", {964.30,1403.20,-89.00,1197.30,1726.20,110.90}},
  146. {"Blackfield Chapel", {1375.60,596.30,-89.00,1558.00,823.20,110.90}},
  147. {"Blackfield Chapel", {1325.60,596.30,-89.00,1375.60,795.00,110.90}},
  148. {"Blackfield Intersection", {1197.30,1044.60,-89.00,1277.00,1163.30,110.90}},
  149. {"Blackfield Intersection", {1166.50,795.00,-89.00,1375.60,1044.60,110.90}},
  150. {"Blackfield Intersection", {1277.00,1044.60,-89.00,1315.30,1087.60,110.90}},
  151. {"Blackfield Intersection", {1375.60,823.20,-89.00,1457.30,919.40,110.90}},
  152. {"Blueberry", {104.50,-220.10,2.30,349.60,152.20,200.00}},
  153. {"Blueberry", {19.60,-404.10,3.80,349.60,-220.10,200.00}},
  154. {"Blueberry Acres", {-319.60,-220.10,0.00,104.50,293.30,200.00}},
  155. {"Caligula's Palace", {2087.30,1543.20,-89.00,2437.30,1703.20,110.90}},
  156. {"Caligula's Palace", {2137.40,1703.20,-89.00,2437.30,1783.20,110.90}},
  157. {"Calton Heights", {-2274.10,744.10,-6.10,-1982.30,1358.90,200.00}},
  158. {"Chinatown", {-2274.10,578.30,-7.60,-2078.60,744.10,200.00}},
  159. {"City Hall", {-2867.80,277.40,-9.10,-2593.40,458.40,200.00}},
  160. {"Come-A-Lot", {2087.30,943.20,-89.00,2623.10,1203.20,110.90}},
  161. {"Commerce", {1323.90,-1842.20,-89.00,1701.90,-1722.20,110.90}},
  162. {"Commerce", {1323.90,-1722.20,-89.00,1440.90,-1577.50,110.90}},
  163. {"Commerce", {1370.80,-1577.50,-89.00,1463.90,-1384.90,110.90}},
  164. {"Commerce", {1463.90,-1577.50,-89.00,1667.90,-1430.80,110.90}},
  165. {"Commerce", {1583.50,-1722.20,-89.00,1758.90,-1577.50,110.90}},
  166. {"Commerce", {1667.90,-1577.50,-89.00,1812.60,-1430.80,110.90}},
  167. {"Conference Center", {1046.10,-1804.20,-89.00,1323.90,-1722.20,110.90}},
  168. {"Conference Center", {1073.20,-1842.20,-89.00,1323.90,-1804.20,110.90}},
  169. {"Cranberry Station", {-2007.80,56.30,0.00,-1922.00,224.70,100.00}},
  170. {"Creek", {2749.90,1937.20,-89.00,2921.60,2669.70,110.90}},
  171. {"Dillimore", {580.70,-674.80,-9.50,861.00,-404.70,200.00}},
  172. {"Doherty", {-2270.00,-324.10,-0.00,-1794.90,-222.50,200.00}},
  173. {"Doherty", {-2173.00,-222.50,-0.00,-1794.90,265.20,200.00}},
  174. {"Downtown", {-1982.30,744.10,-6.10,-1871.70,1274.20,200.00}},
  175. {"Downtown", {-1871.70,1176.40,-4.50,-1620.30,1274.20,200.00}},
  176. {"Downtown", {-1700.00,744.20,-6.10,-1580.00,1176.50,200.00}},
  177. {"Downtown", {-1580.00,744.20,-6.10,-1499.80,1025.90,200.00}},
  178. {"Downtown", {-2078.60,578.30,-7.60,-1499.80,744.20,200.00}},
  179. {"Downtown", {-1993.20,265.20,-9.10,-1794.90,578.30,200.00}},
  180. {"Downtown Los Santos", {1463.90,-1430.80,-89.00,1724.70,-1290.80,110.90}},
  181. {"Downtown Los Santos", {1724.70,-1430.80,-89.00,1812.60,-1250.90,110.90}},
  182. {"Downtown Los Santos", {1463.90,-1290.80,-89.00,1724.70,-1150.80,110.90}},
  183. {"Downtown Los Santos", {1370.80,-1384.90,-89.00,1463.90,-1170.80,110.90}},
  184. {"Downtown Los Santos", {1724.70,-1250.90,-89.00,1812.60,-1150.80,110.90}},
  185. {"Downtown Los Santos", {1370.80,-1170.80,-89.00,1463.90,-1130.80,110.90}},
  186. {"Downtown Los Santos", {1378.30,-1130.80,-89.00,1463.90,-1026.30,110.90}},
  187. {"Downtown Los Santos", {1391.00,-1026.30,-89.00,1463.90,-926.90,110.90}},
  188. {"Downtown Los Santos", {1507.50,-1385.20,110.90,1582.50,-1325.30,335.90}},
  189. {"East Beach", {2632.80,-1852.80,-89.00,2959.30,-1668.10,110.90}},
  190. {"East Beach", {2632.80,-1668.10,-89.00,2747.70,-1393.40,110.90}},
  191. {"East Beach", {2747.70,-1668.10,-89.00,2959.30,-1498.60,110.90}},
  192. {"East Beach", {2747.70,-1498.60,-89.00,2959.30,-1120.00,110.90}},
  193. {"East Los Santos", {2421.00,-1628.50,-89.00,2632.80,-1454.30,110.90}},
  194. {"East Los Santos", {2222.50,-1628.50,-89.00,2421.00,-1494.00,110.90}},
  195. {"East Los Santos", {2266.20,-1494.00,-89.00,2381.60,-1372.00,110.90}},
  196. {"East Los Santos", {2381.60,-1494.00,-89.00,2421.00,-1454.30,110.90}},
  197. {"East Los Santos", {2281.40,-1372.00,-89.00,2381.60,-1135.00,110.90}},
  198. {"East Los Santos", {2381.60,-1454.30,-89.00,2462.10,-1135.00,110.90}},
  199. {"East Los Santos", {2462.10,-1454.30,-89.00,2581.70,-1135.00,110.90}},
  200. {"Easter Basin", {-1794.90,249.90,-9.10,-1242.90,578.30,200.00}},
  201. {"Easter Basin", {-1794.90,-50.00,-0.00,-1499.80,249.90,200.00}},
  202. {"Easter Bay Airport", {-1499.80,-50.00,-0.00,-1242.90,249.90,200.00}},
  203. {"Easter Bay Airport", {-1794.90,-730.10,-3.00,-1213.90,-50.00,200.00}},
  204. {"Easter Bay Airport", {-1213.90,-730.10,0.00,-1132.80,-50.00,200.00}},
  205. {"Easter Bay Airport", {-1242.90,-50.00,0.00,-1213.90,578.30,200.00}},
  206. {"Easter Bay Airport", {-1213.90,-50.00,-4.50,-947.90,578.30,200.00}},
  207. {"Easter Bay Airport", {-1315.40,-405.30,15.40,-1264.40,-209.50,25.40}},
  208. {"Easter Bay Airport", {-1354.30,-287.30,15.40,-1315.40,-209.50,25.40}},
  209. {"Easter Bay Airport", {-1490.30,-209.50,15.40,-1264.40,-148.30,25.40}},
  210. {"Easter Bay Chemicals", {-1132.80,-768.00,0.00,-956.40,-578.10,200.00}},
  211. {"Easter Bay Chemicals", {-1132.80,-787.30,0.00,-956.40,-768.00,200.00}},
  212. {"El Castillo del Diablo", {-464.50,2217.60,0.00,-208.50,2580.30,200.00}},
  213. {"El Castillo del Diablo", {-208.50,2123.00,-7.60,114.00,2337.10,200.00}},
  214. {"El Castillo del Diablo", {-208.50,2337.10,0.00,8.40,2487.10,200.00}},
  215. {"El Corona", {1812.60,-2179.20,-89.00,1970.60,-1852.80,110.90}},
  216. {"El Corona", {1692.60,-2179.20,-89.00,1812.60,-1842.20,110.90}},
  217. {"El Quebrados", {-1645.20,2498.50,0.00,-1372.10,2777.80,200.00}},
  218. {"Esplanade East", {-1620.30,1176.50,-4.50,-1580.00,1274.20,200.00}},
  219. {"Esplanade East", {-1580.00,1025.90,-6.10,-1499.80,1274.20,200.00}},
  220. {"Esplanade East", {-1499.80,578.30,-79.60,-1339.80,1274.20,20.30}},
  221. {"Esplanade North", {-2533.00,1358.90,-4.50,-1996.60,1501.20,200.00}},
  222. {"Esplanade North", {-1996.60,1358.90,-4.50,-1524.20,1592.50,200.00}},
  223. {"Esplanade North", {-1982.30,1274.20,-4.50,-1524.20,1358.90,200.00}},
  224. {"Fallen Tree", {-792.20,-698.50,-5.30,-452.40,-380.00,200.00}},
  225. {"Fallow Bridge", {434.30,366.50,0.00,603.00,555.60,200.00}},
  226. {"Fern Ridge", {508.10,-139.20,0.00,1306.60,119.50,200.00}},
  227. {"Financial", {-1871.70,744.10,-6.10,-1701.30,1176.40,300.00}},
  228. {"Fisher's Lagoon", {1916.90,-233.30,-100.00,2131.70,13.80,200.00}},
  229. {"Flint Intersection", {-187.70,-1596.70,-89.00,17.00,-1276.60,110.90}},
  230. {"Flint Range", {-594.10,-1648.50,0.00,-187.70,-1276.60,200.00}},
  231. {"Fort Carson", {-376.20,826.30,-3.00,123.70,1220.40,200.00}},
  232. {"Foster Valley", {-2270.00,-430.20,-0.00,-2178.60,-324.10,200.00}},
  233. {"Foster Valley", {-2178.60,-599.80,-0.00,-1794.90,-324.10,200.00}},
  234. {"Foster Valley", {-2178.60,-1115.50,0.00,-1794.90,-599.80,200.00}},
  235. {"Foster Valley", {-2178.60,-1250.90,0.00,-1794.90,-1115.50,200.00}},
  236. {"Frederick Bridge", {2759.20,296.50,0.00,2774.20,594.70,200.00}},
  237. {"Gant Bridge", {-2741.40,1659.60,-6.10,-2616.40,2175.10,200.00}},
  238. {"Gant Bridge", {-2741.00,1490.40,-6.10,-2616.40,1659.60,200.00}},
  239. {"Ganton", {2222.50,-1852.80,-89.00,2632.80,-1722.30,110.90}},
  240. {"Ganton", {2222.50,-1722.30,-89.00,2632.80,-1628.50,110.90}},
  241. {"Garcia", {-2411.20,-222.50,-0.00,-2173.00,265.20,200.00}},
  242. {"Garcia", {-2395.10,-222.50,-5.30,-2354.00,-204.70,200.00}},
  243. {"Garver Bridge", {-1339.80,828.10,-89.00,-1213.90,1057.00,110.90}},
  244. {"Garver Bridge", {-1213.90,950.00,-89.00,-1087.90,1178.90,110.90}},
  245. {"Garver Bridge", {-1499.80,696.40,-179.60,-1339.80,925.30,20.30}},
  246. {"Glen Park", {1812.60,-1449.60,-89.00,1996.90,-1350.70,110.90}},
  247. {"Glen Park", {1812.60,-1100.80,-89.00,1994.30,-973.30,110.90}},
  248. {"Glen Park", {1812.60,-1350.70,-89.00,2056.80,-1100.80,110.90}},
  249. {"Green Palms", {176.50,1305.40,-3.00,338.60,1520.70,200.00}},
  250. {"Greenglass College", {964.30,1044.60,-89.00,1197.30,1203.20,110.90}},
  251. {"Greenglass College", {964.30,930.80,-89.00,1166.50,1044.60,110.90}},
  252. {"Hampton Barns", {603.00,264.30,0.00,761.90,366.50,200.00}},
  253. {"Hankypanky Point", {2576.90,62.10,0.00,2759.20,385.50,200.00}},
  254. {"Harry Gold Parkway", {1777.30,863.20,-89.00,1817.30,2342.80,110.90}},
  255. {"Hashbury", {-2593.40,-222.50,-0.00,-2411.20,54.70,200.00}},
  256. {"Hilltop Farm", {967.30,-450.30,-3.00,1176.70,-217.90,200.00}},
  257. {"Hunter Quarry", {337.20,710.80,-115.20,860.50,1031.70,203.70}},
  258. {"Idlewood", {1812.60,-1852.80,-89.00,1971.60,-1742.30,110.90}},
  259. {"Idlewood", {1812.60,-1742.30,-89.00,1951.60,-1602.30,110.90}},
  260. {"Idlewood", {1951.60,-1742.30,-89.00,2124.60,-1602.30,110.90}},
  261. {"Idlewood", {1812.60,-1602.30,-89.00,2124.60,-1449.60,110.90}},
  262. {"Idlewood", {2124.60,-1742.30,-89.00,2222.50,-1494.00,110.90}},
  263. {"Idlewood", {1971.60,-1852.80,-89.00,2222.50,-1742.30,110.90}},
  264. {"Jefferson", {1996.90,-1449.60,-89.00,2056.80,-1350.70,110.90}},
  265. {"Jefferson", {2124.60,-1494.00,-89.00,2266.20,-1449.60,110.90}},
  266. {"Jefferson", {2056.80,-1372.00,-89.00,2281.40,-1210.70,110.90}},
  267. {"Jefferson", {2056.80,-1210.70,-89.00,2185.30,-1126.30,110.90}},
  268. {"Jefferson", {2185.30,-1210.70,-89.00,2281.40,-1154.50,110.90}},
  269. {"Jefferson", {2056.80,-1449.60,-89.00,2266.20,-1372.00,110.90}},
  270. {"Julius Thruway East", {2623.10,943.20,-89.00,2749.90,1055.90,110.90}},
  271. {"Julius Thruway East", {2685.10,1055.90,-89.00,2749.90,2626.50,110.90}},
  272. {"Julius Thruway East", {2536.40,2442.50,-89.00,2685.10,2542.50,110.90}},
  273. {"Julius Thruway East", {2625.10,2202.70,-89.00,2685.10,2442.50,110.90}},
  274. {"Julius Thruway North", {2498.20,2542.50,-89.00,2685.10,2626.50,110.90}},
  275. {"Julius Thruway North", {2237.40,2542.50,-89.00,2498.20,2663.10,110.90}},
  276. {"Julius Thruway North", {2121.40,2508.20,-89.00,2237.40,2663.10,110.90}},
  277. {"Julius Thruway North", {1938.80,2508.20,-89.00,2121.40,2624.20,110.90}},
  278. {"Julius Thruway North", {1534.50,2433.20,-89.00,1848.40,2583.20,110.90}},
  279. {"Julius Thruway North", {1848.40,2478.40,-89.00,1938.80,2553.40,110.90}},
  280. {"Julius Thruway North", {1704.50,2342.80,-89.00,1848.40,2433.20,110.90}},
  281. {"Julius Thruway North", {1377.30,2433.20,-89.00,1534.50,2507.20,110.90}},
  282. {"Julius Thruway South", {1457.30,823.20,-89.00,2377.30,863.20,110.90}},
  283. {"Julius Thruway South", {2377.30,788.80,-89.00,2537.30,897.90,110.90}},
  284. {"Julius Thruway West", {1197.30,1163.30,-89.00,1236.60,2243.20,110.90}},
  285. {"Julius Thruway West", {1236.60,2142.80,-89.00,1297.40,2243.20,110.90}},
  286. {"Juniper Hill", {-2533.00,578.30,-7.60,-2274.10,968.30,200.00}},
  287. {"Juniper Hollow", {-2533.00,968.30,-6.10,-2274.10,1358.90,200.00}},
  288. {"K.A.C.C. Military Fuels", {2498.20,2626.50,-89.00,2749.90,2861.50,110.90}},
  289. {"Kincaid Bridge", {-1339.80,599.20,-89.00,-1213.90,828.10,110.90}},
  290. {"Kincaid Bridge", {-1213.90,721.10,-89.00,-1087.90,950.00,110.90}},
  291. {"Kincaid Bridge", {-1087.90,855.30,-89.00,-961.90,986.20,110.90}},
  292. {"King's", {-2329.30,458.40,-7.60,-1993.20,578.30,200.00}},
  293. {"King's", {-2411.20,265.20,-9.10,-1993.20,373.50,200.00}},
  294. {"King's", {-2253.50,373.50,-9.10,-1993.20,458.40,200.00}},
  295. {"LVA Freight Depot", {1457.30,863.20,-89.00,1777.40,1143.20,110.90}},
  296. {"LVA Freight Depot", {1375.60,919.40,-89.00,1457.30,1203.20,110.90}},
  297. {"LVA Freight Depot", {1277.00,1087.60,-89.00,1375.60,1203.20,110.90}},
  298. {"LVA Freight Depot", {1315.30,1044.60,-89.00,1375.60,1087.60,110.90}},
  299. {"LVA Freight Depot", {1236.60,1163.40,-89.00,1277.00,1203.20,110.90}},
  300. {"Las Barrancas", {-926.10,1398.70,-3.00,-719.20,1634.60,200.00}},
  301. {"Las Brujas", {-365.10,2123.00,-3.00,-208.50,2217.60,200.00}},
  302. {"Las Colinas", {1994.30,-1100.80,-89.00,2056.80,-920.80,110.90}},
  303. {"Las Colinas", {2056.80,-1126.30,-89.00,2126.80,-920.80,110.90}},
  304. {"Las Colinas", {2185.30,-1154.50,-89.00,2281.40,-934.40,110.90}},
  305. {"Las Colinas", {2126.80,-1126.30,-89.00,2185.30,-934.40,110.90}},
  306. {"Las Colinas", {2747.70,-1120.00,-89.00,2959.30,-945.00,110.90}},
  307. {"Las Colinas", {2632.70,-1135.00,-89.00,2747.70,-945.00,110.90}},
  308. {"Las Colinas", {2281.40,-1135.00,-89.00,2632.70,-945.00,110.90}},
  309. {"Las Payasadas", {-354.30,2580.30,2.00,-133.60,2816.80,200.00}},
  310. {"Las Venturas Airport", {1236.60,1203.20,-89.00,1457.30,1883.10,110.90}},
  311. {"Las Venturas Airport", {1457.30,1203.20,-89.00,1777.30,1883.10,110.90}},
  312. {"Las Venturas Airport", {1457.30,1143.20,-89.00,1777.40,1203.20,110.90}},
  313. {"Las Venturas Airport", {1515.80,1586.40,-12.50,1729.90,1714.50,87.50}},
  314. {"Last Dime Motel", {1823.00,596.30,-89.00,1997.20,823.20,110.90}},
  315. {"Leafy Hollow", {-1166.90,-1856.00,0.00,-815.60,-1602.00,200.00}},
  316. {"Liberty City", {-1000.00,400.00,1300.00,-700.00,600.00,1400.00}},
  317. {"Lil' Probe Inn", {-90.20,1286.80,-3.00,153.80,1554.10,200.00}},
  318. {"Linden Side", {2749.90,943.20,-89.00,2923.30,1198.90,110.90}},
  319. {"Linden Station", {2749.90,1198.90,-89.00,2923.30,1548.90,110.90}},
  320. {"Linden Station", {2811.20,1229.50,-39.50,2861.20,1407.50,60.40}},
  321. {"Little Mexico", {1701.90,-1842.20,-89.00,1812.60,-1722.20,110.90}},
  322. {"Little Mexico", {1758.90,-1722.20,-89.00,1812.60,-1577.50,110.90}},
  323. {"Los Flores", {2581.70,-1454.30,-89.00,2632.80,-1393.40,110.90}},
  324. {"Los Flores", {2581.70,-1393.40,-89.00,2747.70,-1135.00,110.90}},
  325. {"Los Santos International", {1249.60,-2394.30,-89.00,1852.00,-2179.20,110.90}},
  326. {"Los Santos International", {1852.00,-2394.30,-89.00,2089.00,-2179.20,110.90}},
  327. {"Los Santos International", {1382.70,-2730.80,-89.00,2201.80,-2394.30,110.90}},
  328. {"Los Santos International", {1974.60,-2394.30,-39.00,2089.00,-2256.50,60.90}},
  329. {"Los Santos International", {1400.90,-2669.20,-39.00,2189.80,-2597.20,60.90}},
  330. {"Los Santos International", {2051.60,-2597.20,-39.00,2152.40,-2394.30,60.90}},
  331. {"Marina", {647.70,-1804.20,-89.00,851.40,-1577.50,110.90}},
  332. {"Marina", {647.70,-1577.50,-89.00,807.90,-1416.20,110.90}},
  333. {"Marina", {807.90,-1577.50,-89.00,926.90,-1416.20,110.90}},
  334. {"Market", {787.40,-1416.20,-89.00,1072.60,-1310.20,110.90}},
  335. {"Market", {952.60,-1310.20,-89.00,1072.60,-1130.80,110.90}},
  336. {"Market", {1072.60,-1416.20,-89.00,1370.80,-1130.80,110.90}},
  337. {"Market", {926.90,-1577.50,-89.00,1370.80,-1416.20,110.90}},
  338. {"Market Station", {787.40,-1410.90,-34.10,866.00,-1310.20,65.80}},
  339. {"Martin Bridge", {-222.10,293.30,0.00,-122.10,476.40,200.00}},
  340. {"Missionary Hill", {-2994.40,-811.20,0.00,-2178.60,-430.20,200.00}},
  341. {"Montgomery", {1119.50,119.50,-3.00,1451.40,493.30,200.00}},
  342. {"Montgomery", {1451.40,347.40,-6.10,1582.40,420.80,200.00}},
  343. {"Montgomery Intersection", {1546.60,208.10,0.00,1745.80,347.40,200.00}},
  344. {"Montgomery Intersection", {1582.40,347.40,0.00,1664.60,401.70,200.00}},
  345. {"Mulholland", {1414.00,-768.00,-89.00,1667.60,-452.40,110.90}},
  346. {"Mulholland", {1281.10,-452.40,-89.00,1641.10,-290.90,110.90}},
  347. {"Mulholland", {1269.10,-768.00,-89.00,1414.00,-452.40,110.90}},
  348. {"Mulholland", {1357.00,-926.90,-89.00,1463.90,-768.00,110.90}},
  349. {"Mulholland", {1318.10,-910.10,-89.00,1357.00,-768.00,110.90}},
  350. {"Mulholland", {1169.10,-910.10,-89.00,1318.10,-768.00,110.90}},
  351. {"Mulholland", {768.60,-954.60,-89.00,952.60,-860.60,110.90}},
  352. {"Mulholland", {687.80,-860.60,-89.00,911.80,-768.00,110.90}},
  353. {"Mulholland", {737.50,-768.00,-89.00,1142.20,-674.80,110.90}},
  354. {"Mulholland", {1096.40,-910.10,-89.00,1169.10,-768.00,110.90}},
  355. {"Mulholland", {952.60,-937.10,-89.00,1096.40,-860.60,110.90}},
  356. {"Mulholland", {911.80,-860.60,-89.00,1096.40,-768.00,110.90}},
  357. {"Mulholland", {861.00,-674.80,-89.00,1156.50,-600.80,110.90}},
  358. {"Mulholland Intersection", {1463.90,-1150.80,-89.00,1812.60,-768.00,110.90}},
  359. {"North Rock", {2285.30,-768.00,0.00,2770.50,-269.70,200.00}},
  360. {"Ocean Docks", {2373.70,-2697.00,-89.00,2809.20,-2330.40,110.90}},
  361. {"Ocean Docks", {2201.80,-2418.30,-89.00,2324.00,-2095.00,110.90}},
  362. {"Ocean Docks", {2324.00,-2302.30,-89.00,2703.50,-2145.10,110.90}},
  363. {"Ocean Docks", {2089.00,-2394.30,-89.00,2201.80,-2235.80,110.90}},
  364. {"Ocean Docks", {2201.80,-2730.80,-89.00,2324.00,-2418.30,110.90}},
  365. {"Ocean Docks", {2703.50,-2302.30,-89.00,2959.30,-2126.90,110.90}},
  366. {"Ocean Docks", {2324.00,-2145.10,-89.00,2703.50,-2059.20,110.90}},
  367. {"Ocean Flats", {-2994.40,277.40,-9.10,-2867.80,458.40,200.00}},
  368. {"Ocean Flats", {-2994.40,-222.50,-0.00,-2593.40,277.40,200.00}},
  369. {"Ocean Flats", {-2994.40,-430.20,-0.00,-2831.80,-222.50,200.00}},
  370. {"Octane Springs", {338.60,1228.50,0.00,664.30,1655.00,200.00}},
  371. {"Old Venturas Strip", {2162.30,2012.10,-89.00,2685.10,2202.70,110.90}},
  372. {"Palisades", {-2994.40,458.40,-6.10,-2741.00,1339.60,200.00}},
  373. {"Palomino Creek", {2160.20,-149.00,0.00,2576.90,228.30,200.00}},
  374. {"Paradiso", {-2741.00,793.40,-6.10,-2533.00,1268.40,200.00}},
  375. {"Pershing Square", {1440.90,-1722.20,-89.00,1583.50,-1577.50,110.90}},
  376. {"Pilgrim", {2437.30,1383.20,-89.00,2624.40,1783.20,110.90}},
  377. {"Pilgrim", {2624.40,1383.20,-89.00,2685.10,1783.20,110.90}},
  378. {"Pilson Intersection", {1098.30,2243.20,-89.00,1377.30,2507.20,110.90}},
  379. {"Pirates in Men's Pants", {1817.30,1469.20,-89.00,2027.40,1703.20,110.90}},
  380. {"Playa del Seville", {2703.50,-2126.90,-89.00,2959.30,-1852.80,110.90}},
  381. {"Prickle Pine", {1534.50,2583.20,-89.00,1848.40,2863.20,110.90}},
  382. {"Prickle Pine", {1117.40,2507.20,-89.00,1534.50,2723.20,110.90}},
  383. {"Prickle Pine", {1848.40,2553.40,-89.00,1938.80,2863.20,110.90}},
  384. {"Prickle Pine", {1938.80,2624.20,-89.00,2121.40,2861.50,110.90}},
  385. {"Queens", {-2533.00,458.40,0.00,-2329.30,578.30,200.00}},
  386. {"Queens", {-2593.40,54.70,0.00,-2411.20,458.40,200.00}},
  387. {"Queens", {-2411.20,373.50,0.00,-2253.50,458.40,200.00}},
  388. {"Randolph Industrial", {1558.00,596.30,-89.00,1823.00,823.20,110.90}},
  389. {"Redsands East", {1817.30,2011.80,-89.00,2106.70,2202.70,110.90}},
  390. {"Redsands East", {1817.30,2202.70,-89.00,2011.90,2342.80,110.90}},
  391. {"Redsands East", {1848.40,2342.80,-89.00,2011.90,2478.40,110.90}},
  392. {"Redsands West", {1236.60,1883.10,-89.00,1777.30,2142.80,110.90}},
  393. {"Redsands West", {1297.40,2142.80,-89.00,1777.30,2243.20,110.90}},
  394. {"Redsands West", {1377.30,2243.20,-89.00,1704.50,2433.20,110.90}},
  395. {"Redsands West", {1704.50,2243.20,-89.00,1777.30,2342.80,110.90}},
  396. {"Regular Tom", {-405.70,1712.80,-3.00,-276.70,1892.70,200.00}},
  397. {"Richman", {647.50,-1118.20,-89.00,787.40,-954.60,110.90}},
  398. {"Richman", {647.50,-954.60,-89.00,768.60,-860.60,110.90}},
  399. {"Richman", {225.10,-1369.60,-89.00,334.50,-1292.00,110.90}},
  400. {"Richman", {225.10,-1292.00,-89.00,466.20,-1235.00,110.90}},
  401. {"Richman", {72.60,-1404.90,-89.00,225.10,-1235.00,110.90}},
  402. {"Richman", {72.60,-1235.00,-89.00,321.30,-1008.10,110.90}},
  403. {"Richman", {321.30,-1235.00,-89.00,647.50,-1044.00,110.90}},
  404. {"Richman", {321.30,-1044.00,-89.00,647.50,-860.60,110.90}},
  405. {"Richman", {321.30,-860.60,-89.00,687.80,-768.00,110.90}},
  406. {"Richman", {321.30,-768.00,-89.00,700.70,-674.80,110.90}},
  407. {"Robada Intersection", {-1119.00,1178.90,-89.00,-862.00,1351.40,110.90}},
  408. {"Roca Escalante", {2237.40,2202.70,-89.00,2536.40,2542.50,110.90}},
  409. {"Roca Escalante", {2536.40,2202.70,-89.00,2625.10,2442.50,110.90}},
  410. {"Rockshore East", {2537.30,676.50,-89.00,2902.30,943.20,110.90}},
  411. {"Rockshore West", {1997.20,596.30,-89.00,2377.30,823.20,110.90}},
  412. {"Rockshore West", {2377.30,596.30,-89.00,2537.30,788.80,110.90}},
  413. {"Rodeo", {72.60,-1684.60,-89.00,225.10,-1544.10,110.90}},
  414. {"Rodeo", {72.60,-1544.10,-89.00,225.10,-1404.90,110.90}},
  415. {"Rodeo", {225.10,-1684.60,-89.00,312.80,-1501.90,110.90}},
  416. {"Rodeo", {225.10,-1501.90,-89.00,334.50,-1369.60,110.90}},
  417. {"Rodeo", {334.50,-1501.90,-89.00,422.60,-1406.00,110.90}},
  418. {"Rodeo", {312.80,-1684.60,-89.00,422.60,-1501.90,110.90}},
  419. {"Rodeo", {422.60,-1684.60,-89.00,558.00,-1570.20,110.90}},
  420. {"Rodeo", {558.00,-1684.60,-89.00,647.50,-1384.90,110.90}},
  421. {"Rodeo", {466.20,-1570.20,-89.00,558.00,-1385.00,110.90}},
  422. {"Rodeo", {422.60,-1570.20,-89.00,466.20,-1406.00,110.90}},
  423. {"Rodeo", {466.20,-1385.00,-89.00,647.50,-1235.00,110.90}},
  424. {"Rodeo", {334.50,-1406.00,-89.00,466.20,-1292.00,110.90}},
  425. {"Royal Casino", {2087.30,1383.20,-89.00,2437.30,1543.20,110.90}},
  426. {"San Andreas Sound", {2450.30,385.50,-100.00,2759.20,562.30,200.00}},
  427. {"Santa Flora", {-2741.00,458.40,-7.60,-2533.00,793.40,200.00}},
  428. {"Santa Maria Beach", {342.60,-2173.20,-89.00,647.70,-1684.60,110.90}},
  429. {"Santa Maria Beach", {72.60,-2173.20,-89.00,342.60,-1684.60,110.90}},
  430. {"Shady Cabin", {-1632.80,-2263.40,-3.00,-1601.30,-2231.70,200.00}},
  431. {"Shady Creeks", {-1820.60,-2643.60,-8.00,-1226.70,-1771.60,200.00}},
  432. {"Shady Creeks", {-2030.10,-2174.80,-6.10,-1820.60,-1771.60,200.00}},
  433. {"Sobell Rail Yards", {2749.90,1548.90,-89.00,2923.30,1937.20,110.90}},
  434. {"Spinybed", {2121.40,2663.10,-89.00,2498.20,2861.50,110.90}},
  435. {"Starfish Casino", {2437.30,1783.20,-89.00,2685.10,2012.10,110.90}},
  436. {"Starfish Casino", {2437.30,1858.10,-39.00,2495.00,1970.80,60.90}},
  437. {"Starfish Casino", {2162.30,1883.20,-89.00,2437.30,2012.10,110.90}},
  438. {"Temple", {1252.30,-1130.80,-89.00,1378.30,-1026.30,110.90}},
  439. {"Temple", {1252.30,-1026.30,-89.00,1391.00,-926.90,110.90}},
  440. {"Temple", {1252.30,-926.90,-89.00,1357.00,-910.10,110.90}},
  441. {"Temple", {952.60,-1130.80,-89.00,1096.40,-937.10,110.90}},
  442. {"Temple", {1096.40,-1130.80,-89.00,1252.30,-1026.30,110.90}},
  443. {"Temple", {1096.40,-1026.30,-89.00,1252.30,-910.10,110.90}},
  444. {"The Camel's Toe", {2087.30,1203.20,-89.00,2640.40,1383.20,110.90}},
  445. {"The Clown's Pocket", {2162.30,1783.20,-89.00,2437.30,1883.20,110.90}},
  446. {"The Emerald Isle", {2011.90,2202.70,-89.00,2237.40,2508.20,110.90}},
  447. {"The Farm", {-1209.60,-1317.10,114.90,-908.10,-787.30,251.90}},
  448. {"Four Dragons Casino", {1817.30,863.20,-89.00,2027.30,1083.20,110.90}},
  449. {"The High Roller", {1817.30,1283.20,-89.00,2027.30,1469.20,110.90}},
  450. {"The Mako Span", {1664.60,401.70,0.00,1785.10,567.20,200.00}},
  451. {"The Panopticon", {-947.90,-304.30,-1.10,-319.60,327.00,200.00}},
  452. {"The Pink Swan", {1817.30,1083.20,-89.00,2027.30,1283.20,110.90}},
  453. {"The Sherman Dam", {-968.70,1929.40,-3.00,-481.10,2155.20,200.00}},
  454. {"The Strip", {2027.40,863.20,-89.00,2087.30,1703.20,110.90}},
  455. {"The Strip", {2106.70,1863.20,-89.00,2162.30,2202.70,110.90}},
  456. {"The Strip", {2027.40,1783.20,-89.00,2162.30,1863.20,110.90}},
  457. {"The Strip", {2027.40,1703.20,-89.00,2137.40,1783.20,110.90}},
  458. {"The Visage", {1817.30,1863.20,-89.00,2106.70,2011.80,110.90}},
  459. {"The Visage", {1817.30,1703.20,-89.00,2027.40,1863.20,110.90}},
  460. {"Unity Station", {1692.60,-1971.80,-20.40,1812.60,-1932.80,79.50}},
  461. {"Valle Ocultado", {-936.60,2611.40,2.00,-715.90,2847.90,200.00}},
  462. {"Verdant Bluffs", {930.20,-2488.40,-89.00,1249.60,-2006.70,110.90}},
  463. {"Verdant Bluffs", {1073.20,-2006.70,-89.00,1249.60,-1842.20,110.90}},
  464. {"Verdant Bluffs", {1249.60,-2179.20,-89.00,1692.60,-1842.20,110.90}},
  465. {"Verdant Meadows", {37.00,2337.10,-3.00,435.90,2677.90,200.00}},
  466. {"Verona Beach", {647.70,-2173.20,-89.00,930.20,-1804.20,110.90}},
  467. {"Verona Beach", {930.20,-2006.70,-89.00,1073.20,-1804.20,110.90}},
  468. {"Verona Beach", {851.40,-1804.20,-89.00,1046.10,-1577.50,110.90}},
  469. {"Verona Beach", {1161.50,-1722.20,-89.00,1323.90,-1577.50,110.90}},
  470. {"Verona Beach", {1046.10,-1722.20,-89.00,1161.50,-1577.50,110.90}},
  471. {"Vinewood", {787.40,-1310.20,-89.00,952.60,-1130.80,110.90}},
  472. {"Vinewood", {787.40,-1130.80,-89.00,952.60,-954.60,110.90}},
  473. {"Vinewood", {647.50,-1227.20,-89.00,787.40,-1118.20,110.90}},
  474. {"Vinewood", {647.70,-1416.20,-89.00,787.40,-1227.20,110.90}},
  475. {"Whitewood Estates", {883.30,1726.20,-89.00,1098.30,2507.20,110.90}},
  476. {"Whitewood Estates", {1098.30,1726.20,-89.00,1197.30,2243.20,110.90}},
  477. {"Willowfield", {1970.60,-2179.20,-89.00,2089.00,-1852.80,110.90}},
  478. {"Willowfield", {2089.00,-2235.80,-89.00,2201.80,-1989.90,110.90}},
  479. {"Willowfield", {2089.00,-1989.90,-89.00,2324.00,-1852.80,110.90}},
  480. {"Willowfield", {2201.80,-2095.00,-89.00,2324.00,-1989.90,110.90}},
  481. {"Willowfield", {2541.70,-1941.40,-89.00,2703.50,-1852.80,110.90}},
  482. {"Willowfield", {2324.00,-2059.20,-89.00,2541.70,-1852.80,110.90}},
  483. {"Willowfield", {2541.70,-2059.20,-89.00,2703.50,-1941.40,110.90}},
  484. {"Yellow Bell Station", {1377.40,2600.40,-21.90,1492.40,2687.30,78.00}},
  485. // Citys Zones
  486. {"Los Santos", {44.60,-2892.90,-242.90,2997.00,-768.00,900.00}},
  487. {"Las Venturas", {869.40,596.30,-242.90,2997.00,2993.80,900.00}},
  488. {"Bone County", {-480.50,596.30,-242.90,869.40,2993.80,900.00}},
  489. {"Tierra Robada", {-2997.40,1659.60,-242.90,-480.50,2993.80,900.00}},
  490. {"Tierra Robada", {-1213.90,596.30,-242.90,-480.50,1659.60,900.00}},
  491. {"San Fierro", {-2997.40,-1115.50,-242.90,-1213.90,1659.60,900.00}},
  492. {"Red County", {-1213.90,-768.00,-242.90,2997.00,596.30,900.00}},
  493. {"Flint County", {-1213.90,-2892.90,-242.90,44.60,-768.00,900.00}},
  494. {"Whetstone", {-2997.40,-2892.90,-242.90,-1213.90,-1115.50,900.00}}
  495. };
  496.  
  497. forward MainTimer();
  498. forward Speedometer();
  499. forward SaveTimer();
  500. forward StopAlarm(vehicleid);
  501.  
  502. stock PlayerName(playerid)
  503. {
  504. new pName[MAX_PLAYER_NAME];
  505. GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
  506. return pName;
  507. }
  508.  
  509. stock IsPlayerSpawned(playerid)
  510. {
  511. switch(GetPlayerState(playerid))
  512. {
  513. case 1,2,3: return 1;
  514. }
  515. return 0;
  516. }
  517.  
  518. stock IsMeleeWeapon(weaponid)
  519. {
  520. switch(weaponid)
  521. {
  522. case 2 .. 15, 41 .. 42: return 1;
  523. }
  524. return 0;
  525. }
  526.  
  527. stock RemovePlayerWeapon(playerid, weaponid)
  528. {
  529. new WeaponData[12][2];
  530. for(new i=1; i < sizeof(WeaponData); i++)
  531. {
  532. GetPlayerWeaponData(playerid, i, WeaponData[i][0], WeaponData[i][1]);
  533. }
  534. ResetPlayerWeapons(playerid);
  535. for(new i=1; i < sizeof(WeaponData); i++)
  536. {
  537. if(WeaponData[i][0] != weaponid)
  538. {
  539. GivePlayerWeapon(playerid, WeaponData[i][0], WeaponData[i][1]);
  540. }
  541. }
  542. }
  543.  
  544. stock IsBicycle(vehicleid)
  545. {
  546. switch(GetVehicleModel(vehicleid))
  547. {
  548. case 481,509,510: return 1;
  549. }
  550. return 0;
  551. }
  552.  
  553. stock PlayerToPlayer(playerid, targetid, Float:dist)
  554. {
  555. new Float:pos[3];
  556. GetPlayerPos(targetid, pos[0], pos[1], pos[2]);
  557. return IsPlayerInRangeOfPoint(playerid, dist, pos[0], pos[1], pos[2]);
  558. }
  559.  
  560. stock PlayerToVehicle(playerid, vehicleid, Float:dist)
  561. {
  562. new Float:pos[3];
  563. GetVehiclePos(vehicleid, pos[0], pos[1], pos[2]);
  564. return IsPlayerInRangeOfPoint(playerid, dist, pos[0], pos[1], pos[2]);
  565. }
  566.  
  567. stock GetClosestVehicle(playerid)
  568. {
  569. new Float:x, Float:y, Float:z;
  570. new Float:dist, Float:closedist=9999, closeveh;
  571. for(new i=1; i < MAX_VEHICLES; i++)
  572. {
  573. if(GetVehiclePos(i, x, y, z))
  574. {
  575. dist = GetPlayerDistanceFromPoint(playerid, x, y, z);
  576. if(dist < closedist)
  577. {
  578. closedist = dist;
  579. closeveh = i;
  580. }
  581. }
  582. }
  583. return closeveh;
  584. }
  585.  
  586. stock ToggleEngine(vehicleid, toggle)
  587. {
  588. new engine, lights, alarm, doors, bonnet, boot, objective;
  589. GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
  590. SetVehicleParamsEx(vehicleid, toggle, lights, alarm, doors, bonnet, boot, objective);
  591. }
  592.  
  593. stock ToggleAlarm(vehicleid, toggle)
  594. {
  595. new engine, lights, alarm, doors, bonnet, boot, objective;
  596. GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
  597. SetVehicleParamsEx(vehicleid, engine, lights, toggle, doors, bonnet, boot, objective);
  598. }
  599.  
  600. stock StripNL(str[]) // credits to Y_Less for y_utils.inc
  601. {
  602. new
  603. i = strlen(str);
  604. while (i-- && str[i] <= ' ') str[i] = '\0';
  605. }
  606.  
  607. stock IsNumeric(const string[])
  608. {
  609. for(new i=0; string[i]; i++)
  610. {
  611. if(string[i] < '0' || string[i] > '9') return 0;
  612. }
  613. return 1;
  614. }
  615.  
  616. stock GetVehicleModelIDFromName(const vname[])
  617. {
  618. for(new i=0; i < sizeof(VehicleNames); i++)
  619. {
  620. if(strfind(VehicleNames[i], vname, true) != -1) return i + 400;
  621. }
  622. return -1;
  623. }
  624.  
  625. stock GetPlayer2DZone(playerid)
  626. {
  627. new zone[32] = "San Andreas";
  628. new Float:x, Float:y, Float:z;
  629. GetPlayerPos(playerid, x, y, z);
  630. for(new i = 0; i < sizeof(SanAndreasZones); i++)
  631. {
  632. if(x >= SanAndreasZones[i][Zone_Area][0] && x <= SanAndreasZones[i][Zone_Area][3]
  633. && y >= SanAndreasZones[i][Zone_Area][1] && y <= SanAndreasZones[i][Zone_Area][4])
  634. {
  635. strmid(zone, SanAndreasZones[i][Zone_Name], 0, 28);
  636. return zone;
  637. }
  638. }
  639. return zone;
  640. }
  641.  
  642. stock GetPlayer3DZone(playerid)
  643. {
  644. new zone[32] = "San Andreas";
  645. new Float:x, Float:y, Float:z;
  646. GetPlayerPos(playerid, x, y, z);
  647. for(new i = 0; i < sizeof(SanAndreasZones); i++)
  648. {
  649. if(x >= SanAndreasZones[i][Zone_Area][0] && x <= SanAndreasZones[i][Zone_Area][3]
  650. && y >= SanAndreasZones[i][Zone_Area][1] && y <= SanAndreasZones[i][Zone_Area][4]
  651. && z >= SanAndreasZones[i][Zone_Area][2] && z <= SanAndreasZones[i][Zone_Area][5])
  652. {
  653. strmid(zone, SanAndreasZones[i][Zone_Name], 0, 28);
  654. return zone;
  655. }
  656. }
  657. return zone;
  658. }
  659.  
  660. stock GetPlayerSpeed(playerid, bool:kmh = true)
  661. {
  662. new
  663. Float:xx,
  664. Float:yy,
  665. Float:zz,
  666. Float:pSpeed;
  667.  
  668. if(IsPlayerInAnyVehicle(playerid))
  669. {
  670. GetVehicleVelocity(GetPlayerVehicleID(playerid),xx,yy,zz);
  671. }
  672. else
  673. {
  674. GetPlayerVelocity(playerid,xx,yy,zz);
  675. }
  676.  
  677. pSpeed = floatsqroot((xx * xx) + (yy * yy) + (zz * zz));
  678. return kmh ? floatround((pSpeed * 165.12)) : floatround((pSpeed * 103.9));
  679. }
  680.  
  681. IsAdmin(playerid, level)
  682. {
  683. if(IsPlayerAdmin(playerid)) return 1;
  684. if(CallRemoteFunction("GetPlayerAVSAdmin", "d", playerid) >= level) return 1;
  685. return 0;
  686. }
  687.  
  688. LoadVehicles()
  689. {
  690. new File:handle, count;
  691. new filename[64], line[256];
  692. for(new i=1; i < MAX_DVEHICLES; i++)
  693. {
  694. format(filename, sizeof(filename), VEHICLE_FILE_PATH "v%d.ini", i);
  695. if(!fexist(filename)) continue;
  696. handle = fopen(filename, io_read);
  697. while(fread(handle, line))
  698. {
  699. StripNL(line);
  700. if(!line[0]) continue;
  701. if(strcmp(line, "Created=", false, 8) == 0) VehicleCreated[i] = strval(line[8]);
  702. else if(strcmp(line, "Model=", false, 6) == 0) VehicleModel[i] = strval(line[6]);
  703. else if(strcmp(line, "Pos=", false, 4) == 0) sscanf(line[4], "p,ffff", VehiclePos[i][0], VehiclePos[i][1],
  704. VehiclePos[i][2], VehiclePos[i][3]);
  705. else if(strcmp(line, "Colors=", false, 7) == 0) sscanf(line[7], "p,dd", VehicleColor[i][0], VehicleColor[i][1]);
  706. else if(strcmp(line, "Interior=", false, 9) == 0) VehicleInterior[i] = strval(line[9]);
  707. else if(strcmp(line, "VirtualWorld=", false, 13) == 0) VehicleWorld[i] = strval(line[13]);
  708. else if(strcmp(line, "Owner=", false, 6) == 0) strmid(VehicleOwner[i], line, 6, sizeof(line));
  709. else if(strcmp(line, "NumberPlate=", false, 12) == 0) strmid(VehicleNumberPlate[i], line, 12, sizeof(line));
  710. else if(strcmp(line, "Value=", false, 6) == 0) VehicleValue[i] = strval(line[6]);
  711. else if(strcmp(line, "Trunk1=", false, 7) == 0) sscanf(line[7], "p,dd", VehicleTrunk[i][0][0], VehicleTrunk[i][0][1]);
  712. else if(strcmp(line, "Trunk2=", false, 7) == 0) sscanf(line[7], "p,dd", VehicleTrunk[i][1][0], VehicleTrunk[i][1][1]);
  713. else if(strcmp(line, "Trunk3=", false, 7) == 0) sscanf(line[7], "p,dd", VehicleTrunk[i][2][0], VehicleTrunk[i][2][1]);
  714. else if(strcmp(line, "Trunk4=", false, 7) == 0) sscanf(line[7], "p,dd", VehicleTrunk[i][3][0], VehicleTrunk[i][3][1]);
  715. else if(strcmp(line, "Trunk5=", false, 7) == 0) sscanf(line[7], "p,dd", VehicleTrunk[i][4][0], VehicleTrunk[i][4][1]);
  716. else if(strcmp(line, "Mod0=", false, 5) == 0) VehicleMods[i][0] = strval(line[5]);
  717. else if(strcmp(line, "Mod1=", false, 5) == 0) VehicleMods[i][1] = strval(line[5]);
  718. else if(strcmp(line, "Mod2=", false, 5) == 0) VehicleMods[i][2] = strval(line[5]);
  719. else if(strcmp(line, "Mod3=", false, 5) == 0) VehicleMods[i][3] = strval(line[5]);
  720. else if(strcmp(line, "Mod4=", false, 5) == 0) VehicleMods[i][4] = strval(line[5]);
  721. else if(strcmp(line, "Mod5=", false, 5) == 0) VehicleMods[i][5] = strval(line[5]);
  722. else if(strcmp(line, "Mod6=", false, 5) == 0) VehicleMods[i][6] = strval(line[5]);
  723. else if(strcmp(line, "Mod7=", false, 5) == 0) VehicleMods[i][7] = strval(line[5]);
  724. else if(strcmp(line, "Mod8=", false, 5) == 0) VehicleMods[i][8] = strval(line[5]);
  725. else if(strcmp(line, "Mod9=", false, 5) == 0) VehicleMods[i][9] = strval(line[5]);
  726. else if(strcmp(line, "Mod10=", false, 6) == 0) VehicleMods[i][10] = strval(line[6]);
  727. else if(strcmp(line, "Mod11=", false, 6) == 0) VehicleMods[i][11] = strval(line[6]);
  728. else if(strcmp(line, "Mod12=", false, 6) == 0) VehicleMods[i][12] = strval(line[6]);
  729. else if(strcmp(line, "Mod13=", false, 6) == 0) VehicleMods[i][13] = strval(line[6]);
  730. else if(strcmp(line, "Paintjob=", false, 9) == 0) VehiclePaintjob[i] = strval(line[9]);
  731. }
  732. fclose(handle);
  733. if(VehicleCreated[i]) count++;
  734. }
  735. printf(" Loaded %d vehicles", count);
  736. }
  737.  
  738. SaveVehicle(vehicleid)
  739. {
  740. new filename[64], line[256];
  741. format(filename, sizeof(filename), VEHICLE_FILE_PATH "v%d.ini", vehicleid);
  742. new File:handle = fopen(filename, io_write);
  743. format(line, sizeof(line), "Created=%d\r\n", VehicleCreated[vehicleid]); fwrite(handle, line);
  744. format(line, sizeof(line), "Model=%d\r\n", VehicleModel[vehicleid]); fwrite(handle, line);
  745. format(line, sizeof(line), "Pos=%.3f,%.3f,%.3f,%.3f\r\n", VehiclePos[vehicleid][0], VehiclePos[vehicleid][1],
  746. VehiclePos[vehicleid][2], VehiclePos[vehicleid][3]);
  747. fwrite(handle, line);
  748. format(line, sizeof(line), "Colors=%d,%d\r\n", VehicleColor[vehicleid][0], VehicleColor[vehicleid][1]); fwrite(handle, line);
  749. format(line, sizeof(line), "Interior=%d\r\n", VehicleInterior[vehicleid]); fwrite(handle, line);
  750. format(line, sizeof(line), "VirtualWorld=%d\r\n", VehicleWorld[vehicleid]); fwrite(handle, line);
  751. format(line, sizeof(line), "Owner=%s\r\n", VehicleOwner[vehicleid]); fwrite(handle, line);
  752. format(line, sizeof(line), "NumberPlate=%s\r\n", VehicleNumberPlate[vehicleid]); fwrite(handle, line);
  753. format(line, sizeof(line), "Value=%d\r\n", VehicleValue[vehicleid]); fwrite(handle, line);
  754. format(line, sizeof(line), "Trunk1=%d,%d\r\n", VehicleTrunk[vehicleid][0][0], VehicleTrunk[vehicleid][0][1]); fwrite(handle, line);
  755. format(line, sizeof(line), "Trunk2=%d,%d\r\n", VehicleTrunk[vehicleid][1][0], VehicleTrunk[vehicleid][1][1]); fwrite(handle, line);
  756. format(line, sizeof(line), "Trunk3=%d,%d\r\n", VehicleTrunk[vehicleid][2][0], VehicleTrunk[vehicleid][2][1]); fwrite(handle, line);
  757. format(line, sizeof(line), "Trunk4=%d,%d\r\n", VehicleTrunk[vehicleid][3][0], VehicleTrunk[vehicleid][3][1]); fwrite(handle, line);
  758. format(line, sizeof(line), "Trunk5=%d,%d\r\n", VehicleTrunk[vehicleid][4][0], VehicleTrunk[vehicleid][4][1]); fwrite(handle, line);
  759. format(line, sizeof(line), "Mod0=%d\r\n", VehicleMods[vehicleid][0]); fwrite(handle, line);
  760. format(line, sizeof(line), "Mod1=%d\r\n", VehicleMods[vehicleid][1]); fwrite(handle, line);
  761. format(line, sizeof(line), "Mod2=%d\r\n", VehicleMods[vehicleid][2]); fwrite(handle, line);
  762. format(line, sizeof(line), "Mod3=%d\r\n", VehicleMods[vehicleid][3]); fwrite(handle, line);
  763. format(line, sizeof(line), "Mod4=%d\r\n", VehicleMods[vehicleid][4]); fwrite(handle, line);
  764. format(line, sizeof(line), "Mod5=%d\r\n", VehicleMods[vehicleid][5]); fwrite(handle, line);
  765. format(line, sizeof(line), "Mod6=%d\r\n", VehicleMods[vehicleid][6]); fwrite(handle, line);
  766. format(line, sizeof(line), "Mod7=%d\r\n", VehicleMods[vehicleid][7]); fwrite(handle, line);
  767. format(line, sizeof(line), "Mod8=%d\r\n", VehicleMods[vehicleid][8]); fwrite(handle, line);
  768. format(line, sizeof(line), "Mod9=%d\r\n", VehicleMods[vehicleid][9]); fwrite(handle, line);
  769. format(line, sizeof(line), "Mod10=%d\r\n", VehicleMods[vehicleid][10]); fwrite(handle, line);
  770. format(line, sizeof(line), "Mod11=%d\r\n", VehicleMods[vehicleid][11]); fwrite(handle, line);
  771. format(line, sizeof(line), "Mod12=%d\r\n", VehicleMods[vehicleid][12]); fwrite(handle, line);
  772. format(line, sizeof(line), "Mod13=%d\r\n", VehicleMods[vehicleid][13]); fwrite(handle, line);
  773. format(line, sizeof(line), "Paintjob=%d\r\n", VehiclePaintjob[vehicleid]); fwrite(handle, line);
  774. fclose(handle);
  775. }
  776.  
  777. UpdateVehicle(vehicleid, removeold)
  778. {
  779. if(VehicleCreated[vehicleid])
  780. {
  781. if(removeold)
  782. {
  783. new Float:health;
  784. GetVehicleHealth(VehicleID[vehicleid], health);
  785. new engine, lights, alarm, doors, bonnet, boot, objective;
  786. GetVehicleParamsEx(VehicleID[vehicleid], engine, lights, alarm, doors, bonnet, boot, objective);
  787. //new panels, doorsd, lightsd, tires;
  788. //GetVehicleDamageStatus(VehicleID[vehicleid], panels, doorsd, lightsd, tires);
  789. DestroyVehicle(VehicleID[vehicleid]);
  790. VehicleID[vehicleid] = CreateVehicle(VehicleModel[vehicleid], VehiclePos[vehicleid][0], VehiclePos[vehicleid][1],
  791. VehiclePos[vehicleid][2], VehiclePos[vehicleid][3], VehicleColor[vehicleid][0], VehicleColor[vehicleid][1], 3600);
  792. SetVehicleHealth(VehicleID[vehicleid], health);
  793. SetVehicleParamsEx(VehicleID[vehicleid], engine, lights, alarm, doors, bonnet, boot, objective);
  794. //UpdateVehicleDamageStatus(VehicleID[vehicleid], panels, doorsd, lightsd, tires);
  795. }
  796. else
  797. {
  798. VehicleID[vehicleid] = CreateVehicle(VehicleModel[vehicleid], VehiclePos[vehicleid][0], VehiclePos[vehicleid][1],
  799. VehiclePos[vehicleid][2], VehiclePos[vehicleid][3], VehicleColor[vehicleid][0], VehicleColor[vehicleid][1], 3600);
  800. }
  801. LinkVehicleToInterior(VehicleID[vehicleid], VehicleInterior[vehicleid]);
  802. SetVehicleVirtualWorld(VehicleID[vehicleid], VehicleWorld[vehicleid]);
  803. SetVehicleNumberPlate(VehicleID[vehicleid], VehicleNumberPlate[vehicleid]);
  804. for(new i=0; i < sizeof(VehicleMods[]); i++)
  805. {
  806. AddVehicleComponent(VehicleID[vehicleid], VehicleMods[vehicleid][i]);
  807. }
  808. ChangeVehiclePaintjob(VehicleID[vehicleid], VehiclePaintjob[vehicleid]);
  809. UpdateVehicleLabel(vehicleid, removeold);
  810. }
  811. }
  812.  
  813. UpdateVehicleLabel(vehicleid, removeold)
  814. {
  815. if(VehicleCreated[vehicleid] == VEHICLE_DEALERSHIP)
  816. {
  817. if(removeold)
  818. {
  819. Delete3DTextLabel(VehicleLabel[vehicleid]);
  820. }
  821. new labeltext[128];
  822. format(labeltext, sizeof(labeltext), "%s\nID: %d\nDealership: %s\nPrice: $%d", VehicleNames[VehicleModel[vehicleid]-400],
  823. vehicleid, VehicleOwner[vehicleid], VehicleValue[vehicleid]);
  824. VehicleLabel[vehicleid] = Create3DTextLabel(labeltext, 0xBB7700DD, 0, 0, 0, 10.0, 0);
  825. Attach3DTextLabelToVehicle(VehicleLabel[vehicleid], VehicleID[vehicleid], 0, 0, 0);
  826. }
  827. }
  828.  
  829. IsValidVehicle(vehicleid)
  830. {
  831. if(vehicleid < 1 || vehicleid >= MAX_DVEHICLES) return 0;
  832. if(VehicleCreated[vehicleid]) return 1;
  833. return 0;
  834. }
  835.  
  836. GetVehicleID(vehicleid)
  837. {
  838. for(new i=1; i < MAX_DVEHICLES; i++)
  839. {
  840. if(VehicleCreated[i] && VehicleID[i] == vehicleid) return i;
  841. }
  842. return 0;
  843. }
  844.  
  845. GetPlayerVehicles(playerid)
  846. {
  847. new count;
  848. for(new i=1; i < MAX_DVEHICLES; i++)
  849. {
  850. if(VehicleCreated[i] == VEHICLE_PLAYER && strcmp(VehicleOwner[i], PlayerName(playerid)) == 0)
  851. {
  852. count++;
  853. }
  854. }
  855. return count;
  856. }
  857.  
  858. GetPlayerVehicleAccess(playerid, vehicleid)
  859. {
  860. if(IsValidVehicle(vehicleid))
  861. {
  862. if(VehicleCreated[vehicleid] == VEHICLE_DEALERSHIP)
  863. {
  864. if(IsAdmin(playerid, 1))
  865. {
  866. return 3;
  867. }
  868. }
  869. else if(VehicleCreated[vehicleid] == VEHICLE_PLAYER)
  870. {
  871. if(strcmp(VehicleOwner[vehicleid], PlayerName(playerid)) == 0)
  872. {
  873. return 1;
  874. }
  875. else if(GetPVarInt(playerid, "CarKeys") == vehicleid)
  876. {
  877. return 2;
  878. }
  879. }
  880. }
  881. else
  882. {
  883. return 2;
  884. }
  885. return 0;
  886. }
  887.  
  888. LoadDealerships()
  889. {
  890. new File:handle, count;
  891. new filename[64], line[256];
  892. for(new i=1; i < MAX_DEALERSHIPS; i++)
  893. {
  894. format(filename, sizeof(filename), DEALERSHIP_FILE_PATH "d%d.ini", i);
  895. if(!fexist(filename)) continue;
  896. handle = fopen(filename, io_read);
  897. while(fread(handle, line))
  898. {
  899. StripNL(line);
  900. if(!line[0]) continue;
  901. if(strcmp(line, "Created=", false, 8) == 0) DealershipCreated[i] = strval(line[8]);
  902. else if(strcmp(line, "Pos=", false, 4) == 0) sscanf(line[4], "p,fff", DealershipPos[i][0],
  903. DealershipPos[i][1], DealershipPos[i][2]);
  904. }
  905. fclose(handle);
  906. if(DealershipCreated[i]) count++;
  907. }
  908. printf(" Loaded %d dealerships", count);
  909. }
  910.  
  911. SaveDealership(dealerid)
  912. {
  913. new filename[64], line[256];
  914. format(filename, sizeof(filename), DEALERSHIP_FILE_PATH "d%d.ini", dealerid);
  915. new File:handle = fopen(filename, io_write);
  916. format(line, sizeof(line), "Created=%d\r\n", DealershipCreated[dealerid]); fwrite(handle, line);
  917. format(line, sizeof(line), "Pos=%.3f,%.3f,%.3f\r\n", DealershipPos[dealerid][0],
  918. DealershipPos[dealerid][1], DealershipPos[dealerid][2]);
  919. fwrite(handle, line);
  920. fclose(handle);
  921. }
  922.  
  923. UpdateDealership(dealerid, removeold)
  924. {
  925. if(DealershipCreated[dealerid])
  926. {
  927. if(removeold)
  928. {
  929. Delete3DTextLabel(DealershipLabel[dealerid]);
  930. }
  931. new labeltext[32];
  932. format(labeltext, sizeof(labeltext), "Vehicle Dealership\nID: %d", dealerid);
  933. DealershipLabel[dealerid] = Create3DTextLabel(labeltext, 0x00BB00DD, DealershipPos[dealerid][0],
  934. DealershipPos[dealerid][1], DealershipPos[dealerid][2]+0.5, 20.0, 0);
  935. }
  936. }
  937.  
  938. IsValidDealership(dealerid)
  939. {
  940. if(dealerid < 1 || dealerid >= MAX_DEALERSHIPS) return 0;
  941. if(DealershipCreated[dealerid]) return 1;
  942. return 0;
  943. }
  944.  
  945. LoadFuelStations()
  946. {
  947. new File:handle, count;
  948. new filename[64], line[256];
  949. for(new i=1; i < MAX_FUEL_STATIONS; i++)
  950. {
  951. format(filename, sizeof(filename), FUEL_STATION_FILE_PATH "f%d.ini", i);
  952. if(!fexist(filename)) continue;
  953. handle = fopen(filename, io_read);
  954. while(fread(handle, line))
  955. {
  956. StripNL(line);
  957. if(!line[0]) continue;
  958. if(strcmp(line, "Created=", false, 8) == 0) FuelStationCreated[i] = strval(line[8]);
  959. else if(strcmp(line, "Pos=", false, 4) == 0) sscanf(line[4], "p,fff", FuelStationPos[i][0],
  960. FuelStationPos[i][1], FuelStationPos[i][2]);
  961. }
  962. fclose(handle);
  963. if(FuelStationCreated[i]) count++;
  964. }
  965. printf(" Loaded %d fuel stations", count);
  966. }
  967.  
  968. SaveFuelStation(stationid)
  969. {
  970. new filename[64], line[256];
  971. format(filename, sizeof(filename), FUEL_STATION_FILE_PATH "f%d.ini", stationid);
  972. new File:handle = fopen(filename, io_write);
  973. format(line, sizeof(line), "Created=%d\r\n", FuelStationCreated[stationid]); fwrite(handle, line);
  974. format(line, sizeof(line), "Pos=%.3f,%.3f,%.3f\r\n", FuelStationPos[stationid][0],
  975. FuelStationPos[stationid][1], FuelStationPos[stationid][2]);
  976. fwrite(handle, line);
  977. fclose(handle);
  978. }
  979.  
  980. UpdateFuelStation(stationid, removeold)
  981. {
  982. if(FuelStationCreated[stationid])
  983. {
  984. if(removeold)
  985. {
  986. Delete3DTextLabel(FuelStationLabel[stationid]);
  987. }
  988. new labeltext[32];
  989. format(labeltext, sizeof(labeltext), "Fuel Station\nID: %d\n/fuel", stationid);
  990. FuelStationLabel[stationid] = Create3DTextLabel(labeltext, 0x00BBFFDD, FuelStationPos[stationid][0],
  991. FuelStationPos[stationid][1], FuelStationPos[stationid][2]+0.5, 20.0, 0);
  992. }
  993. }
  994.  
  995. IsValidFuelStation(stationid)
  996. {
  997. if(stationid < 1 || stationid >= MAX_FUEL_STATIONS) return 0;
  998. if(FuelStationCreated[stationid]) return 1;
  999. return 0;
  1000. }
  1001.  
  1002. public MainTimer()
  1003. {
  1004. new string[128];
  1005. new Float:x, Float:y, Float:z;
  1006.  
  1007. for(new i=0; i < MAX_PLAYERS; i++)
  1008. {
  1009. if(IsPlayerConnected(i))
  1010. {
  1011. if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
  1012. {
  1013. new vehicleid = GetPlayerVehicleID(i);
  1014. if(!IsBicycle(vehicleid) && Fuel[vehicleid] > 0)
  1015. {
  1016. Fuel[vehicleid] -= GetPlayerSpeed(i)/1000.0;
  1017. if(Fuel[vehicleid] <= 0)
  1018. {
  1019. ToggleEngine(vehicleid, VEHICLE_PARAMS_OFF);
  1020. GameTextForPlayer(i, "~r~out of fuel", 3000, 3);
  1021. SendClientMessage(i, COLOR_RED, "This vehicle is out of fuel!");
  1022. }
  1023. }
  1024. }
  1025. if(RefuelTime[i] > 0 && GetPVarInt(i, "FuelStation"))
  1026. {
  1027. new vehicleid = GetPlayerVehicleID(i);
  1028. Fuel[vehicleid] += 2.0;
  1029. RefuelTime[i]--;
  1030. if(RefuelTime[i] == 0)
  1031. {
  1032. if(Fuel[vehicleid] >= 100.0) Fuel[vehicleid] = 100.0;
  1033. new stationid = GetPVarInt(i, "FuelStation");
  1034. new cost = floatround(Fuel[vehicleid]-GetPVarFloat(i, "Fuel"))*FUEL_PRICE;
  1035. if(GetPlayerState(i) != PLAYER_STATE_DRIVER || Fuel[vehicleid] >= 100.0 || GetPlayerMoney(i) < cost
  1036. || !IsPlayerInRangeOfPoint(i, 10.0, FuelStationPos[stationid][0], FuelStationPos[stationid][1], FuelStationPos[stationid][2]))
  1037. {
  1038. if(GetPlayerMoney(i) < cost) cost = GetPlayerMoney(i);
  1039. GivePlayerMoney(i, -cost);
  1040. format(string, sizeof(string), "~r~-$%d", cost);
  1041. GameTextForPlayer(i, string, 2000, 3);
  1042. format(string, sizeof(string), "You pay $%d for fuel", cost);
  1043. SendClientMessage(i, COLOR_WHITE, string);
  1044. SetPVarInt(i, "FuelStation", 0);
  1045. SetPVarFloat(i, "Fuel", 0.0);
  1046. }
  1047. else
  1048. {
  1049. RefuelTime[i] = 5;
  1050. format(string, sizeof(string), "~w~refueling...~n~~r~-$%d", cost);
  1051. GameTextForPlayer(i, string, 2000, 3);
  1052. }
  1053. }
  1054. }
  1055. if(TrackCar[i])
  1056. {
  1057. GetVehiclePos(TrackCar[i], x, y, z);
  1058. SetPlayerCheckpoint(i, x, y, z, 3);
  1059. }
  1060. }
  1061. }
  1062. }
  1063.  
  1064. public Speedometer()
  1065. {
  1066. new vehicleid, Float:health;
  1067. new engine, lights, alarm, doors, bonnet, boot, objective;
  1068. new fstring[32], string[512];
  1069.  
  1070. for(new i=0; i < MAX_PLAYERS; i++)
  1071. {
  1072. if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
  1073. {
  1074. vehicleid = GetPlayerVehicleID(i);
  1075. GetVehicleHealth(vehicleid, health);
  1076. GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
  1077.  
  1078. string = "~b~~h~vehicle: ~w~";
  1079. strcat(string, VehicleNames[GetVehicleModel(vehicleid)-400], sizeof(string));
  1080.  
  1081. strcat(string, "~n~~b~~h~gps: ~w~", sizeof(string));
  1082. strcat(string, GetPlayer3DZone(i), sizeof(string));
  1083.  
  1084. strcat(string, "~n~~b~~h~health: ~g~", sizeof(string));
  1085. fstring = "iiiiiiiiii";
  1086. if(health > 1000.0) strins(fstring, "~r~", 10, sizeof(fstring));
  1087. else if(health < 0.0) strins(fstring, "~r~", 0, sizeof(fstring));
  1088. else strins(fstring, "~r~", floatround(health/100.0), sizeof(fstring));
  1089. strcat(string, fstring, sizeof(string));
  1090.  
  1091. strcat(string, " ~b~~h~fuel: ~g~", sizeof(string));
  1092. fstring = "iiiiiiiiii";
  1093. if(Fuel[vehicleid] > 100.0) strins(fstring, "~r~", 10, sizeof(fstring));
  1094. else if(Fuel[vehicleid] < 0.0) strins(fstring, "~r~", 0, sizeof(fstring));
  1095. else strins(fstring, "~r~", floatround(Fuel[vehicleid]/10.0), sizeof(fstring));
  1096. strcat(string, fstring, sizeof(string));
  1097.  
  1098. strcat(string, " ~b~~h~", sizeof(string));
  1099. if(GetPVarInt(i, "Speedo")) format(fstring,sizeof(fstring),"kph: ~w~%d", GetPlayerSpeed(i, false));
  1100. else format(fstring,sizeof(fstring),"kph: ~w~%d", GetPlayerSpeed(i, true));
  1101. strcat(string, fstring, sizeof(string));
  1102.  
  1103. strcat(string, "~n~~b~~h~engine: ", sizeof(string));
  1104. if(engine == 1) strcat(string, "~g~on", sizeof(string));
  1105. else strcat(string, "~r~off", sizeof(string));
  1106.  
  1107. strcat(string, " ~b~~h~alarm: ", sizeof(string));
  1108. if(VehicleSecurity[vehicleid] == 1) strcat(string, "~g~on", sizeof(string));
  1109. else strcat(string, "~r~off", sizeof(string));
  1110.  
  1111. strcat(string, " ~b~~h~doors: ", sizeof(string));
  1112. if(doors == 1) strcat(string, "~r~locked", sizeof(string));
  1113. else strcat(string, "~g~unlocked", sizeof(string));
  1114.  
  1115. TextDrawSetString(SpeedoText[i], string);
  1116. }
  1117. }
  1118. }
  1119.  
  1120. public SaveTimer()
  1121. {
  1122. SaveVehicleIndex++;
  1123. if(SaveVehicleIndex >= MAX_DVEHICLES) SaveVehicleIndex = 1;
  1124. if(IsValidVehicle(SaveVehicleIndex)) SaveVehicle(SaveVehicleIndex);
  1125. }
  1126.  
  1127. public StopAlarm(vehicleid)
  1128. {
  1129. ToggleAlarm(vehicleid, VEHICLE_PARAMS_OFF);
  1130. }
  1131.  
  1132. public OnFilterScriptInit()
  1133. {
  1134. print("\n------------------------------------------------");
  1135. print(" Advanced Vehicle System 1.0 by MadeMan");
  1136. print("------------------------------------------------");
  1137.  
  1138. LoadVehicles();
  1139. LoadDealerships();
  1140. LoadFuelStations();
  1141.  
  1142. SpeedoBox = TextDrawCreate(345.000, 363.000, "~n~~n~~n~~n~");
  1143. TextDrawAlignment(SpeedoBox, 2);
  1144. TextDrawLetterSize(SpeedoBox, 0.500, 1.400);
  1145. TextDrawUseBox(SpeedoBox, 1);
  1146. TextDrawBoxColor(SpeedoBox, 153);
  1147. TextDrawTextSize(SpeedoBox, 0.000, 340.000);
  1148.  
  1149. for(new i=0; i < MAX_PLAYERS; i++)
  1150. {
  1151. if(IsPlayerConnected(i))
  1152. {
  1153. OnPlayerConnect(i);
  1154. }
  1155. }
  1156. for(new i=1; i < MAX_DVEHICLES; i++)
  1157. {
  1158. UpdateVehicle(i, 0);
  1159. }
  1160. for(new i=1; i < MAX_DEALERSHIPS; i++)
  1161. {
  1162. UpdateDealership(i, 0);
  1163. }
  1164. for(new i=1; i < MAX_FUEL_STATIONS; i++)
  1165. {
  1166. UpdateFuelStation(i, 0);
  1167. }
  1168.  
  1169. maintimer = SetTimer("MainTimer", 1000, true);
  1170. speedotimer = SetTimer("Speedometer", 555, true);
  1171. savetimer = SetTimer("SaveTimer", 2222, true);
  1172.  
  1173. print("------------------------------------------------\n");
  1174. ManualVehicleEngineAndLights();
  1175. return 1;
  1176. }
  1177.  
  1178. public OnFilterScriptExit()
  1179. {
  1180. KillTimer(maintimer);
  1181. KillTimer(speedotimer);
  1182. KillTimer(savetimer);
  1183. TextDrawDestroy(SpeedoBox);
  1184. for(new i=0; i < MAX_PLAYERS; i++)
  1185. {
  1186. if(IsPlayerConnected(i))
  1187. {
  1188. OnPlayerDisconnect(i, 1);
  1189. }
  1190. }
  1191. for(new i=1; i < MAX_DVEHICLES; i++)
  1192. {
  1193. if(VehicleCreated[i])
  1194. {
  1195. DestroyVehicle(VehicleID[i]);
  1196. if(VehicleCreated[i] == VEHICLE_DEALERSHIP)
  1197. {
  1198. Delete3DTextLabel(VehicleLabel[i]);
  1199. }
  1200. }
  1201. }
  1202. for(new i=1; i < MAX_DEALERSHIPS; i++)
  1203. {
  1204. if(DealershipCreated[i])
  1205. {
  1206. Delete3DTextLabel(DealershipLabel[i]);
  1207. }
  1208. }
  1209. for(new i=1; i < MAX_FUEL_STATIONS; i++)
  1210. {
  1211. if(FuelStationCreated[i])
  1212. {
  1213. Delete3DTextLabel(FuelStationLabel[i]);
  1214. }
  1215. }
  1216. print("\n------------------------------------------------");
  1217. print(" Advanced Vehicle System 1.0 Unloaded");
  1218. print("------------------------------------------------\n");
  1219. return 1;
  1220. }
  1221.  
  1222. public OnPlayerConnect(playerid)
  1223. {
  1224. RefuelTime[playerid] = 0;
  1225. TrackCar[playerid] = 0;
  1226.  
  1227. SpeedoText[playerid] = TextDrawCreate(180.000, 362.000," ");
  1228. TextDrawAlignment(SpeedoText[playerid], 1);
  1229. TextDrawFont(SpeedoText[playerid],2);
  1230. TextDrawLetterSize(SpeedoText[playerid], 0.310, 1.400);
  1231. TextDrawSetShadow(SpeedoText[playerid],0);
  1232. return 1;
  1233. }
  1234.  
  1235. public OnPlayerDisconnect(playerid, reason)
  1236. {
  1237. TextDrawDestroy(SpeedoText[playerid]);
  1238. return 1;
  1239. }
  1240.  
  1241. public OnVehicleSpawn(vehicleid)
  1242. {
  1243. VehicleSecurity[vehicleid] = 0;
  1244. new id = GetVehicleID(vehicleid);
  1245. if(IsValidVehicle(id))
  1246. {
  1247. if(VehicleColor[id][0] >= 0 && VehicleColor[id][1] >= 0)
  1248. ChangeVehicleColor(vehicleid, VehicleColor[id][0], VehicleColor[id][1]);
  1249. LinkVehicleToInterior(vehicleid, VehicleInterior[id]);
  1250. SetVehicleVirtualWorld(vehicleid, VehicleWorld[id]);
  1251. for(new i=0; i < sizeof(VehicleMods[]); i++)
  1252. {
  1253. AddVehicleComponent(vehicleid, VehicleMods[id][i]);
  1254. }
  1255. ChangeVehiclePaintjob(vehicleid, VehiclePaintjob[id]);
  1256. }
  1257. return 1;
  1258. }
  1259.  
  1260. CMD:avshelp(playerid, params[])
  1261. {
  1262. new info[512];
  1263. strcat(info, "/v\n", sizeof(info));
  1264. strcat(info, "/vlock /valarm /fuel /trunk /kph /sellv /givecarkeys /trackcar\n", sizeof(info));
  1265. if(IsAdmin(playerid, 1))
  1266. {
  1267. strcat(info, "/addv /editv /setfuel /rac (respawnallcars) /rtc (respawnthiscar)\n", sizeof(info));
  1268. strcat(info, "/adddealership /deletedealership /movedealership /gotodealership\n", sizeof(info));
  1269. strcat(info, "/addfuelstation /deletefuelstation /movefuelstation /gotofuelstation", sizeof(info));
  1270. }
  1271. ShowPlayerDialog(playerid, DIALOG_NONE, DIALOG_STYLE_MSGBOX, "Advanced Vehicle System Help", info, "OK", "");
  1272. return 1;
  1273. }
  1274.  
  1275. CMD:kph(playerid, params[])
  1276. {
  1277. SetPVarInt(playerid, "Speedo", 0);
  1278. SendClientMessage(playerid, COLOR_WHITE, "Speedometer units set to KPH");
  1279. return 1;
  1280. }
  1281.  
  1282. CMD:trackcar(playerid, params[])
  1283. {
  1284. if(TrackCar[playerid])
  1285. {
  1286. TrackCar[playerid] = 0;
  1287. DisablePlayerCheckpoint(playerid);
  1288. SendClientMessage(playerid, COLOR_WHITE, "You are not tracking your vehicle anymore");
  1289. return 1;
  1290. }
  1291. new info[256], bool:found;
  1292. for(new i=1; i < MAX_DVEHICLES; i++)
  1293. {
  1294. if(VehicleCreated[i] == VEHICLE_PLAYER && strcmp(VehicleOwner[i], PlayerName(playerid)) == 0)
  1295. {
  1296. found = true;
  1297. format(info, sizeof(info), "%sID: %d Name: %s\n", info, i, VehicleNames[VehicleModel[i]-400]);
  1298. }
  1299. }
  1300. if(!found) return SendClientMessage(playerid, COLOR_RED, "You don't have any vehicles!");
  1301. ShowPlayerDialog(playerid, DIALOG_FINDVEHICLE, DIALOG_STYLE_LIST, "Find Your Vehicle", info, "Find", "Cancel");
  1302. return 1;
  1303. }
  1304.  
  1305. CMD:v(playerid, params[])
  1306. {
  1307. if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_RED, "You are not driving a vehicle!");
  1308. new vehicleid = GetPlayerVehicleID(playerid);
  1309. if(IsBicycle(vehicleid)) return SendClientMessage(playerid, COLOR_RED, "You are not driving a vehicle!");
  1310. new id = GetVehicleID(vehicleid);
  1311. if(!GetPlayerVehicleAccess(playerid, id))
  1312. return SendClientMessage(playerid, COLOR_RED, "You don't have the keys for this vehicle!");
  1313. SetPVarInt(playerid, "DialogValue1", id);
  1314. ShowDialog(playerid, DIALOG_VEHICLE);
  1315. return 1;
  1316. }
  1317.  
  1318. CMD:sellv(playerid, params[])
  1319. {
  1320. new pid, id, price, msg[128];
  1321. if(sscanf(params, "udd", pid, id, price)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /sellv [player] [vehicleid] [price]");
  1322. if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, COLOR_RED, "Invalid player!");
  1323. if(GetPlayerVehicleAccess(playerid, id) != 1)
  1324. return SendClientMessage(playerid, COLOR_RED, "You are not the owner of this vehicle!");
  1325. if(price < 1) return SendClientMessage(playerid, COLOR_RED, "Invalid price!");
  1326. if(!PlayerToPlayer(playerid, pid, 10.0)) return SendClientMessage(playerid, COLOR_RED, "Player is too far!");
  1327. SetPVarInt(pid, "DialogValue1", playerid);
  1328. SetPVarInt(pid, "DialogValue2", id);
  1329. SetPVarInt(pid, "DialogValue3", price);
  1330. ShowDialog(pid, DIALOG_VEHICLE_SELL);
  1331. format(msg, sizeof(msg), "You have offered %s (%d) to buy your vehicle for $%d", PlayerName(pid), pid, price);
  1332. SendClientMessage(playerid, COLOR_WHITE, msg);
  1333. return 1;
  1334. }
  1335.  
  1336. CMD:givecarkeys(playerid, params[])
  1337. {
  1338. new pid, id, msg[128];
  1339. if(sscanf(params, "ud", pid, id)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /givecarkeys [player] [vehicleid]");
  1340. if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, COLOR_RED, "Invalid player!");
  1341. if(!IsValidVehicle(id)) return SendClientMessage(playerid, COLOR_RED, "Invalid vehicleid!");
  1342. if(GetPlayerVehicleAccess(playerid, id) != 1)
  1343. return SendClientMessage(playerid, COLOR_RED, "You are not the owner of this vehicle!");
  1344. if(!PlayerToPlayer(playerid, pid, 10.0)) return SendClientMessage(playerid, COLOR_RED, "Player is too far!");
  1345. SetPVarInt(pid, "CarKeys", id);
  1346. format(msg, sizeof(msg), "You have given your car keys to %s (%d)", PlayerName(pid), pid);
  1347. SendClientMessage(playerid, COLOR_WHITE, msg);
  1348. format(msg, sizeof(msg), "%s (%d) has given you car keys", PlayerName(playerid), playerid);
  1349. SendClientMessage(pid, COLOR_WHITE, msg);
  1350. return 1;
  1351. }
  1352.  
  1353. CMD:vlock(playerid, params[])
  1354. {
  1355. new vehicleid;
  1356. if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  1357. {
  1358. vehicleid = GetPlayerVehicleID(playerid);
  1359. }
  1360. else
  1361. {
  1362. vehicleid = GetClosestVehicle(playerid);
  1363. if(!PlayerToVehicle(playerid, vehicleid, 5.0)) vehicleid = 0;
  1364. }
  1365. if(!vehicleid) return SendClientMessage(playerid, COLOR_RED, "You are not close to a vehicle!");
  1366. new id = GetVehicleID(vehicleid);
  1367. if(!IsValidVehicle(id)) return SendClientMessage(playerid, COLOR_RED, "You don't have the keys for this vehicle!");
  1368. if(!GetPlayerVehicleAccess(playerid, id))
  1369. return SendClientMessage(playerid, COLOR_RED, "You don't have the keys for this vehicle!");
  1370. new engine, lights, alarm, doors, bonnet, boot, objective;
  1371. GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
  1372. if(doors == 1)
  1373. {
  1374. doors = 0;
  1375. GameTextForPlayer(playerid, "~g~doors unlocked", 3000, 6);
  1376. }
  1377. else
  1378. {
  1379. doors = 1;
  1380. GameTextForPlayer(playerid, "~r~doors locked", 3000, 6);
  1381. }
  1382. SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
  1383. return 1;
  1384. }
  1385.  
  1386. CMD:valarm(playerid, params[])
  1387. {
  1388. new vehicleid;
  1389. if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  1390. {
  1391. vehicleid = GetPlayerVehicleID(playerid);
  1392. }
  1393. else
  1394. {
  1395. vehicleid = GetClosestVehicle(playerid);
  1396. if(!PlayerToVehicle(playerid, vehicleid, 5.0)) vehicleid = 0;
  1397. }
  1398. if(!vehicleid) return SendClientMessage(playerid, COLOR_RED, "You are not close to a vehicle!");
  1399. new id = GetVehicleID(vehicleid);
  1400. if(!IsValidVehicle(id)) return SendClientMessage(playerid, COLOR_RED, "You don't have the keys for this vehicle!");
  1401. if(GetPlayerVehicleAccess(playerid, id) != 1)
  1402. return SendClientMessage(playerid, COLOR_RED, "You don't have the keys for this vehicle!");
  1403. if(VehicleSecurity[vehicleid] == 0)
  1404. {
  1405. VehicleSecurity[vehicleid] = 1;
  1406. GameTextForPlayer(playerid, "~g~alarm on", 3000, 6);
  1407. }
  1408. else
  1409. {
  1410. ToggleAlarm(vehicleid, VEHICLE_PARAMS_OFF);
  1411. VehicleSecurity[vehicleid] = 0;
  1412. GameTextForPlayer(playerid, "~r~alarm off", 3000, 6);
  1413. }
  1414. return 1;
  1415. }
  1416.  
  1417. CMD:trunk(playerid, params[])
  1418. {
  1419. new vehicleid = GetClosestVehicle(playerid);
  1420. if(!PlayerToVehicle(playerid, vehicleid, 5.0)) vehicleid = 0;
  1421. if(!vehicleid || IsBicycle(vehicleid) || IsPlayerInAnyVehicle(playerid))
  1422. return SendClientMessage(playerid, COLOR_RED, "You are not close to a vehicle!");
  1423. new id = GetVehicleID(vehicleid);
  1424. if(!IsValidVehicle(id)) return SendClientMessage(playerid, COLOR_RED, "You don't have the keys for this vehicle!");
  1425. if(!GetPlayerVehicleAccess(playerid, id))
  1426. return SendClientMessage(playerid, COLOR_RED, "You don't have the keys for this vehicle!");
  1427. new engine, lights, alarm, doors, bonnet, boot, objective;
  1428. GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
  1429. SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, 1, objective);
  1430. SetPVarInt(playerid, "DialogValue1", id);
  1431. ShowDialog(playerid, DIALOG_TRUNK);
  1432. return 1;
  1433. }
  1434.  
  1435. CMD:fuel(playerid, params[])
  1436. {
  1437. for(new i=1; i < MAX_FUEL_STATIONS; i++)
  1438. {
  1439. if(FuelStationCreated[i])
  1440. {
  1441. if(IsPlayerInRangeOfPoint(playerid, 15.0, FuelStationPos[i][0], FuelStationPos[i][1], FuelStationPos[i][2]))
  1442. {
  1443. SetPVarInt(playerid, "FuelStation", i);
  1444. ShowDialog(playerid, DIALOG_FUEL);
  1445. return 1;
  1446. }
  1447. }
  1448. }
  1449. SendClientMessage(playerid, COLOR_RED, "You are not in a fuel station!");
  1450. return 1;
  1451. }
  1452.  
  1453. CMD:rtc(playerid, params[])
  1454. {
  1455. if(!IsAdmin(playerid, 1)) return SendClientMessage(playerid, COLOR_RED, "You are not admin!");
  1456. if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not in a vehicle!");
  1457. SetVehicleToRespawn(GetPlayerVehicleID(playerid));
  1458. SendClientMessage(playerid, COLOR_WHITE, "Vehicle respawned");
  1459. return 1;
  1460. }
  1461.  
  1462. CMD:rac(playerid, params[])
  1463. {
  1464. if(!IsAdmin(playerid, 1)) return SendClientMessage(playerid, COLOR_RED, "You are not admin!");
  1465. new bool:vehicleused[MAX_VEHICLES];
  1466. for(new i=0; i < MAX_PLAYERS; i++)
  1467. {
  1468. if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
  1469. {
  1470. vehicleused[GetPlayerVehicleID(i)] = true;
  1471. }
  1472. }
  1473. for(new i=1; i < MAX_VEHICLES; i++)
  1474. {
  1475. if(!vehicleused[i])
  1476. {
  1477. SetVehicleToRespawn(i);
  1478. }
  1479. }
  1480. new msg[128];
  1481. format(msg, sizeof(msg), "Admin %s (%d) has respawned all unused vehicles", PlayerName(playerid), playerid);
  1482. SendClientMessageToAll(COLOR_YELLOW, msg);
  1483. return 1;
  1484. }
  1485.  
  1486. CMD:setfuel(playerid, params[])
  1487. {
  1488. if(!IsAdmin(playerid, 1)) return SendClientMessage(playerid, COLOR_RED, "You are not admin!");
  1489. if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not in a vehicle!");
  1490. new amount, msg[128];
  1491. if(sscanf(params, "d", amount)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /setfuel [amount]");
  1492. if(amount < 0 || amount > 100) return SendClientMessage(playerid, COLOR_RED, "Invalid amount! (0-100)");
  1493. Fuel[GetPlayerVehicleID(playerid)] = amount;
  1494. format(msg, sizeof(msg), "You have set your vehicle fuel to %d", amount);
  1495. SendClientMessage(playerid, COLOR_WHITE, msg);
  1496. return 1;
  1497. }
  1498.  
  1499. CMD:addv(playerid, params[])
  1500. {
  1501. if(!IsAdmin(playerid, 1)) return SendClientMessage(playerid, COLOR_RED, "You are not admin!");
  1502. if(!IsPlayerSpawned(playerid)) return SendClientMessage(playerid, COLOR_RED, "You can't use this command now!");
  1503. new model[32], modelid, dealerid, color1, color2, price;
  1504. if(sscanf(params, "dsddd", dealerid, model, color1, color2, price))
  1505. return SendClientMessage(playerid, COLOR_GREY, "USAGE: /addv [dealerid] [model] [color1] [color2] [price]");
  1506. if(!IsValidDealership(dealerid)) return SendClientMessage(playerid, COLOR_RED, "Invalid dealerid!");
  1507. if(IsNumeric(model)) modelid = strval(model);
  1508. else modelid = GetVehicleModelIDFromName(model);
  1509. if(modelid < 400 || modelid > 611) return SendClientMessage(playerid, COLOR_RED, "Invalid model ID!");
  1510. if(color1 < 0 || color2 < 0) return SendClientMessage(playerid, COLOR_RED, "Invalid color!");
  1511. if(price < 0) return SendClientMessage(playerid, COLOR_RED, "Invalid price!");
  1512. new Float:X, Float:Y, Float:Z, Float:angle;
  1513. GetPlayerPos(playerid, X, Y, Z);
  1514. GetPlayerFacingAngle(playerid, angle);
  1515. X += floatmul(floatsin(-angle, degrees), 4.0);
  1516. Y += floatmul(floatcos(-angle, degrees), 4.0);
  1517. for(new i=1; i < MAX_DVEHICLES; i++)
  1518. {
  1519. if(!VehicleCreated[i])
  1520. {
  1521. new msg[128];
  1522. VehicleCreated[i] = VEHICLE_DEALERSHIP;
  1523. VehicleModel[i] = modelid;
  1524. VehiclePos[i][0] = X;
  1525. VehiclePos[i][1] = Y;
  1526. VehiclePos[i][2] = Z;
  1527. VehiclePos[i][3] = angle+90.0;
  1528. VehicleColor[i][0] = color1;
  1529. VehicleColor[i][1] = color2;
  1530. VehicleInterior[i] = GetPlayerInterior(playerid);
  1531. VehicleWorld[i] = GetPlayerVirtualWorld(playerid);
  1532. VehicleValue[i] = price;
  1533. valstr(VehicleOwner[i], dealerid);
  1534. VehicleNumberPlate[i] = DEFAULT_NUMBER_PLATE;
  1535. for(new d=0; d < sizeof(VehicleTrunk[]); d++)
  1536. {
  1537. VehicleTrunk[i][d][0] = 0;
  1538. VehicleTrunk[i][d][1] = 0;
  1539. }
  1540. for(new d=0; d < sizeof(VehicleMods[]); d++)
  1541. {
  1542. VehicleMods[i][d] = 0;
  1543. }
  1544. VehiclePaintjob[i] = 255;
  1545. UpdateVehicle(i, 0);
  1546. SaveVehicle(i);
  1547. format(msg, sizeof(msg), "Added vehicle id %d to dealerid %d", i, dealerid);
  1548. SendClientMessage(playerid, COLOR_WHITE, msg);
  1549. return 1;
  1550. }
  1551. }
  1552. SendClientMessage(playerid, COLOR_RED, "Can't add any more vehicles!");
  1553. return 1;
  1554. }
  1555.  
  1556. CMD:editv(playerid, params[])
  1557. {
  1558. if(!IsAdmin(playerid, 1)) return SendClientMessage(playerid, COLOR_RED, "You are not admin!");
  1559. if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  1560. {
  1561. new id = GetVehicleID(GetPlayerVehicleID(playerid));
  1562. if(!IsValidVehicle(id)) return SendClientMessage(playerid, COLOR_RED, "This is not a dynamic vehicle!");
  1563. SetPVarInt(playerid, "DialogValue1", id);
  1564. ShowDialog(playerid, DIALOG_EDITVEHICLE);
  1565. return 1;
  1566. }
  1567. new vehicleid;
  1568. if(sscanf(params, "d", vehicleid)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /editv [vehicleid]");
  1569. if(!IsValidVehicle(vehicleid)) return SendClientMessage(playerid, COLOR_RED, "Invalid vehicleid!");
  1570. SetPVarInt(playerid, "DialogValue1", vehicleid);
  1571. ShowDialog(playerid, DIALOG_EDITVEHICLE);
  1572. return 1;
  1573. }
  1574.  
  1575. CMD:adddealership(playerid, params[])
  1576. {
  1577. if(!IsAdmin(playerid, 1)) return SendClientMessage(playerid, COLOR_RED, "You are not admin!");
  1578. if(!IsPlayerSpawned(playerid)) return SendClientMessage(playerid, COLOR_RED, "You can't use this command now!");
  1579. for(new i=1; i < MAX_DEALERSHIPS; i++)
  1580. {
  1581. if(!DealershipCreated[i])
  1582. {
  1583. new msg[128];
  1584. DealershipCreated[i] = 1;
  1585. GetPlayerPos(playerid, DealershipPos[i][0], DealershipPos[i][1], DealershipPos[i][2]);
  1586. UpdateDealership(i, 0);
  1587. SaveDealership(i);
  1588. format(msg, sizeof(msg), "Added dealership id %d", i);
  1589. SendClientMessage(playerid, COLOR_WHITE, msg);
  1590. return 1;
  1591. }
  1592. }
  1593. SendClientMessage(playerid, COLOR_RED, "Can't add any more dealerships!");
  1594. return 1;
  1595. }
  1596.  
  1597. CMD:deletedealership(playerid, params[])
  1598. {
  1599. if(!IsAdmin(playerid, 1)) return SendClientMessage(playerid, COLOR_RED, "You are not admin!");
  1600. new dealerid, msg[128];
  1601. if(sscanf(params, "d", dealerid)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /deletedealership [dealerid]");
  1602. if(!IsValidDealership(dealerid)) return SendClientMessage(playerid, COLOR_RED, "Invalid dealerid!");
  1603. for(new i=1; i < MAX_DVEHICLES; i++)
  1604. {
  1605. if(VehicleCreated[i] == VEHICLE_DEALERSHIP && strval(VehicleOwner[i]) == dealerid)
  1606. {
  1607. DestroyVehicle(VehicleID[i]);
  1608. Delete3DTextLabel(VehicleLabel[i]);
  1609. VehicleCreated[i] = 0;
  1610. }
  1611. }
  1612. DealershipCreated[dealerid] = 0;
  1613. Delete3DTextLabel(DealershipLabel[dealerid]);
  1614. SaveDealership(dealerid);
  1615. format(msg, sizeof(msg), "Deleted dealership id %d", dealerid);
  1616. SendClientMessage(playerid, COLOR_WHITE, msg);
  1617. return 1;
  1618. }
  1619.  
  1620. CMD:movedealership(playerid, params[])
  1621. {
  1622. if(!IsAdmin(playerid, 1)) return SendClientMessage(playerid, COLOR_RED, "You are not admin!");
  1623. new dealerid, msg[128];
  1624. if(sscanf(params, "d", dealerid)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /movedealership [dealerid]");
  1625. if(!IsValidDealership(dealerid)) return SendClientMessage(playerid, COLOR_RED, "Invalid dealerid!");
  1626. GetPlayerPos(playerid, DealershipPos[dealerid][0], DealershipPos[dealerid][1], DealershipPos[dealerid][2]);
  1627. UpdateDealership(dealerid, 1);
  1628. SaveDealership(dealerid);
  1629. format(msg, sizeof(msg), "Moved dealership id %d here", dealerid);
  1630. SendClientMessage(playerid, COLOR_WHITE, msg);
  1631. return 1;
  1632. }
  1633.  
  1634. CMD:gotodealership(playerid, params[])
  1635. {
  1636. if(!IsAdmin(playerid, 1)) return SendClientMessage(playerid, COLOR_RED, "You are not admin!");
  1637. new dealerid, msg[128];
  1638. if(sscanf(params, "d", dealerid)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /gotodealership [dealerid]");
  1639. if(!IsValidDealership(dealerid)) return SendClientMessage(playerid, COLOR_RED, "Invalid dealerid!");
  1640. SetPlayerPos(playerid, DealershipPos[dealerid][0], DealershipPos[dealerid][1], DealershipPos[dealerid][2]);
  1641. format(msg, sizeof(msg), "Teleported to dealership id %d", dealerid);
  1642. SendClientMessage(playerid, COLOR_WHITE, msg);
  1643. return 1;
  1644. }
  1645.  
  1646. CMD:addfuelstation(playerid, params[])
  1647. {
  1648. if(!IsAdmin(playerid, 1)) return SendClientMessage(playerid, COLOR_RED, "You are not admin!");
  1649. if(!IsPlayerSpawned(playerid)) return SendClientMessage(playerid, COLOR_RED, "You can't use this command now!");
  1650. for(new i=1; i < MAX_FUEL_STATIONS; i++)
  1651. {
  1652. if(!FuelStationCreated[i])
  1653. {
  1654. new msg[128];
  1655. FuelStationCreated[i] = 1;
  1656. GetPlayerPos(playerid, FuelStationPos[i][0], FuelStationPos[i][1], FuelStationPos[i][2]);
  1657. UpdateFuelStation(i, 0);
  1658. SaveFuelStation(i);
  1659. format(msg, sizeof(msg), "Added fuel station id %d", i);
  1660. SendClientMessage(playerid, COLOR_WHITE, msg);
  1661. return 1;
  1662. }
  1663. }
  1664. SendClientMessage(playerid, COLOR_RED, "Can't add any more fuel stations!");
  1665. return 1;
  1666. }
  1667.  
  1668. CMD:deletefuelstation(playerid, params[])
  1669. {
  1670. if(!IsAdmin(playerid, 1)) return SendClientMessage(playerid, COLOR_RED, "You are not admin!");
  1671. new stationid, msg[128];
  1672. if(sscanf(params, "d", stationid)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /deletefuelstation [stationid]");
  1673. if(!IsValidFuelStation(stationid)) return SendClientMessage(playerid, COLOR_RED, "Invalid stationid!");
  1674. FuelStationCreated[stationid] = 0;
  1675. Delete3DTextLabel(FuelStationLabel[stationid]);
  1676. SaveFuelStation(stationid);
  1677. format(msg, sizeof(msg), "Deleted fuel station id %d", stationid);
  1678. SendClientMessage(playerid, COLOR_WHITE, msg);
  1679. return 1;
  1680. }
  1681.  
  1682. CMD:movefuelstation(playerid, params[])
  1683. {
  1684. if(!IsAdmin(playerid, 1)) return SendClientMessage(playerid, COLOR_RED, "You are not admin!");
  1685. new stationid, msg[128];
  1686. if(sscanf(params, "d", stationid)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /movefuelstation [stationid]");
  1687. if(!IsValidFuelStation(stationid)) return SendClientMessage(playerid, COLOR_RED, "Invalid stationid!");
  1688. GetPlayerPos(playerid, FuelStationPos[stationid][0], FuelStationPos[stationid][1], FuelStationPos[stationid][2]);
  1689. UpdateFuelStation(stationid, 1);
  1690. SaveFuelStation(stationid);
  1691. format(msg, sizeof(msg), "Moved fuel station id %d here", stationid);
  1692. SendClientMessage(playerid, COLOR_WHITE, msg);
  1693. return 1;
  1694. }
  1695.  
  1696. CMD:gotofuelstation(playerid, params[])
  1697. {
  1698. if(!IsAdmin(playerid, 1)) return SendClientMessage(playerid, COLOR_RED, "You are not admin!");
  1699. new stationid, msg[128];
  1700. if(sscanf(params, "d", stationid)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /gotofuelstation [stationid]");
  1701. if(!IsValidFuelStation(stationid)) return SendClientMessage(playerid, COLOR_RED, "Invalid stationid!");
  1702. SetPlayerPos(playerid, FuelStationPos[stationid][0], FuelStationPos[stationid][1], FuelStationPos[stationid][2]);
  1703. format(msg, sizeof(msg), "Teleported to fuel station id %d", stationid);
  1704. SendClientMessage(playerid, COLOR_WHITE, msg);
  1705. return 1;
  1706. }
  1707.  
  1708. public OnPlayerCommandText(playerid, cmdtext[])
  1709. {
  1710. new pos, funcname[32];
  1711. while(cmdtext[++pos] > ' ')
  1712. {
  1713. funcname[pos-1] = tolower(cmdtext[pos]);
  1714. }
  1715. strins(funcname, "cmd_", 0, sizeof(funcname));
  1716. while (cmdtext[pos] == ' ') pos++;
  1717. if(!cmdtext[pos])
  1718. {
  1719. return CallLocalFunction(funcname, "is", playerid, "\1");
  1720. }
  1721. return CallLocalFunction(funcname, "is", playerid, cmdtext[pos]);
  1722. }
  1723.  
  1724. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  1725. {
  1726. if(!ispassenger)
  1727. {
  1728. new id = GetVehicleID(vehicleid);
  1729. if(IsValidVehicle(id) && VehicleCreated[id] == VEHICLE_PLAYER)
  1730. {
  1731. new msg[128];
  1732. format(msg, sizeof(msg), "This vehicle belongs to %s", VehicleOwner[id]);
  1733. SendClientMessage(playerid, COLOR_GREY, msg);
  1734. }
  1735. }
  1736. return 1;
  1737. }
  1738.  
  1739. public OnPlayerStateChange(playerid, newstate, oldstate)
  1740. {
  1741. if(IsPlayerInAnyVehicle(playerid) && !IsBicycle(GetPlayerVehicleID(playerid)))
  1742. {
  1743. TextDrawShowForPlayer(playerid, SpeedoBox);
  1744. TextDrawShowForPlayer(playerid, SpeedoText[playerid]);
  1745. new vehicleid = GetPlayerVehicleID(playerid);
  1746. if(VehicleSecurity[vehicleid] == 1)
  1747. {
  1748. ToggleAlarm(vehicleid, VEHICLE_PARAMS_ON);
  1749. SetTimerEx("StopAlarm", ALARM_TIME, false, "d", vehicleid);
  1750. }
  1751. }
  1752. else
  1753. {
  1754. TextDrawHideForPlayer(playerid, SpeedoBox);
  1755. TextDrawHideForPlayer(playerid, SpeedoText[playerid]);
  1756. }
  1757. if(newstate == PLAYER_STATE_DRIVER)
  1758. {
  1759. new vehicleid = GetPlayerVehicleID(playerid);
  1760. new id = GetVehicleID(vehicleid);
  1761. if(IsValidVehicle(id))
  1762. {
  1763. if(VehicleCreated[id] == VEHICLE_DEALERSHIP)
  1764. {
  1765. SetPVarInt(playerid, "DialogValue1", id);
  1766. ShowDialog(playerid, DIALOG_VEHICLE_BUY);
  1767. return 1;
  1768. }
  1769. }
  1770. if(IsBicycle(vehicleid))
  1771. {
  1772. ToggleEngine(vehicleid, VEHICLE_PARAMS_ON);
  1773. }
  1774. if(Fuel[vehicleid] <= 0)
  1775. {
  1776. ToggleEngine(vehicleid, VEHICLE_PARAMS_OFF);
  1777. }
  1778. }
  1779. return 1;
  1780. }
  1781.  
  1782. public OnVehicleMod(playerid, vehicleid, componentid)
  1783. {
  1784. new id = GetVehicleID(vehicleid);
  1785. if(IsValidVehicle(id))
  1786. {
  1787. VehicleMods[id][GetVehicleComponentType(componentid)] = componentid;
  1788. SaveVehicle(id);
  1789. }
  1790. return 1;
  1791. }
  1792.  
  1793. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  1794. {
  1795. new id = GetVehicleID(vehicleid);
  1796. if(IsValidVehicle(id))
  1797. {
  1798. VehiclePaintjob[id] = paintjobid;
  1799. SaveVehicle(id);
  1800. }
  1801. return 1;
  1802. }
  1803.  
  1804. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  1805. {
  1806. new id = GetVehicleID(vehicleid);
  1807. if(IsValidVehicle(id))
  1808. {
  1809. VehicleColor[id][0] = color1;
  1810. VehicleColor[id][1] = color2;
  1811. SaveVehicle(id);
  1812. }
  1813. return 1;
  1814. }
  1815.  
  1816. ShowDialog(playerid, dialogid)
  1817. {
  1818. switch(dialogid)
  1819. {
  1820. case DIALOG_VEHICLE:
  1821. {
  1822. new vehicleid = GetPVarInt(playerid, "DialogValue1");
  1823. new caption[32], info[256];
  1824. format(caption, sizeof(caption), "Vehicle ID %d", vehicleid);
  1825. strcat(info, "Engine\nLights\nBonnet\nTrunk", sizeof(info));
  1826. strcat(info, "\nFill Tank", sizeof(info));
  1827. switch(GetPlayerVehicleAccess(playerid, vehicleid))
  1828. {
  1829. case 1:
  1830. {
  1831. new value = VehicleValue[vehicleid]/2;
  1832. format(info, sizeof(info), "%s\nSell Vehicle ($%d)", info, value);
  1833. }
  1834. }
  1835. ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_LIST, caption, info, "Select", "Cancel");
  1836. }
  1837. case DIALOG_VEHICLE_BUY:
  1838. {
  1839. new vehicleid = GetPVarInt(playerid, "DialogValue1");
  1840. new caption[32], info[256];
  1841. format(caption, sizeof(caption), "Vehicle ID %d", vehicleid);
  1842. format(info, sizeof(info), "This vehicle is for sale ($%d)\nWould you like to buy it?", VehicleValue[vehicleid]);
  1843. ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, caption, info, "Yes", "No");
  1844. }
  1845. case DIALOG_VEHICLE_SELL:
  1846. {
  1847. new targetid = GetPVarInt(playerid, "DialogValue1");
  1848. new id = GetPVarInt(playerid, "DialogValue2");
  1849. new price = GetPVarInt(playerid, "DialogValue3");
  1850. new info[256];
  1851. format(info, sizeof(info), "%s (%d) wants to sell you a %s for $%d.", PlayerName(targetid), targetid,
  1852. VehicleNames[VehicleModel[id]-400], price);
  1853. strcat(info, "\n\nWould you like to buy?", sizeof(info));
  1854. ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, "Buy Vehicle", info, "Yes", "No");
  1855. }
  1856. case DIALOG_TRUNK:
  1857. {
  1858. new vehicleid = GetPVarInt(playerid, "DialogValue1");
  1859. new name[32], info[256];
  1860. for(new i=0; i < sizeof(VehicleTrunk[]); i++)
  1861. {
  1862. if(VehicleTrunk[vehicleid][i][1] > 0)
  1863. {
  1864. GetWeaponName(VehicleTrunk[vehicleid][i][0], name, sizeof(name));
  1865. format(info, sizeof(info), "%s%d. %s (%d)\n", info, i+1, name, VehicleTrunk[vehicleid][i][1]);
  1866. }
  1867. else
  1868. {
  1869. format(info, sizeof(info), "%s%d. Empty\n", info, i+1);
  1870. }
  1871. }
  1872. ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_LIST, "Trunk", info, "Select", "Cancel");
  1873. }
  1874. case DIALOG_TRUNK_ACTION:
  1875. {
  1876. new info[128];
  1877. strcat(info, "Put Into Trunk\nTake From Trunk", sizeof(info));
  1878. ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_LIST, "Trunk", info, "Select", "Cancel");
  1879. }
  1880. case DIALOG_FUEL:
  1881. {
  1882. new info[128];
  1883. strcat(info, "Refuel Vehicle ($" #FUEL_PRICE ")\nBuy Gas Can ($" #GAS_CAN_PRICE ")", sizeof(info));
  1884. ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_LIST, "Fuel Station", info, "OK", "Cancel");
  1885. }
  1886. case DIALOG_EDITVEHICLE:
  1887. {
  1888. new vehicleid = GetPVarInt(playerid, "DialogValue1");
  1889. new caption[32], info[256];
  1890. format(caption, sizeof(caption), "Edit Vehicle ID %d", vehicleid);
  1891. format(info, sizeof(info), "1. Value: [$%d]\n2. Model: [%d (%s)]\n3. Colors: [%d] [%d]\n4. License Plate: [%s]",
  1892. VehicleValue[vehicleid], VehicleModel[vehicleid], VehicleNames[VehicleModel[vehicleid]-400],
  1893. VehicleColor[vehicleid][0], VehicleColor[vehicleid][1], VehicleNumberPlate[vehicleid]);
  1894. strcat(info, "\n5. Delete Vehicle\n6. Park Vehicle\n7. Go To Vehicle", sizeof(info));
  1895. strcat(info, "\n\nEnter: [nr] [value1] [value2]", sizeof(info));
  1896. ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_INPUT, caption, info, "OK", "Cancel");
  1897. }
  1898. }
  1899. }
  1900.  
  1901. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  1902. {
  1903. if(dialogid == DIALOG_ERROR)
  1904. {
  1905. ShowDialog(playerid, DialogReturn[playerid]);
  1906. return 1;
  1907. }
  1908. DialogReturn[playerid] = dialogid;
  1909. if(dialogid == DIALOG_VEHICLE)
  1910. {
  1911. if(response)
  1912. {
  1913. switch(listitem)
  1914. {
  1915. case 0:
  1916. {
  1917. new vehicleid = GetPlayerVehicleID(playerid);
  1918. new engine, lights, alarm, doors, bonnet, boot, objective;
  1919. GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
  1920. if(engine == 0 && Fuel[vehicleid] <= 0)
  1921. {
  1922. ShowErrorDialog(playerid, "This vehicle is out of fuel!");
  1923. return 1;
  1924. }
  1925. if(engine == 1) { engine = 0; lights = 0; }
  1926. else { engine = 1; lights = 0; }
  1927. SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
  1928. }
  1929. case 1:
  1930. {
  1931. new vehicleid = GetPlayerVehicleID(playerid);
  1932. new engine, lights, alarm, doors, bonnet, boot, objective;
  1933. GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
  1934. if(lights == 1) lights = 0; else lights = 1;
  1935. SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
  1936. }
  1937. case 2:
  1938. {
  1939. new vehicleid = GetPlayerVehicleID(playerid);
  1940. new engine, lights, alarm, doors, bonnet, boot, objective;
  1941. GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
  1942. if(bonnet == 1) bonnet = 0; else bonnet = 1;
  1943. SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
  1944. }
  1945. case 3:
  1946. {
  1947. new vehicleid = GetPlayerVehicleID(playerid);
  1948. new engine, lights, alarm, doors, bonnet, boot, objective;
  1949. GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
  1950. if(boot == 1) boot = 0; else boot = 1;
  1951. SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
  1952. }
  1953. case 4:
  1954. {
  1955. if(!GetPVarInt(playerid, "GasCan"))
  1956. {
  1957. ShowErrorDialog(playerid, "You don't have a gas can!");
  1958. return 1;
  1959. }
  1960. new vehicleid = GetPlayerVehicleID(playerid);
  1961. if(Fuel[vehicleid] < 80.0) Fuel[vehicleid] += 20.0;
  1962. else Fuel[vehicleid] = 100.0;
  1963. SetPVarInt(playerid, "GasCan", 0);
  1964. SendClientMessage(playerid, COLOR_WHITE, "You have filled the fuel tank with 20 fuel");
  1965. }
  1966. case 5:
  1967. {
  1968. new id = GetPVarInt(playerid, "DialogValue1");
  1969. if(GetPlayerVehicleAccess(playerid, id) != 1)
  1970. {
  1971. ShowErrorDialog(playerid, "You are not the owner of this vehicle!");
  1972. return 1;
  1973. }
  1974. new msg[128];
  1975. VehicleCreated[id] = 0;
  1976. new money = VehicleValue[id]/2;
  1977. GivePlayerMoney(playerid, money);
  1978. format(msg, sizeof(msg), "You have sold your vehicle for $%d", money);
  1979. SendClientMessage(playerid, COLOR_WHITE, msg);
  1980. RemovePlayerFromVehicle(playerid);
  1981. DestroyVehicle(VehicleID[id]);
  1982. SaveVehicle(id);
  1983. }
  1984. case 6:
  1985. {
  1986. new vehicleid = GetPVarInt(playerid, "DialogValue1");
  1987. if(GetPlayerVehicleAccess(playerid, vehicleid) != 1 && GetPlayerVehicleAccess(playerid, vehicleid) != 3)
  1988. {
  1989. ShowErrorDialog(playerid, "You are not the owner of this vehicle!");
  1990. return 1;
  1991. }
  1992. GetVehiclePos(VehicleID[vehicleid], VehiclePos[vehicleid][0], VehiclePos[vehicleid][1], VehiclePos[vehicleid][2]);
  1993. GetVehicleZAngle(VehicleID[vehicleid], VehiclePos[vehicleid][3]);
  1994. SendClientMessage(playerid, COLOR_WHITE, "You have parked this vehicle here");
  1995. UpdateVehicle(vehicleid, 1);
  1996. PutPlayerInVehicle(playerid, VehicleID[vehicleid], 0);
  1997. SaveVehicle(vehicleid);
  1998. }
  1999. case 7:
  2000. {
  2001. ShowDialog(playerid, DIALOG_VEHICLE_PLATE);
  2002. }
  2003. }
  2004. }
  2005. return 1;
  2006. }
  2007. if(dialogid == DIALOG_VEHICLE_BUY)
  2008. {
  2009. if(response)
  2010. {
  2011. if(GetPlayerVehicles(playerid) >= MAX_PLAYER_VEHICLES)
  2012. {
  2013. ShowErrorDialog(playerid, "You can't buy any more vehicles! Max: " #MAX_PLAYER_VEHICLES );
  2014. return 1;
  2015. }
  2016. new id = GetPVarInt(playerid, "DialogValue1");
  2017. if(GetPlayerMoney(playerid) < VehicleValue[id])
  2018. {
  2019. ShowErrorDialog(playerid, "You don't have enough money to buy this vehicle!");
  2020. return 1;
  2021. }
  2022. new freeid;
  2023. for(new i=1; i < MAX_DVEHICLES; i++)
  2024. {
  2025. if(!VehicleCreated[i])
  2026. {
  2027. freeid = i; break;
  2028. }
  2029. }
  2030. if(!freeid)
  2031. {
  2032. ShowErrorDialog(playerid, "Vehicle dealership is out of stock!");
  2033. return 1;
  2034. }
  2035. GivePlayerMoney(playerid, -VehicleValue[id]);
  2036. new dealerid = strval(VehicleOwner[id]);
  2037. VehicleCreated[freeid] = VEHICLE_PLAYER;
  2038. VehicleModel[freeid] = VehicleModel[id];
  2039. VehiclePos[freeid] = DealershipPos[dealerid];
  2040. VehicleColor[freeid] = VehicleColor[id];
  2041. VehicleInterior[freeid] = VehicleInterior[id];
  2042. VehicleWorld[freeid] = VehicleWorld[id];
  2043. VehicleValue[freeid] = VehicleValue[id];
  2044. VehicleOwner[freeid] = PlayerName(playerid);
  2045. VehicleNumberPlate[freeid] = DEFAULT_NUMBER_PLATE;
  2046. for(new d=0; d < sizeof(VehicleTrunk[]); d++)
  2047. {
  2048. VehicleTrunk[freeid][d][0] = 0;
  2049. VehicleTrunk[freeid][d][1] = 0;
  2050. }
  2051. for(new d=0; d < sizeof(VehicleMods[]); d++)
  2052. {
  2053. VehicleMods[freeid][d] = 0;
  2054. }
  2055. VehiclePaintjob[freeid] = 255;
  2056. UpdateVehicle(freeid, 0);
  2057. SaveVehicle(freeid);
  2058. new msg[128];
  2059. format(msg, sizeof(msg), "You have bought this vehicle for $%d", VehicleValue[id]);
  2060. SendClientMessage(playerid, COLOR_WHITE, msg);
  2061. }
  2062. else
  2063. {
  2064. new vehicleid = GetPVarInt(playerid, "DialogValue1");
  2065. if(GetPlayerVehicleAccess(playerid, vehicleid) != 3)
  2066. {
  2067. RemovePlayerFromVehicle(playerid);
  2068. }
  2069. }
  2070. return 1;
  2071. }
  2072. if(dialogid == DIALOG_VEHICLE_SELL)
  2073. {
  2074. if(response)
  2075. {
  2076. if(GetPlayerVehicles(playerid) >= MAX_PLAYER_VEHICLES)
  2077. {
  2078. ShowErrorDialog(playerid, "You can't buy any more vehicles! Max: " #MAX_PLAYER_VEHICLES );
  2079. return 1;
  2080. }
  2081. new targetid = GetPVarInt(playerid, "DialogValue1");
  2082. new vehicleid = GetPVarInt(playerid, "DialogValue2");
  2083. new price = GetPVarInt(playerid, "DialogValue3");
  2084. if(GetPlayerMoney(playerid) < price)
  2085. {
  2086. ShowErrorDialog(playerid, "You don't have enough money to buy this vehicle!");
  2087. return 1;
  2088. }
  2089. new msg[128];
  2090. VehicleOwner[vehicleid] = PlayerName(playerid);
  2091. GivePlayerMoney(playerid, -price);
  2092. GivePlayerMoney(targetid, price);
  2093. SaveVehicle(vehicleid);
  2094. format(msg, sizeof(msg), "You have bought this vehicle for $%d", price);
  2095. SendClientMessage(playerid, COLOR_WHITE, msg);
  2096. format(msg, sizeof(msg), "%s (%d) has accepted your offer and bought the vehicle", PlayerName(playerid), playerid);
  2097. SendClientMessage(targetid, COLOR_WHITE, msg);
  2098. }
  2099. else
  2100. {
  2101. new targetid = GetPVarInt(playerid, "DialogValue1");
  2102. new msg[128];
  2103. format(msg, sizeof(msg), "%s (%d) refused your offer", PlayerName(playerid), playerid);
  2104. SendClientMessage(targetid, COLOR_WHITE, msg);
  2105. }
  2106. return 1;
  2107. }
  2108. if(dialogid == DIALOG_FINDVEHICLE)
  2109. {
  2110. if(response)
  2111. {
  2112. new id;
  2113. sscanf(inputtext[4], "d", id);
  2114. if(IsValidVehicle(id))
  2115. {
  2116. TrackCar[playerid] = VehicleID[id];
  2117. SendClientMessage(playerid, COLOR_WHITE, "You vehicle's location is shown on your radar");
  2118. }
  2119. }
  2120. return 1;
  2121. }
  2122. if(dialogid == DIALOG_TRUNK)
  2123. {
  2124. if(response)
  2125. {
  2126. SetPVarInt(playerid, "DialogValue2", listitem);
  2127. ShowDialog(playerid, DIALOG_TRUNK_ACTION);
  2128. }
  2129. else
  2130. {
  2131. new vehicleid = GetPVarInt(playerid, "DialogValue1");
  2132. new engine, lights, alarm, doors, bonnet, boot, objective;
  2133. GetVehicleParamsEx(VehicleID[vehicleid], engine, lights, alarm, doors, bonnet, boot, objective);
  2134. SetVehicleParamsEx(VehicleID[vehicleid], engine, lights, alarm, doors, bonnet, 0, objective);
  2135. }
  2136. return 1;
  2137. }
  2138. if(dialogid == DIALOG_TRUNK_ACTION)
  2139. {
  2140. if(response)
  2141. {
  2142. new vehicleid = GetPVarInt(playerid, "DialogValue1");
  2143. new slot = GetPVarInt(playerid, "DialogValue2");
  2144. switch(listitem)
  2145. {
  2146. case 0:
  2147. {
  2148. new weaponid = GetPlayerWeapon(playerid);
  2149. if(weaponid == 0)
  2150. {
  2151. ShowPlayerDialog(playerid, DIALOG_ERROR, DIALOG_STYLE_MSGBOX, "ERROR", "You don't have a weapon in your hands!", "OK", "");
  2152. return 1;
  2153. }
  2154. VehicleTrunk[vehicleid][slot][0] = weaponid;
  2155. if(IsMeleeWeapon(weaponid)) VehicleTrunk[vehicleid][slot][1] = 1;
  2156. else VehicleTrunk[vehicleid][slot][1] = GetPlayerAmmo(playerid);
  2157. RemovePlayerWeapon(playerid, weaponid);
  2158. SaveVehicle(vehicleid);
  2159. }
  2160. case 1:
  2161. {
  2162. if(VehicleTrunk[vehicleid][slot][1] <= 0)
  2163. {
  2164. ShowPlayerDialog(playerid, DIALOG_ERROR, DIALOG_STYLE_MSGBOX, "ERROR", "This slot is empty!", "OK", "");
  2165. return 1;
  2166. }
  2167. GivePlayerWeapon(playerid, VehicleTrunk[vehicleid][slot][0], VehicleTrunk[vehicleid][slot][1]);
  2168. VehicleTrunk[vehicleid][slot][0] = 0;
  2169. VehicleTrunk[vehicleid][slot][1] = 0;
  2170. SaveVehicle(vehicleid);
  2171. }
  2172. }
  2173. }
  2174. ShowDialog(playerid, DIALOG_TRUNK);
  2175. return 1;
  2176. }
  2177. if(dialogid == DIALOG_VEHICLE_PLATE)
  2178. {
  2179. if(response)
  2180. {
  2181. if(strlen(inputtext) < 1 || strlen(inputtext) >= sizeof(VehicleNumberPlate[]))
  2182. {
  2183. ShowErrorDialog(playerid, "Invalid length!");
  2184. return 1;
  2185. }
  2186. new id = GetPVarInt(playerid, "DialogValue1");
  2187. new vehicleid = VehicleID[id];
  2188. strmid(VehicleNumberPlate[id], inputtext, 0, sizeof(VehicleNumberPlate[]));
  2189. SaveVehicle(id);
  2190. SetVehicleNumberPlate(vehicleid, inputtext);
  2191. SetVehicleToRespawn(vehicleid);
  2192. new msg[128];
  2193. format(msg, sizeof(msg), "You have changed vehicle number plate to %s", inputtext);
  2194. SendClientMessage(playerid, COLOR_WHITE, msg);
  2195. }
  2196. else ShowDialog(playerid, DIALOG_VEHICLE);
  2197. return 1;
  2198. }
  2199. if(dialogid == DIALOG_FUEL)
  2200. {
  2201. if(response)
  2202. {
  2203. switch(listitem)
  2204. {
  2205. case 0:
  2206. {
  2207. if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
  2208. {
  2209. ShowErrorDialog(playerid, "You are not driving a vehicle!");
  2210. return 1;
  2211. }
  2212. new vehicleid = GetPlayerVehicleID(playerid);
  2213. if(IsBicycle(vehicleid))
  2214. {
  2215. ShowErrorDialog(playerid, "Your vehicle doesn't have a fuel tank!");
  2216. return 1;
  2217. }
  2218. if(Fuel[vehicleid] >= 100.0)
  2219. {
  2220. ShowErrorDialog(playerid, "Your vehicle fuel tank is full!");
  2221. return 1;
  2222. }
  2223. if(GetPlayerMoney(playerid) < FUEL_PRICE)
  2224. {
  2225. ShowErrorDialog(playerid, "You don't have enough money!");
  2226. return 1;
  2227. }
  2228. RefuelTime[playerid] = 5;
  2229. SetPVarFloat(playerid, "Fuel", Fuel[vehicleid]);
  2230. GameTextForPlayer(playerid, "~w~refueling...", 2000, 3);
  2231. }
  2232. case 1:
  2233. {
  2234. if(GetPVarInt(playerid, "GasCan"))
  2235. {
  2236. ShowErrorDialog(playerid, "You already have a gas can!");
  2237. return 1;
  2238. }
  2239. if(GetPlayerMoney(playerid) < GAS_CAN_PRICE)
  2240. {
  2241. ShowErrorDialog(playerid, "You don't have enough money!");
  2242. return 1;
  2243. }
  2244. GivePlayerMoney(playerid, -GAS_CAN_PRICE);
  2245. SetPVarInt(playerid, "GasCan", 1);
  2246. SendClientMessage(playerid, COLOR_WHITE, "You have bought a gas can for $" #GAS_CAN_PRICE );
  2247. }
  2248. }
  2249. }
  2250. return 1;
  2251. }
  2252. if(dialogid == DIALOG_EDITVEHICLE)
  2253. {
  2254. if(response)
  2255. {
  2256. new id = GetPVarInt(playerid, "DialogValue1");
  2257. new nr, params[128];
  2258. sscanf(inputtext, "ds", nr, params);
  2259. switch(nr)
  2260. {
  2261. case 1:
  2262. {
  2263. new value = strval(params);
  2264. if(value < 0) value = 0;
  2265. VehicleValue[id] = value;
  2266. UpdateVehicleLabel(id, 1);
  2267. SaveVehicle(id);
  2268. ShowDialog(playerid, DIALOG_EDITVEHICLE);
  2269. }
  2270. case 2:
  2271. {
  2272. new value;
  2273. if(IsNumeric(params)) value = strval(params);
  2274. else value = GetVehicleModelIDFromName(params);
  2275. if(value < 400 || value > 611)
  2276. {
  2277. ShowErrorDialog(playerid, "Invalid vehicle model!");
  2278. return 1;
  2279. }
  2280. VehicleModel[id] = value;
  2281. for(new i=0; i < sizeof(VehicleMods[]); i++)
  2282. {
  2283. VehicleMods[id][i] = 0;
  2284. }
  2285. VehiclePaintjob[id] = 255;
  2286. UpdateVehicle(id, 1);
  2287. SaveVehicle(id);
  2288. ShowDialog(playerid, DIALOG_EDITVEHICLE);
  2289. }
  2290. case 3:
  2291. {
  2292. new color1, color2;
  2293. sscanf(params, "dd", color1, color2);
  2294. VehicleColor[id][0] = color1;
  2295. VehicleColor[id][1] = color2;
  2296. SaveVehicle(id);
  2297. ChangeVehicleColor(VehicleID[id], color1, color2);
  2298. ShowDialog(playerid, DIALOG_EDITVEHICLE);
  2299. }
  2300. case 4:
  2301. {
  2302. if(strlen(params) < 1 || strlen(params) > 8)
  2303. {
  2304. ShowErrorDialog(playerid, "Invalid length!");
  2305. return 1;
  2306. }
  2307. strmid(VehicleNumberPlate[id], params, 0, sizeof(params));
  2308. SaveVehicle(id);
  2309. SetVehicleNumberPlate(VehicleID[id], params);
  2310. SetVehicleToRespawn(VehicleID[id]);
  2311. ShowDialog(playerid, DIALOG_EDITVEHICLE);
  2312. }
  2313. case 5:
  2314. {
  2315. DestroyVehicle(VehicleID[id]);
  2316. if(VehicleCreated[id] == VEHICLE_DEALERSHIP)
  2317. {
  2318. Delete3DTextLabel(VehicleLabel[id]);
  2319. }
  2320. VehicleCreated[id] = 0;
  2321. SaveVehicle(id);
  2322. new msg[128];
  2323. format(msg, sizeof(msg), "You have deleted vehicle id %d", id);
  2324. SendClientMessage(playerid, COLOR_WHITE, msg);
  2325. }
  2326. case 6:
  2327. {
  2328. if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
  2329. {
  2330. ShowErrorDialog(playerid, "You are not driving the vehicle!");
  2331. return 1;
  2332. }
  2333. GetVehiclePos(VehicleID[id], VehiclePos[id][0], VehiclePos[id][1], VehiclePos[id][2]);
  2334. GetVehicleZAngle(VehicleID[id], VehiclePos[id][3]);
  2335. SendClientMessage(playerid, COLOR_WHITE, "You have parked this vehicle here");
  2336. UpdateVehicle(id, 1);
  2337. PutPlayerInVehicle(playerid, VehicleID[id], 0);
  2338. SaveVehicle(id);
  2339. ShowDialog(playerid, DIALOG_EDITVEHICLE);
  2340. }
  2341. case 7:
  2342. {
  2343. new Float:x, Float:y, Float:z;
  2344. GetVehiclePos(VehicleID[id], x, y, z);
  2345. SetPlayerPos(playerid, x, y, z+1);
  2346. new msg[128];
  2347. format(msg, sizeof(msg), "You have teleported to vehicle id %d", id);
  2348. SendClientMessage(playerid, COLOR_WHITE, msg);
  2349. }
  2350. }
  2351. }
  2352. return 1;
  2353. }
  2354. return 0;
  2355. }
  2356.  
  2357. stock sscanf(string[], format[], {Float,_}:...)
  2358. {
  2359. #if defined isnull
  2360. if (isnull(string))
  2361. #else
  2362. if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
  2363. #endif
  2364. {
  2365. return format[0];
  2366. }
  2367. new
  2368. formatPos = 0,
  2369. stringPos = 0,
  2370. paramPos = 2,
  2371. paramCount = numargs(),
  2372. delim = ' ';
  2373. while (string[stringPos] && string[stringPos] <= ' ')
  2374. {
  2375. stringPos++;
  2376. }
  2377. while (paramPos < paramCount && string[stringPos])
  2378. {
  2379. switch (format[formatPos++])
  2380. {
  2381. case '\0':
  2382. {
  2383. return 0;
  2384. }
  2385. case 'i', 'd':
  2386. {
  2387. new
  2388. neg = 1,
  2389. num = 0,
  2390. ch = string[stringPos];
  2391. if (ch == '-')
  2392. {
  2393. neg = -1;
  2394. ch = string[++stringPos];
  2395. }
  2396. do
  2397. {
  2398. stringPos++;
  2399. if ('0' <= ch <= '9')
  2400. {
  2401. num = (num * 10) + (ch - '0');
  2402. }
  2403. else
  2404. {
  2405. return -1;
  2406. }
  2407. }
  2408. while ((ch = string[stringPos]) > ' ' && ch != delim);
  2409. setarg(paramPos, 0, num * neg);
  2410. }
  2411. case 'h', 'x':
  2412. {
  2413. new
  2414. num = 0,
  2415. ch = string[stringPos];
  2416. do
  2417. {
  2418. stringPos++;
  2419. switch (ch)
  2420. {
  2421. case 'x', 'X':
  2422. {
  2423. num = 0;
  2424. continue;
  2425. }
  2426. case '0' .. '9':
  2427. {
  2428. num = (num << 4) | (ch - '0');
  2429. }
  2430. case 'a' .. 'f':
  2431. {
  2432. num = (num << 4) | (ch - ('a' - 10));
  2433. }
  2434. case 'A' .. 'F':
  2435. {
  2436. num = (num << 4) | (ch - ('A' - 10));
  2437. }
  2438. default:
  2439. {
  2440. return -1;
  2441. }
  2442. }
  2443. }
  2444. while ((ch = string[stringPos]) > ' ' && ch != delim);
  2445. setarg(paramPos, 0, num);
  2446. }
  2447. case 'c':
  2448. {
  2449. setarg(paramPos, 0, string[stringPos++]);
  2450. }
  2451. case 'f':
  2452. {
  2453. new
  2454. end = stringPos - 1,
  2455. ch;
  2456. while ((ch = string[++end]) && ch != delim) {}
  2457. string[end] = '\0';
  2458. setarg(paramPos,0,_:floatstr(string[stringPos]));
  2459. string[end] = ch;
  2460. stringPos = end;
  2461. }
  2462. case 'p':
  2463. {
  2464. delim = format[formatPos++];
  2465. continue;
  2466. }
  2467. case '\'':
  2468. {
  2469. new
  2470. end = formatPos - 1,
  2471. ch;
  2472. while ((ch = format[++end]) && ch != '\'') {}
  2473. if (!ch)
  2474. {
  2475. return -1;
  2476. }
  2477. format[end] = '\0';
  2478. if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
  2479. {
  2480. if (format[end + 1])
  2481. {
  2482. return -1;
  2483. }
  2484. return 0;
  2485. }
  2486. format[end] = '\'';
  2487. stringPos = ch + (end - formatPos);
  2488. formatPos = end + 1;
  2489. }
  2490. case 'u':
  2491. {
  2492. new
  2493. end = stringPos - 1,
  2494. id = 0,
  2495. bool:num = true,
  2496. ch;
  2497. while ((ch = string[++end]) && ch != delim)
  2498. {
  2499. if (num)
  2500. {
  2501. if ('0' <= ch <= '9')
  2502. {
  2503. id = (id * 10) + (ch - '0');
  2504. }
  2505. else
  2506. {
  2507. num = false;
  2508. }
  2509. }
  2510. }
  2511. if (num && IsPlayerConnected(id))
  2512. {
  2513. setarg(paramPos, 0, id);
  2514. }
  2515. else
  2516. {
  2517. #if !defined foreach
  2518. #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
  2519. #define __SSCANF_FOREACH__
  2520. #endif
  2521. string[end] = '\0';
  2522. num = false;
  2523. new
  2524. name[MAX_PLAYER_NAME];
  2525. id = end - stringPos;
  2526. foreach (Player, playerid)
  2527. {
  2528. GetPlayerName(playerid, name, sizeof (name));
  2529. if (!strcmp(name, string[stringPos], true, id))
  2530. {
  2531. setarg(paramPos, 0, playerid);
  2532. num = true;
  2533. break;
  2534. }
  2535. }
  2536. if (!num)
  2537. {
  2538. setarg(paramPos, 0, INVALID_PLAYER_ID);
  2539. }
  2540. string[end] = ch;
  2541. #if defined __SSCANF_FOREACH__
  2542. #undef foreach
  2543. #undef __SSCANF_FOREACH__
  2544. #endif
  2545. }
  2546. stringPos = end;
  2547. }
  2548. case 's', 'z':
  2549. {
  2550. new
  2551. i = 0,
  2552. ch;
  2553. if (format[formatPos])
  2554. {
  2555. while ((ch = string[stringPos++]) && ch != delim)
  2556. {
  2557. setarg(paramPos, i++, ch);
  2558. }
  2559. if (!i)
  2560. {
  2561. return -1;
  2562. }
  2563. }
  2564. else
  2565. {
  2566. while ((ch = string[stringPos++]))
  2567. {
  2568. setarg(paramPos, i++, ch);
  2569. }
  2570. }
  2571. stringPos--;
  2572. setarg(paramPos, i, '\0');
  2573. }
  2574. default:
  2575. {
  2576. continue;
  2577. }
  2578. }
  2579. while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
  2580. {
  2581. stringPos++;
  2582. }
  2583. while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
  2584. {
  2585. stringPos++;
  2586. }
  2587. paramPos++;
  2588. }
  2589. do
  2590. {
  2591. if ((delim = format[formatPos++]) > ' ')
  2592. {
  2593. if (delim == '\'')
  2594. {
  2595. while ((delim = format[formatPos++]) && delim != '\'') {}
  2596. }
  2597. else if (delim != 'z')
  2598. {
  2599. return delim;
  2600. }
  2601. }
  2602. }
  2603. while (delim > ' ');
  2604. return 0;
  2605. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement