Advertisement
Guest User

tulil

a guest
May 26th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.95 KB | None | 0 0
  1. Advanced Vehicle Ownership & Dealership by DanishHaq
  2.  
  3. Information
  4.  
  5. Hi there, this is my vehicle ownership & dealership system. It approximates to a total of 7,000 lines and has some commands that I included for this release today. I use to use this script on my own server, I was the scripter there, but after the owner decided to close the server, I have nothing to do with it anymore as I am creating a better one. That's my reason why I decided to release this today. Also, this was my first "big" thing that I've done all myself and that I've had no help with whatsoever, and it's also my first release.
  6.  
  7. Disclaimer
  8.  
  9. As I don't need this anymore, you can do whatever you wish with it. But please, keep the credits line on top of your script, because at the end of the day, I did spend many hours on this, here's the credit information (all you have to add):
  10.  
  11. pawn Code:
  12. /* ----- Vehicle ownership & dealership by DanishHaq - [url]http://forum.sa-mp.com/member.php?u=138844[/url] -----
  13. ----- This person has the rights to use this script in whatever shape or form they wish, but the credits must remain with the creator -----*/
  14.  
  15. Features
  16.  
  17. Below, you can find a list of features regarding this script, including the location of the dealership.
  18.  
  19. -- Fully integrated ownership into a users owner file.
  20. -- The vehicle will be destroyed when that player logs off, and it will be recreated when that player logs back on (avoid too many vehicles on the server).
  21. -- It's a dealership with dialog's, which means that you can pretty much add an unlimited amount of vehicles.
  22. -- All the vehicles are included, except police vehicles (hydras, hunters, police cars etc.) and some big vehicles (dune, monster truck etc.)
  23. -- You can easily add vehicles. Just look how I did it on the script (carefully), and then add whatever vehicle you'd like, same with removing it.
  24. -- Parking system, vehicle number plate system, car color/colour system and a lot more.
  25. -- It's got quite a few ready made commands for things you'd do with a vehicle, e.g. set the number plate, change the color/colour etc.
  26. -- Cars & bikes, when you buy it, it will have a "first time" spawn near the dealership.
  27. -- Boats spawn in the sea just at the Santa Marina Beach.
  28. -- Helicopters spawn at the airport in Los Santos.
  29.  
  30. Screenshots
  31.  
  32. -- http://i.imgur.com/YH2iFWq.png
  33. -- http://i.imgur.com/ZeaH6Ol.png
  34. -- http://i.imgur.com/7C9ruGH.png
  35. -- http://i.imgur.com/slFGAgJ.png
  36. -- http://i.imgur.com/4GVzK3l.png
  37. -- http://i.imgur.com/wYVkFLu.png
  38. -- http://i.imgur.com/rLppvuF.png
  39. -- http://i.imgur.com/lKdNMm5.png
  40. -- http://i.imgur.com/3TyY3uQ.png
  41. -- http://i.imgur.com/r5xdjtU.png
  42. -- http://i.imgur.com/nTVysCd.png
  43. -- http://i.imgur.com/7rxHQjK.png
  44. -- http://i.imgur.com/8dn2GLc.png
  45. -- http://i.imgur.com/TcaNyJt.png
  46. -- http://i.imgur.com/o8phLJc.png
  47. -- http://i.imgur.com/Td59wvx.png
  48.  
  49. Some information about the script
  50.  
  51. The car information saves on the actual user file of that user. I used y_ini in this case, if you want to use your own, you'll have to change the ownership system so it matches your own user file system, or change your existing system to y_ini.
  52.  
  53. The dealership itself uses dialog's, I have provided some random dialog ID's that the dialog's will get assigned to, but you should make sure that they don't overlap with your current dialog's. Dialog ID's used here are as follows: 3000, 3001, 3002, 3003, 3004, 3005, 3006, 3007, 3008, 3009, 3010 and 3011.
  54.  
  55. Unfortunately, I haven't had the time and haven't had the interest to create the following commands that you'll have to do yourself: /sellvehicle (sell it back to the ds) and /sellvehicleto (sell it to another player), possibly /exchangevehicle (exchange a vehicle with another player). I'd recommend that for advanced scripters.. if anyone will be kind enough to do it, I'll add it to this post, and you may keep the credits for those commands.
  56.  
  57. Method of installation
  58.  
  59. Ok, so this is the part that you'll have to pay the most attention too. For the y_ini users, you can do the following, for the rest, you'll have to optimize this so it will work with your own registration & logging in system.
  60.  
  61. Add all this to the top of your script, somewhere before main():
  62.  
  63. pawn Code:
  64. #define DIALOG_CATEGORY 3000
  65. #define DIALOG_AIRCRAFTS 3001
  66. #define DIALOG_BIKES 3002
  67. #define DIALOG_CONVERTIBLES 3003
  68. #define DIALOG_INDUSTRIAL 3004
  69. #define DIALOG_LOWRIDERS 3005
  70. #define DIALOG_OFFROAD 3006
  71. #define DIALOG_SALOONS 3007
  72. #define DIALOG_SPORTVEHICLES 3008
  73. #define DIALOG_STATIONWAGONS 3009
  74. #define DIALOG_BOATS 3010
  75. #define DIALOG_UNIQUEVEHICLES 3011
  76. #define COLOR_GRAD6 0xF0F0F0FF
  77. #define COLOR_GREY 0xAFAFAFAA
  78. #define COLOR_GREEN 0x008000FF
  79. #define COLOR_WHITE 0xFFFFFFFF
  80.  
  81. new personalcar1[MAX_PLAYERS];
  82. new personalcar2[MAX_PLAYERS];
  83. new personalcar3[MAX_PLAYERS];
  84.  
  85. Under "enum pInfo" (or whatever enum name you're using for your user file system), you will have to add the following:
  86.  
  87. pawn Code:
  88. enum pInfo
  89. {
  90. pVehicle1,
  91. pVehicle1Model,
  92. Float:pVehicle1X,
  93. Float:pVehicle1Y,
  94. Float:pVehicle1Z,
  95. Float:pVehicle1C,
  96. pVehicle1Color1,
  97. pVehicle1Color2,
  98. pVehicle1Value,
  99. pVehicle1Plate,
  100. pVehicle1Lock,
  101. pVehicle2,
  102. pVehicle2Model,
  103. Float:pVehicle2X,
  104. Float:pVehicle2Y,
  105. Float:pVehicle2Z,
  106. Float:pVehicle2C,
  107. pVehicle2Color1,
  108. pVehicle2Color2,
  109. pVehicle2Value,
  110. pVehicle2Plate,
  111. pVehicle2Lock,
  112. pVehicle3,
  113. pVehicle3Model,
  114. Float:pVehicle3X,
  115. Float:pVehicle3Y,
  116. Float:pVehicle3Z,
  117. Float:pVehicle3C,
  118. pVehicle3Color1,
  119. pVehicle3Color2,
  120. pVehicle3Value,
  121. pVehicle3Plate,
  122. pVehicle3Lock,
  123. };
  124. new PlayerInfo[MAX_PLAYERS][pInfo]; // if you've got something like this, leave this line, else, add it
  125.  
  126. Those are the variables that will be used in this script.
  127.  
  128. Now, wherever you have the part of the script where the user file will be loaded upon LOGIN, you need to add the following there:
  129.  
  130. pawn Code:
  131. INI_Int("Vehicle1",PlayerInfo[playerid][pVehicle1]);
  132. INI_Int("Vehicle1Model",PlayerInfo[playerid][pVehicle1Model]);
  133. INI_Float("Vehicle1X",PlayerInfo[playerid][pVehicle1X]);
  134. INI_Float("Vehicle1Y",PlayerInfo[playerid][pVehicle1Y]);
  135. INI_Float("Vehicle1Z",PlayerInfo[playerid][pVehicle1Z]);
  136. INI_Float("Vehicle1C",PlayerInfo[playerid][pVehicle1C]);
  137. INI_Int("Vehicle1Color1",PlayerInfo[playerid][pVehicle1Color1]);
  138. INI_Int("Vehicle1Color2",PlayerInfo[playerid][pVehicle1Color2]);
  139. INI_Int("Vehicle1Value",PlayerInfo[playerid][pVehicle1Value]);
  140. INI_String("Vehicle1Plate",PlayerInfo[playerid][pVehicle1Plate]);
  141. INI_Int("Vehicle1Lock",PlayerInfo[playerid][pVehicle1Lock]);
  142. INI_Int("Vehicle2",PlayerInfo[playerid][pVehicle2]);
  143. INI_Int("Vehicle2Model",PlayerInfo[playerid][pVehicle2Model]);
  144. INI_Float("Vehicle2X",PlayerInfo[playerid][pVehicle2X]);
  145. INI_Float("Vehicle2Y",PlayerInfo[playerid][pVehicle2Y]);
  146. INI_Float("Vehicle2Z",PlayerInfo[playerid][pVehicle2Z]);
  147. INI_Float("Vehicle2C",PlayerInfo[playerid][pVehicle2C]);
  148. INI_Int("Vehicle2Color1",PlayerInfo[playerid][pVehicle2Color1]);
  149. INI_Int("Vehicle2Color2",PlayerInfo[playerid][pVehicle2Color2]);
  150. INI_Int("Vehicle2Value",PlayerInfo[playerid][pVehicle2Value]);
  151. INI_String("Vehicle2Plate",PlayerInfo[playerid][pVehicle2Plate]);
  152. INI_Int("Vehicle2Lock",PlayerInfo[playerid][pVehicle2Lock]);
  153. INI_Int("Vehicle3",PlayerInfo[playerid][pVehicle3]);
  154. INI_Int("Vehicle3Model",PlayerInfo[playerid][pVehicle3Model]);
  155. INI_Float("Vehicle3X",PlayerInfo[playerid][pVehicle3X]);
  156. INI_Float("Vehicle3Y",PlayerInfo[playerid][pVehicle3Y]);
  157. INI_Float("Vehicle3Z",PlayerInfo[playerid][pVehicle3Z]);
  158. INI_Float("Vehicle3C",PlayerInfo[playerid][pVehicle3C]);
  159. INI_Int("Vehicle3Color1",PlayerInfo[playerid][pVehicle3Color1]);
  160. INI_Int("Vehicle3Color2",PlayerInfo[playerid][pVehicle3Color2]);
  161. INI_Int("Vehicle3Value",PlayerInfo[playerid][pVehicle3Value]);
  162. INI_String("Vehicle3Plate",PlayerInfo[playerid][pVehicle3Plate]);
  163. INI_Int("Vehicle3Lock",PlayerInfo[playerid][pVehicle3Lock]);
  164.  
  165. This will be easier for us to use the variables with a simple PlayerInfo[playerid][variable] instead of using INI_WriteInt etc. all the time when we want to edit something in a player's user file.
  166.  
  167. The following, you need to add under the response to where the player gets registered on the server, and a new file will be created:
  168.  
  169. pawn Code:
  170. INI_WriteInt(File,"Vehicle1",PlayerInfo[playerid][pVehicle1]);
  171. INI_WriteInt(File,"Vehicle1Model",PlayerInfo[playerid][pVehicle1Model]);
  172. INI_WriteFloat(File,"Vehicle1X",PlayerInfo[playerid][pVehicle1X]);
  173. INI_WriteFloat(File,"Vehicle1Y",PlayerInfo[playerid][pVehicle1Y]);
  174. INI_WriteFloat(File,"Vehicle1Z",PlayerInfo[playerid][pVehicle1Z]);
  175. INI_WriteFloat(File,"Vehicle1C",PlayerInfo[playerid][pVehicle1C]);
  176. INI_WriteInt(File,"Vehicle1Color1",PlayerInfo[playerid][pVehicle1Color1]);
  177. INI_WriteInt(File,"Vehicle1Color2",PlayerInfo[playerid][pVehicle1Color2]);
  178. INI_WriteInt(File,"Vehicle1Value",PlayerInfo[playerid][pVehicle1Value]);
  179. INI_WriteString(File,"Vehicle1Plate",PlayerInfo[playerid][pVehicle1Plate]);
  180. INI_WriteInt(File,"Vehicle1Lock",PlayerInfo[playerid][pVehicle1Lock]);
  181. INI_WriteInt(File,"Vehicle2",PlayerInfo[playerid][pVehicle2]);
  182. INI_WriteInt(File,"Vehicle2Model",PlayerInfo[playerid][pVehicle2Model]);
  183. INI_WriteFloat(File,"Vehicle2X",PlayerInfo[playerid][pVehicle2X]);
  184. INI_WriteFloat(File,"Vehicle2Y",PlayerInfo[playerid][pVehicle2Y]);
  185. INI_WriteFloat(File,"Vehicle2Z",PlayerInfo[playerid][pVehicle2Z]);
  186. INI_WriteFloat(File,"Vehicle2C",PlayerInfo[playerid][pVehicle2C]);
  187. INI_WriteInt(File,"Vehicle2Color1",PlayerInfo[playerid][pVehicle2Color1]);
  188. INI_WriteInt(File,"Vehicle2Color2",PlayerInfo[playerid][pVehicle2Color2]);
  189. INI_WriteInt(File,"Vehicle2Value",PlayerInfo[playerid][pVehicle2Value]);
  190. INI_WriteString(File,"Vehicle2Plate",PlayerInfo[playerid][pVehicle2Plate]);
  191. INI_WriteInt(File,"Vehicle2Lock",PlayerInfo[playerid][pVehicle2Lock]);
  192. INI_WriteInt(File,"Vehicle3",PlayerInfo[playerid][pVehicle3]);
  193. INI_WriteInt(File,"Vehicle3Model",PlayerInfo[playerid][pVehicle3Model]);
  194. INI_WriteFloat(File,"Vehicle3X",PlayerInfo[playerid][pVehicle3X]);
  195. INI_WriteFloat(File,"Vehicle3Y",PlayerInfo[playerid][pVehicle3Y]);
  196. INI_WriteFloat(File,"Vehicle3Z",PlayerInfo[playerid][pVehicle3Z]);
  197. INI_WriteFloat(File,"Vehicle3C",PlayerInfo[playerid][pVehicle3C]);
  198. INI_WriteInt(File,"Vehicle3Color1",PlayerInfo[playerid][pVehicle3Color1]);
  199. INI_WriteInt(File,"Vehicle3Color2",PlayerInfo[playerid][pVehicle3Color2]);
  200. INI_WriteInt(File,"Vehicle3Value",PlayerInfo[playerid][pVehicle3Value]);
  201. INI_WriteString(File,"Vehicle3Plate",PlayerInfo[playerid][pVehicle3Plate]);
  202. INI_WriteInt(File,"Vehicle3Lock",PlayerInfo[playerid][pVehicle3Lock]);
  203.  
  204. Now, if the player was successful with his login (he got the password right and he has been logged in), add the following:
  205.  
  206. pawn Code:
  207. if(PlayerInfo[playerid][pVehicle1] != 0)
  208. {
  209. new model1 = PlayerInfo[playerid][pVehicle1Model];
  210. new Float:car1x = PlayerInfo[playerid][pVehicle1X];
  211. new Float:car1y = PlayerInfo[playerid][pVehicle1Y];
  212. new Float:car1z = PlayerInfo[playerid][pVehicle1Z];
  213. new Float:car1c = PlayerInfo[playerid][pVehicle1C];
  214. new car1color1 = PlayerInfo[playerid][pVehicle1Color1];
  215. new car1color2 = PlayerInfo[playerid][pVehicle1Color2];
  216. new car1lock = PlayerInfo[playerid][pVehicle1Lock];
  217. personalcar1[playerid] = CreateVehicle(model1, car1x, car1y, car1z, car1c, car1color1, car1color2, 999999);
  218. SetVehicleNumberPlate(personalcar1[playerid], PlayerInfo[playerid][pVehicle1Plate]);
  219. if(car1lock != 0)
  220. {
  221. GetVehicleParamsEx(personalcar1[playerid], engine, lights, alarm, doors, bonnet, boot, objective);
  222. SetVehicleParamsEx(personalcar1[playerid], engine, lights, alarm, 1, bonnet, boot, objective);
  223. }
  224. }
  225. if(PlayerInfo[playerid][pVehicle2] != 0)
  226. {
  227. new model2 = PlayerInfo[playerid][pVehicle2Model];
  228. new Float:car2x = PlayerInfo[playerid][pVehicle2X];
  229. new Float:car2y = PlayerInfo[playerid][pVehicle2Y];
  230. new Float:car2z = PlayerInfo[playerid][pVehicle2Z];
  231. new Float:car2c = PlayerInfo[playerid][pVehicle2C];
  232. new car2color1 = PlayerInfo[playerid][pVehicle2Color1];
  233. new car2color2 = PlayerInfo[playerid][pVehicle2Color2];
  234. new car2lock = PlayerInfo[playerid][pVehicle2Lock];
  235. personalcar2[playerid] = CreateVehicle(model2, car2x, car2y, car2z, car2c, car2color1, car2color2, 999999);
  236. SetVehicleNumberPlate(personalcar2[playerid], PlayerInfo[playerid][pVehicle2Plate]);
  237. if(car2lock != 0)
  238. {
  239. GetVehicleParamsEx(personalcar2[playerid], engine, lights, alarm, doors, bonnet, boot, objective);
  240. SetVehicleParamsEx(personalcar2[playerid], engine, lights, alarm, 1, bonnet, boot, objective);
  241. }
  242. }
  243. if(PlayerInfo[playerid][pVehicle3] != 0)
  244. {
  245. new model3 = PlayerInfo[playerid][pVehicle3Model];
  246. new Float:car3x = PlayerInfo[playerid][pVehicle3X];
  247. new Float:car3y = PlayerInfo[playerid][pVehicle3Y];
  248. new Float:car3z = PlayerInfo[playerid][pVehicle3Z];
  249. new Float:car3c = PlayerInfo[playerid][pVehicle3C];
  250. new car3color1 = PlayerInfo[playerid][pVehicle3Color1];
  251. new car3color2 = PlayerInfo[playerid][pVehicle3Color2];
  252. new car3lock = PlayerInfo[playerid][pVehicle3Lock];
  253. personalcar3[playerid] = CreateVehicle(model3, car3x, car3y, car3z, car3c, car3color1, car3color2, 999999);
  254. SetVehicleNumberPlate(personalcar3[playerid], PlayerInfo[playerid][pVehicle3Plate]);
  255. if(car3lock != 0)
  256. {
  257. GetVehicleParamsEx(personalcar3[playerid], engine, lights, alarm, doors, bonnet, boot, objective);
  258. SetVehicleParamsEx(personalcar3[playerid], engine, lights, alarm, 1, bonnet, boot, objective);
  259. }
  260. }
  261.  
  262. This will spawn their vehicle(s) if they own any, at their parked positions.
  263.  
  264. Under OnPlayerDisconnect(playerid), you'll want to add the following code so it will destroy his vehicle, as where we logged in, it spawns the vehicle, we don't want it to keep spawning an extra vehicle when that player logs in:
  265.  
  266. pawn Code:
  267. DestroyVehicle(personalcar1[playerid]);
  268. DestroyVehicle(personalcar2[playerid]);
  269. DestroyVehicle(personalcar3[playerid]);
  270.  
  271. Now, that's the vehicle ownership
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement