[Release] Auto DV (Timer & /autodv) [ESX + ox_lib] β€” FREE

Auto DV that periodically clears empty vehicles on a timer or manually via /autodv.
Built for ESX, notifications with ox_lib. Ported & maintained by sweet21 (Discord: sweet21). Enjoy! :tada:

Preview:

Features

  • :stopwatch: Timed cleanup (configurable interval)
  • :radio_button: Manual command: /autodv
  • :bell: ox_lib notifications (countdown + results)
  • :broom: Two cleanup modes:
    • Aggressive: enumerates vehicles, requests network control, deletes mission/owned entities (if empty)
    • Simple: ClearAreaOfVehicles (fast, less thorough)
  • :brain: Safety: skip vehicles with a driver; optional safe radius around players
  • :jigsaw: ESX-friendly; no QBCore dependency

Requirements

  • ESX (es_extended)
  • ox_lib (ensure it starts before this resource)

Installation

  1. Drop the resource folder into your resources/
  2. Add to server.cfg in this order:
ensure ox_lib
ensure autodv_esx   # or your folder name
  1. Example fxmanifest.lua:
fx_version 'cerulean'
game 'gta5'
description 'Auto DV (ESX + ox_lib)'
version '1.0.0'
lua54 'yes'

shared_script '@ox_lib/init.lua'
dependency 'ox_lib'

client_scripts { 'Client/client.lua' }
server_scripts { 'Server/server.lua' }

Configuration (quick toggles inside Client/client.lua)

local DELETE_NEAR_PLAYER_RADIUS = 8.0   -- don’t delete if a player is within X meters
local SKIP_VEHICLES_WITH_DRIVER = true  -- skip vehicles with driver (NPC/player)
local USE_AGGRESSIVE_DELETE = true      -- true = enumerate & force delete; false = ClearAreaOfVehicles

Timer & countdown (in Server/server.lua):

-- Example
Citizen.Wait(10800000)   -- interval in ms (3h)
countdownAlert(5)        -- minutes before cleanup

Commands

  • /autodv β†’ triggers the 5-minute countdown (configurable) and then cleans up

Optional permission check for ESX admins/mods is included (commented). Uncomment to restrict.

How it works (short)

  • Server announces countdown via ox_lib notifications
  • Client receives clear event
  • Aggressive mode: iterates CVehicle pool, requests network control, marks mission entity, deletes empty vehicles; respects safe radius and β€œskip driver” flag

Notes & FAQ

  • Does it delete owned/garage vehicles?
    This removes world entities. Your vehicle ownership in the database is unaffected. If you pull your car out and leave it outside, the entity can be deleted by Auto DV; you can spawn it again from the garage.
  • It didn’t delete some freshly spawned cars. Why?
    Simple mode often skips mission/owned entities. Use Aggressive mode (default here) which requests control and deletes them if empty.
  • Delete cars with NPC drivers too?
    Set SKIP_VEHICLES_WITH_DRIVER = false (beware: this will remove traffic in motion).

Download

Credits

  • Original base: Auto DV (QBCore)
  • ESX + ox_lib port & edits: sweet21

License

  • Free to use. If the original base has a specific license, please respect it when redistributing.
2 Likes

This script can have a auto deleted vehicles ?