Secure, optimized FiveM vehicle cleaning script with multi-framework support.
- Framework support:
qbx,qb,esx, plusautodetection. - Inventory support:
ox,qb,esx,tgiann,codem,origen, plusautodetection. - Optional bridge mode via
Croll-Bridge. - Server-authoritative validation:
- source checks
- vehicle net ID validation
- vehicle entity type validation
- distance checks
- item ownership checks
- cooldown and event rate limiting
- Optional item durability (full metadata durability on
ox_inventory). - Locale support (
locales/en.luaincluded).
- FiveM artifact with Lua 5.4 enabled.
- One of:
qbx_core,qb-core, ores_extended. - One supported inventory (or framework native inventory fallback).
- Optional but recommended:
ox_lib.
- Place the resource in your server resources folder.
- Ensure it in
server.cfgafter your framework/inventory resources:ensure Croll-CleanCar
- Create the configured item in your inventory item definitions:
- default:
rag
- default:
- Restart the resource/server.
Main config file: config.lua
Config.Framework:auto | qbx | qb | esxConfig.Inventory:auto | ox | qb | esx | tgiann | codem | origenConfig.ExternalBridge:auto | none | croll-bridgeConfig.ItemName: item required to clean (defaultrag)Config.CleanDurationMs: cleaning durationConfig.MaxDistance: max interaction distanceConfig.CleanCooldownMs: per-player clean cooldownConfig.MinServerRpcIntervalMs: anti-spam RPC gapConfig.ServerMaxDistanceClamp: server-side range hard clamp
Config.Durability controls optional use-based item consumption:
Enabled: turns durability on/offMaxUses: starting uses when metadata is missingMetadataKey: metadata field for remaining uses (defaultcleancar_uses)
Notes:
ox_inventory: full per-slot metadata durability is supported.- Other inventories currently fallback to removing one full item per clean.
- For best durability behavior on
ox_inventory, keep rags non-stackable (or one rag per slot).
Default locale file:
locales/en.lua
To add a new language:
- Create
locales/<lang>.lua - Add translated keys
- Set
Config.Locale = "<lang>"
The script is split by responsibility:
client.lua: clean flow + visual handlingserver.lua: authoritative validation + consumptionbridge/shared.lua: shared helpers/framework detectionbridge/client.lua: notify/progress abstractionbridge/server.lua: framework/inventory abstraction