OrigenNetwork
Docs

Exports · origen_parking

All exports are registered under the resource name origen_parking.

Most exports are fire-and-forget triggers that the resource itself or other scripts (garages, police, key systems) call. The read exports (GetVehicleByPlate, GetParkingPositions, etc.) are synchronous and safe to call from any thread.


Server-side exports

GetVehicleByPlate(plate) → table | nil

Returns the stored data of a street-parked vehicle by plate, or nil if the plate is not tracked.

lua
local data = exports['origen_parking']:GetVehicleByPlate('ABC123')
ParameterTypeDescription
platestringVehicle number plate (spaces are matched as stored).

The returned table is the internal data record:

lua
{
    id         = 14,                       -- internal parking row id
    plate      = 'ABC123',
    model      = 'adder',
    hash       = 231083307,
    owner      = 'license:abc...',         -- framework identifier of the owner
    parkedBy   = 'license:abc...',         -- who parked it (may differ from owner)
    coords     = { x = 0.0, y = 0.0, z = 0.0, w = 0.0 },
    dimension  = 0,
    type       = 'automobile',
    mods       = {},                       -- vehicle properties / tuning
    lastUpdate = 1700000000,
    netID      = nil,                      -- network id when spawned, nil when stored
}

GetVehicleByEntity(entity) → table | nil

Same record as above, resolved from a live vehicle entity handle. Returns nil if the entity is not a parking-managed vehicle.

lua
local data = exports['origen_parking']:GetVehicleByEntity(entity)
ParameterTypeDescription
entitynumberVehicle entity handle.

confiscateVehicle(input) → boolean

Removes a parked vehicle from the world and the database. Accepts either an entity handle or a plate. Returns true if a vehicle was found and removed.

lua
exports['origen_parking']:confiscateVehicle(entity)     -- by entity
exports['origen_parking']:confiscateVehicle('ABC123')   -- by plate
ParameterTypeDescription
inputnumber | stringVehicle entity handle, or plate string.

This performs no ownership check. It deletes the record permanently. Validate the caller (e.g. officer job) before calling.


ConfiscateVehicleByPlate(plate) → boolean

Garage-integration variant. Removes the parked vehicle by plate so a garage can take ownership of it without a leftover street copy. Returns true on success.

lua
exports['origen_parking']:ConfiscateVehicleByPlate('ABC123')
ParameterTypeDescription
platestringVehicle number plate.

AreVehiclesLoaded() → boolean

Returns true once the parking grid has finished loading vehicles from the database. Use it to gate any logic that depends on parked vehicles existing after a resource restart.

lua
if exports['origen_parking']:AreVehiclesLoaded() then
    -- safe to query parked vehicles
end

Client-side exports

parkVehicle(vehicle)

Manually parks a vehicle entity. Sends the park request to the server with the captured vehicle data. No-op if local parking is disabled.

lua
exports['origen_parking']:parkVehicle(vehicle)
ParameterTypeDescription
vehiclenumberVehicle entity handle to park.

unparkVehicle(data)

Manually unparks a vehicle. Accepts an entity handle, a plate string, or a table.

lua
exports['origen_parking']:unparkVehicle(entity)            -- by entity (resolves orp_id)
exports['origen_parking']:unparkVehicle('ABC123')          -- by plate
exports['origen_parking']:unparkVehicle({ id = 14 })       -- by parking id
exports['origen_parking']:unparkVehicle({ plate = 'ABC123' })
ParameterTypeDescription
datanumber | string | tableEntity handle, plate, or { id } / { plate }.

onVehicleLocked(vehicle) → boolean

Explicit key-system hook. Runs the same eligibility checks as automatic parking (vehicle empty, not a bicycle, not blacklisted, not in a blocked zone, speed = 0) and parks the vehicle. Returns true if a park was initiated.

lua
exports['origen_parking']:onVehicleLocked(vehicle)
ParameterTypeDescription
vehiclenumberVehicle entity handle.

No-op (returns false) if parking is locally disabled, a save is already in progress, or the vehicle is not eligible — so it is always safe to call.


onVehicleUnlocked(vehicle) → boolean

Explicit key-system hook. Unparks the vehicle if it is currently part of the parking system. Resolves by the orp_id state bag, falling back to plate. Returns true if an unpark request was sent.

lua
exports['origen_parking']:onVehicleUnlocked(vehicle)
ParameterTypeDescription
vehiclenumberVehicle entity handle.

onVehicleLocked / onVehicleUnlocked are the recommended way to wire any key system to the parking flow. See the Custom → Key system integration section for full examples.


confiscateVehicle(arg)

Unified client trigger used by the admin panel and by police integrations.

lua
exports['origen_parking']:confiscateVehicle({ id = 14 })        -- admin (ownership validated server-side)
exports['origen_parking']:confiscateVehicle({ plate = 'ABC123' })
exports['origen_parking']:confiscateVehicle(entity)             -- police (no ownership check server-side)
ParameterTypeDescription
argtable | number{ id } / { plate } for admin/internal, or a vehicle entity handle for police confiscation.

toggleLocalParking(state)

Enables or disables automatic/manual parking for the local player. Passing nil toggles the current state.

lua
exports['origen_parking']:toggleLocalParking(false)  -- disable
exports['origen_parking']:toggleLocalParking(true)   -- enable
exports['origen_parking']:toggleLocalParking()       -- toggle
ParameterTypeDescription
stateboolean | niltrue enable, false disable, nil toggle.

GetParkingPositions() → table

Returns the local index of tracked street-parked vehicle positions, keyed by clean plate.

lua
local positions = exports['origen_parking']:GetParkingPositions()

IsVehicleNearby(id) → boolean

Returns true if the parked vehicle with the given parking id is currently within tracking range of the player.

lua
local near = exports['origen_parking']:IsVehicleNearby(14)
ParameterTypeDescription
idnumberParking row id.

GetVehicleByPlate(plate) → table | nil

Synchronous client lookup. Returns { plate = '<clean>' } if the plate is currently tracked as a street-parked vehicle, or nil. Used by key systems to enrich lock notifications.

lua
local v = exports['origen_parking']:GetVehicleByPlate('ABC123')
ParameterTypeDescription
platestringVehicle number plate.

openManagement()

Opens the admin management panel (same as the /orgadmin command). The server validates admin permission via the configured permission system before returning data.

lua
exports['origen_parking']:openManagement()