AdvancedParking v3.0 - Major Update! [ESX] [QB] [Standalone]

What is it and what does it do exactly?

If a player enters a vehicle, it will be registered in the database as a saved vehicle. The vehicle
will always stay at the last location where it has been left by a player. If it despawns while
players are too far away from it or after a server restart, the script will respawn the vehicle on
server side as soon as a player gets close enough. This also means no more “despawns” when looking
away for a second.

All vehicle modifications and statuses are saved (check saved values for more
information) and will be reapplied upon respawning.

Vehicles that have been saved are completely dynamic. You can push a saved vehicle with a bulldozer
and it will update accordingly. This all happens on server side and requires minimal performance.

What has changed from prior versions?

v3.0.0 Patchnotes
  • Restructured the database table. If you are updating from an old version, make sure to delete the old table!
  • Reworked the entire code base.
  • Separated code into smaller functions for better readability.
  • Separated tuning and vehicle status into separate functions for better performance across the board.
  • Added different layers of logging: Info, Debug, Warning, Error. Can be toggled on/off individually in “Log.lua”.
  • Added client and server event when a vehicle is spawned. (can be used in other scripts)
  • Added a small amount of encryption (~10%).
  • Replaced server side player iteration with the proper GetPlayers function.
  • GetClosestPlayer now ignores players in different routing buckets.
  • Switched from unique plates as identifiers to a custom generated hex identifier to make the script independent from plates.
  • Now saves all vehicle mods from 0-49 (except 17, 19, 21 since I couldn’t find their proper uses yet.
  • Now automatically saves trailers.
  • Now saves entity state bags and re-applies them on spawn.
  • Removed saving of bodywork deformation. You now have to use the (free) script VehicleDeformation by me to keep this feature.
  • Reworked timer tasks to be more up to my coding standards. Now also features exports to be used from other scripts.
  • Fixed a rare occurring onesync related error.
  • Fixed a calculation error when updating a vehicle.
  • Fixed several logic errors inside the delete timer. Now deletes all vehicles properly.
  • Fixed error that lead to no return value from “GetVehiclePositions” export.

Showcase Video

Requirements

Code is accessible ~90% accessible
Subscription-based No
Lines (approximately) 1700
Requirements Check requirements above
Support Yes

Where can I get this?

If you already own AdvancedParking, you do NOT need to buy it again! It is directly available via keymaster.

This script is currently still available for the old versions’ price of 10€ (without tax) at: https://kiminazes-script-gems.tebex.io/package/4287488
The price will rise to 15€ (without tax) after the 10th of July!

Features

  • All vehicles a player has entered will be saved.
    • Configurable vehicle class, model and plate blacklist.
  • Vehicles will respawn automatically when players get close and the vehicle isn’t there.
  • Vehicles will respawn after a server restart.
  • Vehicles that have been saved are completely dynamic. They can be moved and take damage.
  • Vehicle spawning happens on server side.
  • Attached trailers will be saved automatically.
  • Option to save only player owned vehicles (requires ESX or QB).
  • Cleanup function takes care of vehicles that haven’t been updated.
    • Configurable time threshold.
    • Option to send cleaned up vehicles to the player garage (requires ESX or QB).
  • Non-networked (or client side only) vehicles will be ignored.
  • Can be restarted any time.
  • Delete function that will delete any vehicle where a player is not close enough every X
    minutes (turned off by default). This is only meant for servers that have an over-abundance of
    (modded) vehicles where it could have a negative impact on performance (e.g. 200+ players + NPC
    vehicles).
  • Admin command for deleting all vehicles from the database table.
  • Exports for receiving the position of vehicles from server and client side.

Saved values

While this script aims to save all variables of a vehicle, some of them can not yet be updated on
server side and will only be updated when entering/leaving the vehicle. The dynamic variables are
marked with an (S) for ease of reading.

  • Position and rotation (S)
  • Status:
    • Entity, body, engine (S) and petrol tank (S) health
    • Dirt Level
    • Fuel Level (includes compatibility with “LegacyFuel”)
    • Door lock status (S)
    • Burst/flat tires
    • Missing doors
    • Broken windows
  • Tuning:
    • Number plate text (S)
    • Modifications from 0-49 (except 17, 19 and 21 (possibly HSW mods that aren’t in the game yet))
      • Visual and performance mods
    • Colors
      • Primary and secondary
      • Custom primary and secondary (RGB)
      • Pearlescent
      • Interior
      • Dashboard
      • Tiresmoke
      • Window tint
    • Lights
      • Xenon color
      • Neonlights color
      • Enabled neons
    • Extras
    • Wheels
      • Type
      • Custom
      • Bulletproof
      • Color
      • Drift Tires
    • Livery (from mods, extra livery and roof livery)
  • Entity state bags

Performance

  • Client Side: 0.00 idle and up to 0.01ms while inside vehicle or spawning vehicle
  • Server Side: 0.00-0.01ms

Patchnotes

Can now be found on Github

1 Like

Awesome job!

2 Likes

This script is a piece of art ! I recommend it 100% ! Thanks you for the update ! :heart_eyes:

1 Like

Hotfix v3.0.1

  • Fixed an error related to state bag updates in the database.

Last ditch changes while sleepy always cause the stupidest of bugs… :crazy_face:

Hope there is finally a workaround for cd garages :smiley:

There has always been one. The delete function in cd_garage has to be replaced.

I won’t post the whole snippet here since it is a paid resource.
But you can look for DeleteVehicle and you will find him using DeleteEntity before that and Citizen.InvokeNative.
When you found those three close together, replace all of them with just ESX.Game.DeleteVehicle instead of just replacing the lone DeleteVehicle.

Is there any way I can make this to work like a police tracker script?

https://kiminazes-script-gems.tebex.io/package/4597307

Works like a charm

Please use your other topic for any versions