AdvancedParking v4.11.1 - Persistent vehicles! [ESX] [QB] [QBOX] [OX] [Standalone]

When it’s ready. :tm:

When all new features have been implemented, performance optimizations have been done and no more critical bugs have been found :slight_smile:

As of the last update (v4.7.2e) it seems pretty stable. But still. Stuff could break anytime if I make updates. It’s meant to help me test changes and new things and at the current scale it’s not really possible to guarantee stability just by myself.

If you want to access it, check here: AdvancedParking v3.13.0 - Persistent vehicles! [ESX] [QB] [Standalone] - #427 by Kiminaze

Update v4.8.0e

  • Complete backend logging rework.
  • Version checker added to logging system.
  • Removed several unnecessary debug log entries.
  • Changes to state bag updates.
  • EnsureStateBag export deprecated (can still be called but will throw a warning).
  • General performance improvements and general code cleanup.
  • Several formatting changes.
  • Encrypted files moved to separate folder.
  • Fixed state bag update causing unnecessary second update in the database.
  • Fixed database error when resource is first installed.

How can I get the current version? I have version “3.13.0”

You can “buy” it in my store (it’s free for AP owners :slight_smile: ).

Check this post for details: AdvancedParking v3.13.0 - Persistent vehicles! [ESX] [QB] [Standalone] - #427 by Kiminaze (and read the patch notes).

Update v4.9.0e

  • ox_core integration.
  • Improved spawn logic.
  • Unescrowed oxmysql.lua file.
  • Changed variable names of some extra values for clarity.
  • Added convertible roof state to extra values.
  • Added stub wings state to extra values.
  • Fixed boat anchor in extra values.
  • Fixed setting Cleanup.timeThreshold to nil results in error.

Hotfix v4.9.1e

  • Fixed extra values defaulting to nil value in certain cases.

Hotfix v4.9.2e

  • Fixed extra values defaulting to nil value in certain cases (again) :sweat_smile:

Hotfix v4.9.3e

  • Fixed vehicle spawn when using ox_core.

4.9.0 stable version or still experimental?

Still experimental, though I would consider it pretty stable as of now. Maybe even more than the default version.
But there is still a couple more features to be implemented and the main performance update for server side is still in the works.

1 Like

Waiting for this. At the moment it eats a lot when you handle 300/400 vehicles.

More information always helps in these cases like a profiler result from server side and some more general information like average player count etc

Experimental Update v4.10.0e

  • Added cleanup config option for submerged vehicles (only checks on vehicle spawn).
  • Added a warning if a vehicle didn’t spawn properly after 5 tries.
  • Added apdv command that allows to delete a vehicle using its plate or AdvancedParking internal identifier.
    • Plate example: /apdv 22PIE957
    • Identifier example: /apdv 2365ced5c3abdf6d
  • Added boolean return value to all server side delete functions including the exports (returns true if successful, false if not).
  • Added zones to cleanup config options:
    • Vehicles inside zones will be deleted.
    • Vehicles inside ignoredZones will be ignored by the cleanup and stay.
  • Added check in fixDeleteVehicle.lua if AdvancedParking is running (the file can now be used even when deactivating AdvancedParking for whatever reason).
  • Changed minimum required server version to 10543 (for AddConvarChangeListener).
  • Tiny performance improvements and code cleanup across the board.
  • Reworked client side enter/exit loop to only run while inside a vehicle (0.00ms while not inside a vehicle).
  • Reworked GetVehiclePosition and GetVehiclePositions exports.
    • When using those on client side, local vehicles will be checked before triggering a server callback.
    • Results should be more accurate.
    • GetVehiclePositions now only accepts a table containing plates, multiple singular plates no longer supported for simplicity.
    • Several additional checks and appropriate log messages.
    • Overall less performance intensive.
  • Moved cleanup code to a separate file.
  • Moved some functions to encrypted code.
  • Removed long deprecated deformation exports.
  • Removed renderScorched config option.
  • Removed aggressiveAntiDupe config option and functionality (likely cause for several problems).
  • Fixed error when executing deleteSavedVehicles command under certain conditions.
  • Fixed attempt to index a nil value error after a vehicle was removed.
  • Fixed error when a vehicle was deleted that was still spawning.
  • Possible fix for potential race condition in entityRemoved event.

The config has changed! Make sure to replace it or add the missing options.

And for newcomers: make sure all these changes have been done in your database:

ALTER TABLE `vehicle_parking` ADD COLUMN `bucket` INT(11) NOT NULL DEFAULT 0;
ALTER TABLE `vehicle_parking` ADD COLUMN `initialPlayer` varchar(50);
ALTER TABLE `vehicle_parking` ADD COLUMN `lastPlayer` varchar(50);
ALTER TABLE `vehicle_parking` MODIFY COLUMN `stateBags` longtext;
ALTER TABLE `vehicle_parking` ADD COLUMN `extraValues` TEXT NOT NULL DEFAULT '[]';

Hotfix v4.10.1e

  • Fixed attempt to call a nil value (global 'os_difftime') error.
  • Localised natives in cleanup file.

Hotfix v4.10.2e

  • Fixed attempt to index a nil value (global 'spawnQueue') error.

Hotfix v4.10.3e

  • Fixed “reliable network event overflow” when attaching a trailer.
  • Fixed trailers being constantly updated on server side even when attached.

Experimental Update v4.10.4e

  • Added v3 backwards compatibility for sql table creation.
  • Added additional checks when updating a vehicle to prevent malformed data from being saved.
  • Added several checks when reading data from the database.
  • Added check and respawn for vehicles that somehow lost their data.
  • Fixed trailer not being updated when player exits the tractor unit.

Experimental Update v4.10.5e

  • Added check and unfreeze to vehicles that spawn in frozen.

Experimental Update v4.10.6e

  • Added fixFreezeEntity.lua:
    • Can replace FreezeEntityPosition native in other scripts similar to fixDeleteVehicle.lua.
  • Added forceUnfreezeVehicles config option.
    • Used in relation with fixFreezeEntity.lua.
  • Removed checkFreeze.lua.
  • Removed other previous freezing workaround related stuff.

To anyone that was using the checkFreeze.lua:

You will probably receive an error in scripts where you previously added it. Just remove it.

As for the freezing problem:

If you are running into the problem that vehicles are frozen for unknown reasons, enable the new config option forceUnfreezeVehicles. Then add the entry shared_script "@AdvancedParking/fixFreezeEntity.lua" to any script that uses the native FreezeEntityPosition in relation with vehicles (e.g. mechanic scripts).
Any vehicle that is frozen without using this file will be forcibly unfrozen. There is currently no other known way to combat this behavior as it is a problem inside FiveM/GTA itself.

Update v4.11.0

A lot has changed. Sorry for the wall!
The experimental is now included inside the same package!

  • Added support for ox_fuel.
  • Added support for ox_core.
    • Make sure to add setr ox:defaultVehicleStore \"world\" to your server.cfg to prevent vehicle duplication issues.
  • Added support for qbx_core.
  • Added config option to support using multiple routing buckets.
  • Added additional saved values (currently only updated on client side update):
    • engine on/off
    • landing gear state
    • vtol position
    • boat anchor state
    • convertible roof state
    • stub wings state
  • Added identifier of initial and last player that interacted with a vehicle.
  • Added cl/sv_integrations.lua to make replacing several functions more straightforward:
    • GetFuelLevel and SetFuelLevel
    • ShowNotification
    • StoreVehicle
    • IsOwnedVehicle
  • Added several server side exports:
    • GetVehicleData: Returns all data from AdvancedParking of that vehicle.
    • GetVehicleTuningData: Returns all tuning data from AdvancedParking of that vehicle.
  • Added boolean return value to all server side "delete" exports (true if successful, false if not).
  • Added command apdv: Allows deleting a vehicle using its plate or AP’s internal identifier:
    • /apdv 22PIE957
    • /apdv 2365ced5c3abdf6d
  • Added command apbring: Teleports a saved vehicle given its plate or identifier in front of the player.
    • /apbring 22PIE957
    • /apbring 2365ced5c3abdf6d
  • Added command deleteandstore: Deletes all vehicles and tries to store them.
    • /deleteandstore
  • Added fixFreezeEntity.lua:
    • Can replace the native FreezeEntityPosition in other scripts.
    • Added forceUnfreezeVehicles config option:
      • Forcefully unfreezes all vehicles that are detected as frozen (unless frozen using the fix above).
    • Workaround for the present "freezing" issue that keeps coming up with server side vehicles.
    • You only need to implement this if you are running into the problem of random frozen vehicles.
  • Reworked vehicle spawning:
    • Fixed vehicle spawning issues related to physics (e.g. vehicles being placed on top of roofs instead of below).
    • Fixed some vehicles not respawning at all.
    • Fixed faulty vehicle spawns causing duplication of vehicles.
    • Added better debug logs.
    • Added warning if vehicle could not spawn after 5 tries.
  • Reworked vehicle updating:
    • Added checks to prevent malformed data from being saved.
    • Added checks and respawn for vehicles that somehow lost their data.
    • Added better debug logs.
  • Changed state bag handling to catch all state bag updates.
    • Fixed problem with handling vector values in state bags.
    • Fixes any previous problems with qbx vehicle id not being applied on respawn.
    • Changed state bags column to LONGTEXT.
  • Changes to fixDeleteVehicle.lua:
    • Added check if AdvancedParking is running.
      • You can now keep the file loaded inside your resources and stop AdvancedParking without breaking those resources.
    • You can now load the file without having to copy-paste it into resources:
      • Simply add shared_script \"@AdvancedParking/fixDeleteVehicle.lua\" to the fxmanifest of the respective resource.
  • Complete rewrite of the logging system:
    • Telemetry data can now be send to KSG servers for debugging purposes:
      • Defaults to opt-in (see below to enable).
      • If enabled will send all logs even if you disabled individual levels (see below).
    • Collects the following data:
      • Any server/client logs produced by the resource itself.
      • Resource version
      • Server version
      • Gamebuild
    • New settings for server.cfg (or command line) including their default state (0: disabled, 1: enabled):
      • setr AdvancedParking_log_info 1
      • setr AdvancedParking_log_warning 1
      • setr AdvancedParking_log_error 1
      • setr AdvancedParking_log_debug 0
      • setr AdvancedParking_telemetry 0
    • Added internal logs that won’t print to console.
    • Added logging of actual script errors.
    • Added more information to debug logs.
    • Cleaned up and removed a lot of unnecessary debug logs.
  • Complete rework of the cleanup process:
    • Added config option for submerged vehicles (only checked on vehicle spawn).
    • Added config options for zones and ignored zones:
      • Vehicles inside zones will be deleted.
      • Vehicles inside ignored zones will be completely.
    • Added configurable week day to cleanup times.
    • Added config options for ignored plates and ignored models.
    • Added event \"AP:cleanup:deletingVehicle\": Gets executed before the vehicle is deleted. Parameters:
      • entity handle (can be nil)
      • plate
      • reason ("time\ "engineHealth\ "distance")
    • Separated into its own file.
  • Rewrite of GetVehiclePosition and GetVehiclePositions exports:
    • When using on client side, local vehicles will be checked before triggering a server callback.
    • Results will be more accurate.
    • GetVehiclePositions now only accepts a table containing plates. Multiple singular plates are no longer supported.
    • Several additional checks and appropriate log messages.
    • Less performance intensive.
  • Switched to using oxmysql instead of mysql-async.
  • Moved encrypted files to a separate folder.
  • Switched minimum required server version to 14758 (to prevent crash when using onEntityBucketChange).
  • Several performance improvements across the board.
    • Client side now 0.00ms when outside a vehicle.
  • Several improvements to client and server side trailer updating.
  • Deprecated EnsureStateBag export (can still be called but will throw a warning).
  • Added additional checks in entityRemoved event to prevent errors.
  • Moved vehicle ownership check entirely to server side.
  • Moved routing bucket change detection to onEntityBucketChange event.
  • Moved damage detection to an event instead of auto updating on server side.
  • Fixed trailers bypassing the blacklist filters.
  • Fixed vehicle being reset to its last saved location when it was deleted while a player was inside.
  • Fixed \"AP:vehicleSpawned\" event being triggered for every client.
    • Now only triggered for the player responsible for setting vehicle properties (tuning etc). Parameter was changed from network id to entity handle!
  • Fixed error when executing deleteSavedVehicles command under certain conditions.
  • Fixed race condition in entityRemoved event.
  • Fixed several problems regarding ox_core integration.
  • Removed timerTasks.lua (functionality integrated into cleanup system).
  • Removed versionChecker.lua (functionality integrated into logging system).
  • Removed several unnecessary functions.
  • Removed indentation from json columns.
  • Removed long deprecated deformation exports.
  • Removed renderScorched config option.
  • Removed aggressiveAntiDupe config option and functionality (likely cause for several other problems).
  • Updated license:
    • Added Privacy Policy (GDPR related)
    • Added business mail
    • Added clarification regarding distribution
    • Added limitation of liability
    • Added Supremecy of PLA
    • Switched keymaster to portal URLs
    • Updated wording in some parts for clarification"
4 Likes

amazing!! been so anxious for this one to come out, haha.

since this hasn’t just fixed itself in the final release(as i hoped it would), is there any chance you know offhand what i’ve messed up to make this happen? i was getting the same result when trying to run the database changes for the experimental version. hate to bother you, still absolutely overjoyed to see this coming out.

1 Like

You are very likely running an old MariaDB version. Default values for TEXT columns have been introduced in 10.2.1(9 years old by now).

Two solutions:

  • Update your MariaDB version
  • Remove the default value in TEXT columns (could be necessary to adjust code; if it doesn’t work please create a support post in our Discord :slight_smile: )

Thanks alot for fixing the freezing issue, i made a command /unfreeze as a temporary fix for my server which simply unfreezed the vehicle, but thanks!

1 Like

well this opened up a can of worms, haha. i probably followed a pretty outdated guide when i first set up my little private server, and afaik i’m running mysql 8.0. time to learn more about mariaDB and move everything over to that. :slight_smile:

1 Like

Hello! I’m delighted with this work. One question: Using this script, is it possible for another script to move vehicles from a busy area to a nearby location? Let’s say there’s a garage near that area and go there.

1 Like
  • Do you want to physically move it somewhere else? That’s of course possible as vehicles are not frozen etc.
  • If you want to teleport them, that is also possible if you have access to the entity. AdvancedParking will update the position in its next check.
  • If you want to remove them from the world, you can just delete vehicles using the provided exports: https://docs.kiminaze.de/scripts/advancedparking/exports-server

I assume one of these answers your question? :sweat_smile:

And thanks for the love :heart:

Hotfix v4.11.1

  • Fixed client side convar defaults not matching server side.
  • Fixed nil value error when cleanup was running at a specified time without a defined day.

Experimental Hotfix v4.11.1e

  • Fixed nil value error when cleanup was running at a specified time without a defined day.