AdvancedParking v3.11.0 - Persistent vehicles! [ESX] [QB] [Standalone]

Can you please, tell me how that works? only load 32 vehicles?

2 Likes

The client keeps a list of all vehicles it spawned and when this list exceeds 32, the script will either delete the vehicle that is the furthest away from the player or simply not the spawn the newest vehicle.

But I will definitely revisit this again, as it I already have an idea on how to do it properly, but that will require a bigger rewrite of the underlying system, so it is gonna take some time.

(tldr: this system is not perfect, but should work in most cases. I tried spawning ~200 vehicles from the database (on an npc populated server) and as soon as the threshold (32 in this case) is reached, it will either delete the furthest vehicle it spawned from you or not spawn it at all)

Is this not esx_realparking by Akkariin edited? WTF

Standalone?

1 Like

Tldr: No.
Long: The script this is based on is a script that has been running for nearly 2 years on our liveserver and has constantly been adapted. I changed a lot of things from that version to get it as a standalone.
I have only skimmed esx_realparking and you have to designate areas to spawn? Not necessary in my script. Vehicles are static according to their description. Not the case in my script. Also it doesn’t need ESX or whatever else of a framework there is these days.
Point me exactly to what I have “apparently copied and edited”.

Yes. The only 2 requirements are OneSync and MySQL Async Library. (It uses OneSync natives and of course the data needs to be saved somewhere. And a database is better than just a file)

1 Like

New update to fix a vehicle health related bug and to correct a major oversight by myself.
There is now a new event that needs to be triggered when you do NOT want the script to save vehicles. E.g. when you enter a vehicle shop where the player sits in the vehicle. As soon as you exit, you need to trigger the event with true again.

Fixed, thanks for reporting :slight_smile:

I have a Problem that when some Players are looking for a Nice car in the esx_vehicleshop there are spawning cars until everybody explode how can i fix this?

The compatibility has to be done by you. Everyone uses different shops etc. and you need to trigger an event if you do something with vehicles that you do NOT want to be saved.

I can give you more directions if necessary :slight_smile:

Small but crucial update for many of you. I really hope, that this was the issue for duplicating vehicles, as I couldn’t replicate it myself (so far).

Can you give me an example how it should be looked like?

answered in private message :slight_smile:

hi everytime i park my car in the garage, then the car spawns on the point where i leave it

Is there a way to saves only players owned vehicles in the db
instead of every car players touch…would use less resources and not load that many vehicles for days in our 100+ players server.

And also the impound option for police and mechanic seems to be working for a second or two and then the vehicle get load by the data base and reload at the same place where’s the impound was made.

2 Likes

Explain to me, how your garage works then :slight_smile:

The whole thing about this script is the saving of all vehicles. This includes player, job and npc vehicles (that have been entered by a player).
Feel free to change anything in the script. e.g. in the client.lua is a part responsible for entering / exiting a vehicle. You can check here, if the vehicle is owned by a player.
I won’t put that in my script. Then it wouldn’t be standalone anymore.

When you delete a vehicle from the outside, then you need to trigger an event with the plate of the vehicle before it gets impounded / deleted:
TriggerServerEvent(“AdvancedParking:deleteVehicle”, plate)

it is like esx_policejob garage

would be great if the user was able to add in the ability to make it select the type of framework and ability save player owned vehicles instead of every vehicle !!! :slight_smile:

1 Like

(I don’t know how every script works, no need to point me to another script xD )
I assume that is what is happening:
When you delete a vehicle from the outside, this needs to be triggered first:

TriggerServerEvent("AdvancedParking:deleteVehicle", plate)

replace plate with the vehicles plate ofc.

After that, delete the vehicle like you would do normally

A few messages above :stuck_out_tongue:

is there a chance that the script can get the plate ?

client.lua line 20 to 93 is responsible for what gets saved and what not

at line 37 and 66 you can insert your code for checking the plate before proceeding

1 Like

Fixed a small error that prevented saving vehicles when updating a vehicle that was not already registered.