client/edit.lua
Owner-editable client hooks: permissions, notify, client-only fuel/keys, dispatch, radio.
Do not rename these globals. Core client code calls them by name.
Keep the framework guard at the top of the file. Auto-detect examples: Integrations.
Config.Framework = "custom" skips the built-in qb/esx object. Fill every elseif Config.Framework == 'custom' branch. HasPerm is required if Config.RequireJob is set.
Client VehicleSpawned / VehicleDespawned are for client-only fuel and key scripts. Server-capable keys (qb-vehiclekeys, qbx_vehiclekeys), state.locked, and ox_fuel live in server/edit.lua. Those server hooks run for networked vehicles whether Config.ServerSideSpawning is true or false.
When each hook runs
-- Depot ped, /truckertablet, item, phone app, start job, rentals.
-- false = those stay closed.
function HasPerm()
if not Config.RequireJob then return true end
-- qbcore / qbox / esx: PlayerData.job.name
-- custom: name = exports['your_core']:GetJobName()
return MatchesRequiredJob(name)
endMatchesRequiredJob already accepts a string or a list in Config.RequireJob.
-- Every client notify (errors, hitch, hose, pay, standing).
function Alert(msg, nType, timeout)
lib.notify({
type = nType,
title = locale('job_name'),
description = msg,
duration = timeout,
position = "top",
})
end
-- Only if Config.UseTextUI is false (classic GTA help text).
function HelpText(text) end
-- After a rental truck, job trailer, forklift, handler, or cargobob is ready locally.
-- Client-only fuel (ps-fuel, LegacyFuel, …) and keys (qs, wasabi, mk, MrNewb).
-- Also dirt level and SetVehicleDoorsLocked. See Integrations.
function VehicleSpawned(vehicle) end
-- Right before those vehicles are deleted (end of job, return rental).
-- Remove client-only keys so they do not stay in inventory.
function VehicleDespawned(vehicle) end
-- Once, after the warehouse worker ped is created. Invincible, clipboard scenario, etc.
function SpawnedWorkerPed(ped) end
-- Autopilot cargobob ped, cattle, and any other job ped (client ped setup).
function PedSpawned(ped) end
-- After the server illegal alert. Packs that need GetPlayerInfo() (cd_dispatch).
function SendDispatch(JobName, coords) end
-- Enter / leave a matching truck while Config.CBRadioEnable is true. Also /cbradio.
function CBConnect() end
function CBDisconnect() end