Glitched Scripts
Trucking Job

Exports

Client and server exports for gs-trucking.

Check whether a player is on a run, or create jobs from another resource. CreateJob walkthrough: Custom jobs.

Client

-- job id while on a run, otherwise falsy
if exports['gs-trucking']:IsJobActive() then
    -- block other activities, skip trailer attach, etc.
end

local job = exports['gs-trucking']:JobInfo()
if job then
    -- job.name, job.description
    -- job.departure  = vector3 or nil
    -- job.destination = vector3 or nil (set after dropoff is assigned)
end

Server

local id, err = exports['gs-trucking']:CreateJob(jobTable, {
    event = 'myresource:truckingUpdate', -- optional server event
})

local ok, err = exports['gs-trucking']:DeleteJob(id)

local job = exports['gs-trucking']:GetJob(id)
-- job.id, job.definition, job.creator, job.callbackEvent
-- job.busy, job.player, job.cooldown, job.started

local list = exports['gs-trucking']:GetCustomJobs()

jobTable uses the same shape as Config.Loads (see Jobs & loads). Required: name, load.model, load.coords, trailer.model, trailer.coords, and a dropoff list with coords and payout. IDs start at 100000. Phases only fire for CreateJob jobs, not bundled Config.Loads rows.

AddEventHandler('gs-trucking:customJob', function(jobId, phase, data) end)
-- also fired on opts.event from CreateJob
-- phases: started, trailer_ready, trailer_attached, at_load,
--         loading_done, enroute, finished, cancelled

On this page