How a dealership works. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How a dealership works. (
/showthread.php?tid=482485)
How a dealership works. -
MoshuLabs - 21.12.2013
https://sampforum.blast.hk/showthread.php?tid=460706
I've followed this tutorial but as you can see he sets the vehicle Model to 1 on every car. How do you make the vehicle the players car and not anyone elses? I know how to do everything else apart from that. Would it work if I set the vehicleModel to the vehicle's ID? If yes, would the vehicle ID change in any way possible?(other than being deleted)
Re: How a dealership works. -
MoshuLabs - 21.12.2013
anyone?
Re: How a dealership works. -
Hansrutger - 21.12.2013
I don't really know but I can guess. You save down every vehicle information into different files and give them all unique ID's. Like if you're using Y_ini or any file system you would save into like "/FolderName/%d.ini" and then each time a new vehicle is created you will create a new file in a for loop that goes from 0 to the highest amount of vehicles allowed on your server which you define above in the script like: "#define maxVehicles 1000", then you use in the for loop something like: "for(i = 0; i< maxVehicles…." and in this for loop it will go through if the file exists or not and before that do a format(all, sizeof(all), "folder name/%d.ini", i); and then in the search for if the file exist"if(fexist(all))".
So far so good? Now you have to assign this "unique vehicle ID" to a player. That you do by saving the vehicle ID into a player's file in a new tag or in an already existing or if you're even using tags or not. In each unique vehicle ID file you write down ALL the necessary information to spawn a vehicle, its x, y, z coords, which vehicle model etc.
This is how I think, do not take this for granted that it is like this! This is just how I would try it if I were to create a system like this.