OrigenNetwork
Docs

Custom · origen_parking

The custom/ folder lets you integrate any framework, key system or fuel system without touching the core. All files here survive updates.

text
custom/
├── sv_framework.lua  — server-side: identifier, permissions, money, notifications, garages
├── sv_keys.lua       — server-side: give keys, set lock state
├── cl_framework.lua  — client-side: identifier, notifications, player loaded event
├── cl_keys.lua       — client-side: read lock state
└── cl_fuel.lua       — client-side: get/set fuel level

sv_framework.lua

Framework.GetIdentifier(source)string | nil

Returns the unique identifier of a player (citizenid / license). Called on every park/retrieve action.

lua
function Framework.GetIdentifier(source)
    -- Config.Framework == 'custom'
    return nil -- replace with your own logic
end

Framework.GetVehicleOwner(plate)string | nil

Returns the owner identifier for a given plate from the framework's vehicle table.

lua
function Framework.GetVehicleOwner(plate)
    -- Config.Framework == 'custom'
    return nil
end

Framework.SetVehicleStorageState(plate, stored)

Marks a vehicle as stored (stored = true) or out (stored = false) in the framework's vehicle table.

lua
function Framework.SetVehicleStorageState(plate, stored)
    -- Config.Framework == 'custom'
end

Framework.HasAdminPermission(source, permission)boolean

Called on all admin callbacks. Permission systems checked in order:

  1. origen_adminexports['origen_admin']:HasPermission(src, permission)
  2. aceIsPlayerAceAllowed(src, Config.AdminAceNode)
  3. qbx / qb — checks PlayerData.group for god, superadmin, admin
  4. esx — checks xPlayer.getGroup() for superadmin, admin
  5. custom — implement below
lua
function Framework.HasAdminPermission(source, permission)
    -- Config.AdminSystem == 'custom'
    return false
end

Framework.Notify(source, message, ntype)

Send a notification to a player. ntype: 'info' | 'success' | 'error'

lua
function Framework.Notify(source, message, ntype)
    -- Config.NotifySystem == 'custom'
end

Framework.GetGarages()table[]

Returns a list of garages for the admin panel. Each entry: { id, name, label }.

lua
function Framework.GetGarages()
    -- Config.GarageIntegration == 'custom'
    return {}
end

Framework.GetMoney(source)number

Returns the cash balance of a player. Used by the parking cost system.

lua
function Framework.GetMoney(source)
    -- Config.Framework == 'custom'
    return 0
end

Framework.RemoveMoney(source, amount)boolean

Deducts cash from a player. Returns true on success.

lua
function Framework.RemoveMoney(source, amount)
    -- Config.Framework == 'custom'
    return false
end

Framework.GetVehicleState(plate)number | nil

Returns the stored state of a vehicle from the framework's table (1 = out, 0 = stored, or nil if not found).

lua
function Framework.GetVehicleState(plate)
    -- Config.Framework == 'custom'
    return nil
end

sv_keys.lua

Keys.GiveKeys(source, entity, plate)

Give vehicle keys to a player on spawn. Runs when Config.GiveKeysOnSpawn = true.

Supported systems out of the box: qbx_vehiclekeys, qs-vehiclekeys, rk-keys.

lua
function Keys.GiveKeys(source, entity, plate)
    -- Config.KeySystem == 'custom'
end

Keys.SetLock(entity, locked)

Lock or unlock a vehicle entity server-side. Runs when Config.LockVehiclesOnSpawn = true.

lua
function Keys.SetLock(entity, locked)
    -- fallback: SetVehicleDoorsLocked(entity, locked and 2 or 1)
end

cl_framework.lua

Framework.GetLocalIdentifier()string | nil

Returns the local player's unique identifier client-side.

lua
function Framework.GetLocalIdentifier()
    -- Config.Framework == 'custom'
    return nil
end

Framework.NotifyClient(message, notifyType)

Show a notification to the local player. notifyType: 'info' | 'success' | 'error'

lua
function Framework.NotifyClient(message, notifyType)
    -- Config.NotifySystem == 'custom'
end

Framework.OnPlayerLoaded(callback)

Register a callback that fires when the player's data is ready. Used for initial sync.

lua
function Framework.OnPlayerLoaded(callback)
    -- Config.Framework == 'custom'
    CreateThread(function() Wait(0); callback() end)
end

cl_keys.lua

Keys.IsLocked(vehicle)boolean

Returns true if the vehicle is currently locked. Reads from state bag first, falls back to native.

lua
function Keys.IsLocked(vehicle)
    local stateBagLock = Entity(vehicle).state.doorslockstate
    if stateBagLock ~= nil then return stateBagLock >= 2 end
    return GetVehicleDoorLockStatus(vehicle) >= 2
end

cl_fuel.lua

Fuel.Get(vehicle)number

Returns the current fuel level (0–100) of a vehicle.

Auto-detection order: ox_fuelLegacyFuelps-fuelcdn-fuelnative.

lua
function Fuel.Get(vehicle)
    -- Config.FuelSystem == 'custom'
    return GetVehicleFuelLevel(vehicle)
end

Fuel.Set(vehicle, level)

Sets the fuel level (0–100) of a vehicle. Always calls SetVehicleFuelLevel as base, then the active system on top.

lua
function Fuel.Set(vehicle, level)
    -- Config.FuelSystem == 'custom'
    SetVehicleFuelLevel(vehicle, level + 0.0)
end