Glitched Scripts
Trucking JobAdvanced Configuration

server/edit.lua

Owner-editable server hooks: identity, money, spawn helpers, keys/lock/fuel, dispatch, reputation.

Do not rename these globals. Core server code calls them by name.

Config.Framework = "custom" skips the built-in qb/esx object. Fill GetPlayer, GetPlayerJobName, money, identifier, and the tablet item if you use those features. Leaving them as return nil means pay, standing, and job start will fail.

Tablet item

When Config.EnableStandaloneTablet and Config.TabletItemName are set, qbcore / qbox / esx register a useable item:

TriggerClientEvent("gs-trucking:client:openTablet", source)

For "custom", register that item with your inventory and fire the same event.

Spawn helpers

Used when Config.ServerSideSpawning is true (and for rental trucks either way). The client still requests the spawn; these create the entity on the server.

-- CreateVehicleServerSetter. vehType comes from the client (IsThisModelA*).
-- Missing / empty vehType defaults to "automobile".
function SpawnVehicle(source, model, coords, warpPlayer, vehType) end

-- Networked CreateObjectNoOffset (hose anchor / nozzle).
function SpawnObject(source, model, coords, freeze) end

-- Networked CreatePed (load-ped jobs).
function SpawnPed(source, model, coords) end

Vehicle spawn / despawn integrations

These run for networked job and rental vehicles in both spawn modes (server create or client create + register). Put server-capable keys, lock state, and ox_fuel here. Client-only packs stay in client/edit.lua.

-- After a networked vehicle is registered (or rental spawned).
-- Default: state.locked = false, ox_fuel state.fuel = 100,
-- qb-vehiclekeys / qbx_vehiclekeys GiveKeys when those resources are started.
function VehicleSpawned(source, vehicle, netId, opts) end

-- Before that vehicle is deleted (job clear, return rental, unregister).
-- Default: remove qb / qbx keys when those resources are started.
function VehicleDespawned(source, vehicle, plate, model) end

-- Optional no-op hooks after a networked object or ped is registered.
function ObjectSpawned(source, entity, netId) end
function PedSpawned(source, ped, netId) end

Config.NeverAllowEntry models skip VehicleSpawned (no keys / unlock for cargo that players must not enter).

When each framework hook runs

function GetPlayer(source) end              -- every money / job / standing call
function GetPlayerJobName(player) end       -- HasPerm and PoliceCheck
function HasPerm(source) end                -- start job, tablet, custom-job notify. same rules as client

function GetxPlayerIdentifier(source) end   -- citizenid / identifier. key for gs_trucking_reputation
function GetCharacterDisplayName(identifier) end
-- Standing leaderboard. Online player first, then players/users SQL. nil = generic "Driver"

function GetPlayerMoney(source) end         -- bank, before a rental
function RemovePlayerMoney(source, amount) end -- rental fee. not called if price is 0

function GivePlayerMoney(source, amount, illegal)
    -- dropoff pay, and rental refund (illegal is always false on refund)
    -- skipped when amount is 0
    -- default: legal = bank. illegal = crypto (qb/qbox) or black_money (esx)
    -- ox_inventory dirty cash: uncomment the AddItem line next to the QB crypto branch
end

function PoliceCheck()
    -- called at accept when the job is illegal
    -- true if Config.PoliceRequired is 0, or that many Config.PoliceJobs are online
end

function SendDispatch(source, jobName, coords)
    -- illegal load became ready to move. coords is vector3 from the player's ped
    -- ps-dispatch, rcore, qs, lb-tablet, tk_dispatch, core_dispatch
end

function AddedPlayerReputation(source, added, total) end   -- after a successful dropoff
function RemovedPlayerReputation(source, removed, total) end -- cancel / timeout / destroyed / too far

function JobCompleted(source, job)
    -- after pay and standing. use for logs
    -- job.id, job.name, job.payout, job.illegal, job.dropoff, job.coords
    -- job.identifier, job.reputation (new total, or nil if reputation is off)
end

Reputation order and bonus pay: Reputation. Spawn toggle: shared/config.lua.

On this page