Glitched Scripts
Trucking Job

Integrations

Fuel, keys, dispatch, CB radio, targeting, and server-side spawn hooks. Edit client/edit.lua and server/edit.lua.

There is no Config.Dispatch switch. If a supported resource is started, the hooks in client/edit.lua and server/edit.lua call it. If your pack is missing, add a branch in those files. Do not rename the functions. The core calls them by name.

Phones and tablets: Opening the app.

Targeting

-- auto order: ox_target → qb-target → qtarget → sleepless_interact → interact → is_interaction / inside-interaction
Config.Target = 'auto'
Config.TargetName = false           -- only if you renamed the resource folder
Config.UseTextUI = true             -- false = GTA help text (top-left)
Config.TextUIPosition = "right-center"
Config.OtherKeybind = "E"           -- TextUI / help text / inside-interaction

"auto" picks the first of those that is started. It does not wait for a target resource that starts later. Force a name ('ox_target') if trucking starts before your target script.

Config.Target = false skips third-eye entirely. Prompts then use ox_lib TextUI (UseTextUI = true) or GTA help text (UseTextUI = false). The depot ped, load/drop zones, hose, and hitch prompts all follow that.

Fuel and keys

Hooks run after every networked truck, trailer, or loader the resource spawns (rentals, job trailer, forklift, cargobob), and again on despawn so keys do not stay in inventory.

Spawn mode (Config.ServerSideSpawning) only chooses who creates the entity. Server integration hooks still run when the vehicle is registered, including when the client created it.

Server (server/edit.lua)

function VehicleSpawned(source, vehicle, netId, opts)
    Entity(vehicle).state.locked = false
    if IsResourceOnServer('ox_fuel') then
        Entity(vehicle).state.fuel = 100
    end
    -- qb-vehiclekeys / qbx_vehiclekeys GiveKeys (first match)
end

function VehicleDespawned(source, vehicle, plate, model)
    -- qb / qbx RemoveKeys when those resources are started
end

Client (client/edit.lua)

function VehicleSpawned(vehicle)
    -- client fuel: ps-fuel, LegacyFuel, cdn-fuel, lc_fuel,
    -- qs-fuelstations, okokGasStation, Renewed-Fuel
    -- client keys: qs-vehiclekeys, wasabi_carlock, mk_vehiclekeys, MrNewbVehicleKeys
    SetVehicleDirtLevel(vehicle, 0.0)
    SetVehicleDoorsLocked(vehicle, 1)
end

If your fuel or key script is not in those lists, add an elseif in the matching edit file (server for server APIs, client for client exports). If two fuel scripts are started on the same side, only the first match in that chain runs.

Config.ServerSideSpawning: shared/config.lua.

Police dispatch

Illegal jobs do not ping police at accept. They ping when the load is full and a dropoff is assigned (gs-trucking:server:getDroppoff).

The server function runs first, with GetEntityCoords(GetPlayerPed(source)) as a vector3. Then the client event gs-trucking:client:dispatch runs for packs that need GetPlayerInfo() on the client.

Config.PoliceRequired = 2
Config.PoliceJobs = { "police", "bcso" } -- who counts for the check, and who receives the alert

-- server/edit.lua
function SendDispatch(source, jobName, coords)
    -- started resources: ps-dispatch, rcore_dispatch,
    -- qs-dispatch / qs-dispatch-pro, lb-tablet, tk_dispatch, core_dispatch
end

-- client/edit.lua
function SendDispatch(JobName, coords)
    -- cd_dispatch, linden_outlawalert / wf-alerts
    -- qs-dispatch client helper is commented if your build only works from the client
end

PoliceRequired = 0 skips the online-cop check at accept. Dispatch still fires on illegal loads when they become ready to move.

To add a pack: put the export in the matching SendDispatch (server vs client). Leave the other packs in place. Several can fire if several are started.

CB radio

Off by default. When enabled, a permitted player in a matching vehicle class is put on Config.CBRadioChannel (and pulled off when they exit). /cbradio toggles that for themselves.

Config.CBRadioEnable = false
Config.CBRadioChannel = 696.9
Config.CBRadioRestrictClasses = true
Config.CBRadioVehClasses = {
    [10] = true, -- industrial
    [11] = true, -- utility
    [20] = true, -- commercial
}
function CBConnect()
    if IsResourceOnServer('pma-voice') then
        exports['pma-voice']:addPlayerToRadio(Config.CBRadioChannel)
    elseif IsResourceOnServer('saltychat') then
        exports.saltychat:SetRadioChannel(tostring(Config.CBRadioChannel), true)
    elseif IsResourceOnServer('mm_radio') then
        exports['mm_radio']:JoinRadio(Config.CBRadioChannel)
    end
end

GTA vehicle class numbers: vehicle classes. Trucks you rent (phantom, packer, hauler) are class 20.

Custom framework

Config.Framework = "custom"

Skips the built-in qb/esx object. You must implement the elseif Config.Framework == 'custom' branches:

  • Client: HasPerm (if RequireJob is set)
  • Server: GetPlayer, GetPlayerJobName, GetxPlayerIdentifier, money helpers, tablet item if you use one, GetCharacterDisplayName if you want names on the leaderboard

Leaving them as return nil means jobs will not start, pay will not apply, and standing will not save.

On this page