ForgetVehicle export.
Delete Vehicle Command (/dv)
When you delete a vehicle manually using a command, you should remove it from persistence so it is no longer restored automatically.
- QB Core
- ESX
Add this line:
exports['ts-persistence']:ForgetVehicle(nil, QBCore.Functions.GetPlate(veh))resources/[qb]/qb-core/client/events.lua
Sync door lock status changes
When your keys script locks/unlocks a vehicle, also updatets-persistence with:
exports['ts-persistence']:UpdateDoorStatus(vehicle, status)
status = 2to lockstatus = 1to unlock
lfKeys (same integration pattern for any keys script):
lfKeys snippet is only a reference.For any other keys script, call
UpdateDoorStatus right after the lock status changes.
Adding to a Garage System
If you are adding this script to your server, you will need to call the export when a vehicle is successfully stored in the garage so that it is no longer restored from persistence. Here is an example of how it looks in the defaultqb-garages script when a vehicle is deposited:
- QB Core
- ESX
Add this line:
exports['ts-persistence']:ForgetVehicle(nil, plate)resources/[qb]/qb-garages/client/main.lua