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.
local data = exports['origen_parking']:GetVehicleByPlate('ABC123')| Parameter | Type | Description |
|---|---|---|
plate | string | Vehicle number plate (spaces are matched as stored). |
The returned table is the internal data record:
{
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.
local data = exports['origen_parking']:GetVehicleByEntity(entity)| Parameter | Type | Description |
|---|---|---|
entity | number | Vehicle 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.
exports['origen_parking']:confiscateVehicle(entity) -- by entity
exports['origen_parking']:confiscateVehicle('ABC123') -- by plate| Parameter | Type | Description |
|---|---|---|
input | number | string | Vehicle 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.
exports['origen_parking']:ConfiscateVehicleByPlate('ABC123')| Parameter | Type | Description |
|---|---|---|
plate | string | Vehicle 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.
if exports['origen_parking']:AreVehiclesLoaded() then
-- safe to query parked vehicles
endClient-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.
exports['origen_parking']:parkVehicle(vehicle)| Parameter | Type | Description |
|---|---|---|
vehicle | number | Vehicle entity handle to park. |
unparkVehicle(data)
Manually unparks a vehicle. Accepts an entity handle, a plate string, or a table.
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' })| Parameter | Type | Description |
|---|---|---|
data | number | string | table | Entity 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.
exports['origen_parking']:onVehicleLocked(vehicle)| Parameter | Type | Description |
|---|---|---|
vehicle | number | Vehicle 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.
exports['origen_parking']:onVehicleUnlocked(vehicle)| Parameter | Type | Description |
|---|---|---|
vehicle | number | Vehicle 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.
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)| Parameter | Type | Description |
|---|---|---|
arg | table | 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.
exports['origen_parking']:toggleLocalParking(false) -- disable
exports['origen_parking']:toggleLocalParking(true) -- enable
exports['origen_parking']:toggleLocalParking() -- toggle| Parameter | Type | Description |
|---|---|---|
state | boolean | nil | true enable, false disable, nil toggle. |
GetParkingPositions() → table
Returns the local index of tracked street-parked vehicle positions, keyed by clean plate.
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.
local near = exports['origen_parking']:IsVehicleNearby(14)| Parameter | Type | Description |
|---|---|---|
id | number | Parking 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.
local v = exports['origen_parking']:GetVehicleByPlate('ABC123')| Parameter | Type | Description |
|---|---|---|
plate | string | Vehicle 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.
exports['origen_parking']:openManagement()