The ESX Vehicle Persistence & Cleanup Script ensures a smooth and realistic vehicle system by automatically saving vehicle states and cleaning up abandoned or unused vehicles. With options for timed deletion, distance checks, and data retention, it helps maintain server performance and reduces clutter while preserving player-owned vehicles.
Key Features
Smart Vehicle Registration
- Only tracks player-driven vehicles – A vehicle is registered when:
- A player enters it as a driver
- A player spawns it and interacts with it
- Does NOT track:
- AI/parked vehicles
- Vehicles never entered by a player
Automatic Cleanup with Warnings
- Configurable idle timer (default: 30 mins)
- Vehicles untouched for the full duration are removed
- Warning messages (customizable intervals):
- 2 mins, 1 min, and 30 sec warnings before cleanup
- Only the vehicle owner sees warnings (not global spam)
Manual Admin Control
/cleanupvehicles
command- Forces immediate cleanup of all inactive vehicles
- Requires ACE permission (
command.cleanupvehicles
)
Performance Optimised
- Low-impact server checks (every 30 sec by default)
- Distance-based occupancy checks (50m radius)
- No residual memory leaks – Cleanly removes tracked vehicles
How It Works
Vehicle Tracking Logic
- A vehicle is registered only when a player enters it (client-side detection).
- The server tracks:
- Owner (who spawned/used it)
- Last used time (resets if any player enters)
- Warning status (ensures no duplicate warnings)
Cleanup Process
- Checks every 30 seconds for inactive vehicles.
- If a vehicle is unoccupied for 30 mins:
- Sits through warning phases (2m, 1m, 30s).
- Deletes only if still unused after the full timer.
- Active vehicles reset the timer – even brief use extends their life.
Admin Command
/cleanupvehicles
→ Instantly removes all vehicles meeting idle criteria.- Permission-restricted (adjustable in config).
Need help?
If you have any other questions or issues related to this product, you can contact us. This script works well with our Esx Car Lock System for enhanced roleplay communication
Visit if you’re looking for anything regarding this RedM script
Reviews
There are no reviews yet.