Configuration
A fully documented config.lua for the MD AutoClear script.
-- ============================================================
-- MD AutoClear | config.lua
-- Configure the resource to suit your server below.
-- ============================================================
Config = {}
-- Turn this on if something isn't working as expected.
-- It'll print extra info to the server console to help track down the issue.
Config.Debug = false
-- How many vehicles a single player can protect at one time.
-- Most servers will want to leave this at 1.
Config.MaxProtectedVehicles = 1
-- How many seconds players get to move their vehicles after a cleanup is announced.
Config.CleanupCountdown = 30
-- How long (in seconds) an admin must wait before toggling the system again.
-- Prevents accidental rapid toggling. Default is 3 minutes.
Config.ToggleCooldown = 180
-- Rename any command here if it conflicts with another resource.
-- Changes take effect on next server restart.
Config.Commands = {
protectVeh = 'protectveh',
unprotectVeh = 'unprotectveh',
cleanupNow = 'cleanupnow',
cleanupToggle = 'cleanuptoggle',
cleanupStatus = 'cleanupstatus',
clearProtections = 'clearprotections',
deleteVehicle = 'dv',
}
-- Who can use /dv.
-- 'staff' Only players with admin permission (recommended).
-- 'everyone' Any connected player.
--
-- If set to 'everyone', protected vehicles cannot be deleted by
-- regular players. Staff always bypass protection.
--
-- Range only applies when the player is on foot - it controls
-- how far ahead the command looks for a vehicle to delete.
Config.DeleteVehicle = {
permission = 'everyone', -- 'staff' | 'everyone'
range = 10.0, -- metres (on-foot raycast distance)
}
-- Choose how admin commands are gated.
--
-- 'ace' Native FiveM ACE permissions. Grant access in server.cfg:
-- add_principal identifier.license:XXXX md_autoclear.admin
--
-- 'esx' Checks the player's ESX job/group against adminGroups below.
--
-- 'qbcore' Checks the player's QBCore group against adminGroups below.
--
-- Regular players never need a permission grant -
-- /protectveh and /unprotectveh are open to everyone.
Config.Permissions = {
mode = 'ace', -- 'ace' | 'esx' | 'qbcore'
aceNode = 'staff.open', -- the ACE node checked in 'ace' mode
-- Used in 'esx' and 'qbcore' modes only.
adminGroups = { 'admin', 'superadmin', 'god' },
}
-- Controls when the on-screen countdown changes colour to warn players.
Config.UI = {
phaseOrange = 20, -- turns orange at this many seconds remaining
phaseRed = 10, -- turns red at this many seconds remaining
fadeOutMs = 800, -- how long the UI takes to fade out after cleanup (ms)
}
-- Runs cleanups automatically on a timer so you don't need
-- an admin online to keep the map clear.
Config.Scheduler = {
enabled = true,
intervalMinutes = 60, -- how often a cleanup runs (in minutes)
-- Optionally restrict auto-cleanups to certain server hours.
-- For example, set activeFromHour = 0 and activeToHour = 6
-- to only run between midnight and 6am. Leave both as nil to run at all times.
activeFromHour = nil,
activeToHour = nil,
}
-- When enabled, admin actions (cleanups, toggles, protections) will
-- send a formatted notification to a Discord channel of your choice.
Config.Webhook = {
enabled = false,
webhookUrl = '', -- paste your Discord webhook URL here
botName = 'MD AutoClear',
-- Embed colours in decimal format (not hex).
colorStart = 3066993, -- green (#2ECC71) - cleanup started
colorDone = 5793266, -- blue (#5865F2) - cleanup finished
colorToggle = 16776960, -- yellow (#FFFF00) - system toggled
colorProtect = 1752220, -- teal (#1ABC9C) - vehicle protected/unprotected
}
-- By default the deleter targets vehicles across the entire map.
-- If you only want to clean up specific areas, enable this and
-- define your zones below. Vehicles outside all zones will be left alone.
--
-- Zones are defined as rectangles using map coordinates:
-- { name, minX, minY, maxX, maxY }
-- Height (Z axis) is not checked.
Config.Zones = {
enabled = false,
list = {
{ name = 'City Centre', minX = -1000, minY = -2000, maxX = 1000, maxY = 0 },
{ name = 'Sandy Shores', minX = 1700, minY = 3300, maxX = 2800, maxY = 4000 },
},
}
-- The keybind that opens the in-game admin panel.
-- Set to '' if you'd rather not have a keybind at all.
Config.AdminPanel = {
openKey = 'F7',
}
-- Any vehicle matching a rule here will never be deleted,
-- regardless of whether a player has manually protected it or not.
Config.Whitelist = {
-- Plate Whitelist
-- Add plate strings you want permanently protected.
-- Matching is case-insensitive and ignores spaces, so
-- 'LSPD 01' and 'lspd01' are treated as the same plate.
plates = {
'ADMIN',
'STAFF',
},
-- Vehicle Class Whitelist
-- Any vehicle belonging to a class listed here will be skipped.
-- Useful for keeping emergency vehicles on the map at all times.
--
-- Class reference:
-- 8 Motorcycles 13 Cycles 18 Emergency
-- 9 Off-Road 14 Boats 19 Military
-- 10 Industrial 15 Helicopters 20 Commercial
-- 12 Utility 16 Planes 21 Trains
classes = {
18, -- Emergency vehicles
},
}Last updated
