Retro Police
This section covers configurable handlers, exports, and integration points for developers.
Configurable Handlers
Section titled โConfigurable HandlersโThese functions in config.lua let you hook into the scriptโs lifecycle without modifying escrowed code.
Cuff Handlers
Section titled โCuff Handlersโ-- Called when a player is cuffedConfig.OnCuff = function() -- Close inventory, disable actions, etc.end
-- Called when a player is uncuffedConfig.OnUnCuff = function() -- Reopen inventory, re-enable actions, etc.end
-- Called every tick while cuff is activeConfig.OnCuffLoop = function() -- Custom per-frame logicendJail Handlers
Section titled โJail HandlersโConfig.JailInitHandler = function() -- Called when a player is jailedend
Config.JailEndHandler = function() -- Called when a player is releasedend
Config.JailJobHandler = function(jobType) -- Called when a prison job is completed -- jobType: "shitCleaning", "groundCleaning", "cooking"endCustom Jail Message
Section titled โCustom Jail MessageโConfig.CustomJailMessage = function(jailTime) TriggerEvent('chat:addMessage', { color = { 255, 0, 0 }, multiline = true, args = { Config.Language.jailAndUtils.jailChatMessage, (Config.Language.jailAndUtils.jailChatMessageDescription):format(jailTime) } })endVehicle Setup
Section titled โVehicle SetupโConfig.VehicleSetup = function(vehicle, plateFormat) local plate = GetVehicleNumberPlateText(vehicle)
if plateFormat then plate = string.format(plateFormat, (lib.string.random('11') .. lib.string.random('AA') .. lib.string.random('11'))) SetVehicleNumberPlateText(vehicle, plate) end
SetVehicleFuelLevel(vehicle, 100.0) -- Give keys, set liveries, etc. -- Return false after DeleteEntity to cancel spawnendProgress Bar
Section titled โProgress BarโConfig.ProgressBar = function(text, time, animDict, animClip, scenario) -- Uses ox_lib progressBar by default -- Override to use your own progress bar system return lib.progressBar({ duration = time, label = text, ... })endMegaphone Change Handler (Server-Side)
Section titled โMegaphone Change Handler (Server-Side)โConfig.MegaphoneSystemOnChange = function(source, toggle) if GetPlayerServerId(PlayerId()) == source then -- Your own player toggled megaphone else -- Another player toggled megaphone endendID System
Section titled โID Systemโ-- Used by shooting range and driving parkour for player ID inputConfig.IDSystem = function(input) return tonumber(input)endReturn Inventory Locker Check
Section titled โReturn Inventory Locker Checkโ-- Return false to deny access to the return lockerConfig.ReturnInventoryLockerCheck = function(framework) return trueendClothing Integration
Section titled โClothing IntegrationโThe script automatically integrates with your clothing system. Supported resources:
| Resource | Auto-detected |
|---|---|
illenium-appearance | โ |
fivem-appearance | โ |
qb-clothing | โ |
esx_skin | โ |
If you use a different clothing system, override Config.ClothingSystemOnChangeOutfit and Config.ClothingSystemReloadSkin in config.lua.
Config.ClothingSystemOnChangeOutfit = function(outfitData) -- outfitData contains: pants, arms, t-shirt, vest, torso2, -- shoes, accessory, bag, hat, glass, mask, etc. -- Each has { item = number, texture = number }end
Config.ClothingSystemReloadSkin = function() -- Called when player selects "Wear Off Duty"endFramework & Inventory Overrides
Section titled โFramework & Inventory OverridesโIf auto-detection doesnโt work for your setup, use the override options:
-- config_framework.luareturn { Framework = 'AUTO', -- 'ESX', 'QBCore', 'QBX', 'AUTO' FrameworkNameOverride = nil, -- Force a specific resource name FrameworkGetterOverride = nil, -- Custom getter function FrameworkFunctionsOverride = { client = {}, server = {} }}-- config_inventory.luareturn { Inventory = 'AUTO', -- 'ox_inventory', 'qb-inventory', 'AUTO', 'CUSTOM' InventoryNameOverride = nil, Custom = { -- Fill these if using Inventory = 'CUSTOM' getPlayerInventory = function(source) ... end, clearPlayerInventory = function(source, whitelistItems) ... end, addItem = function(source, name, count, metadata) ... end, removeItem = function(source, item, amount, metadata) ... end, openLockerStash = function(source, lockerConfig, deptId) ... end, openShop = function(source, shopItems, shopId) ... end, getLabel = function(itemName) ... end, -- client openInventory = function(name, type) ... end, -- client getItemCount = function(item) ... end, -- client getCurrentWeapon = function() ... end, -- client },}