Glitched Scripts
Advanced Flatbeds

Integrations

Vehicle keys, job gates, and gs-trailers. Edit the Lua in client/edit.lua and server/edit.lua.

If a supported resource is started, the function hooks in client/edit.lua and server/edit.lua call it. If yours is not in the list, add a branch in those files. Do not rename the functions. The core calls them by name. The bundled key scripts are auto detected, or you can create your own solution.

This resource does not use targeting or inventory. Prompts use ox_lib TextUI (Config.UseTextUI = true) or GTA help text (false).

Keys

CanUseFlatbed and HasOwnership in client/edit.lua check keys before managing a truck, and before putting you into a loaded vehicle. The first started resource wins:

  • qbx_vehiclekeys
  • qb-vehiclekeys
  • qs-vehiclekeys
  • wasabi_carlock
  • mk_vehiclekeys
  • MrNewbVehicleKeys

These are pre-bundled and auto detected. If none of those are started, both functions return true. Add an elseif if your lock script is missing, or replace the bodies to fit your own needs.

VehicleAttachedOnFlatbed turns the engine off, locks doors, and sets qb / qs lock state when those resources are started. VehicleDetachedFromFlatbed turns the engine on and unlocks.

IsVehicleLocked uses GTA door lock status (2, 3, or 10) and blocks warp-in.

Job gate

Every server state write (bed move, cargo, winch, extras, wheel door) calls CanPlayerUseFlatbed(source, truck) in server/edit.lua. The default returns true. Return false to block a player (job, duty, or ACE).

function CanPlayerUseFlatbed(source, truck)
    -- example: only on-duty mechanic
    -- local Player = exports.qbx_core:GetPlayer(source)
    -- return Player and Player.PlayerData.job.name == 'mechanic' and Player.PlayerData.job.onduty
    return true
end

Client CanUseFlatbed still runs first (keys). Both must pass.

Attach filter

CanAttachVehicle(vehicle, truck) skips the truck itself, Config.BlockedModels, and other flatbeds. Flatbeds cannot load other flatbeds. Add extra checks there if you need them.

Config.BlockedModels = {
    [`bus`] = true,
}

gs-trailers

There is no hard dependency. If you also run gs-trailers, keep rollback / tow hashes in Config.TrailerBlacklist so trailers do not steal those beds. The bundled trailer blacklist already includes common flatbed models (flatbed, flatbedm2, amber flats, and similar).

Custom keys or jobs

Do not rename the globals. Add your resource next to the existing IsResourceOnServer checks:

  • Client: CanUseFlatbed, HasOwnership, VehicleAttachedOnFlatbed
  • Server: CanPlayerUseFlatbed

On this page