Skip to content

Exports & Events

Exports & Events

This page documents only what actually exists in the resource — no invented API surface.

Export

ox_inventory item definition
server = { export = 'bupa-rental.useRentalContract' }

bupa-rental.useRentalContract is the ox_inventory item-use handler for the rental_contract item. ox_inventory calls it with the usingItem event; the resource resolves the source and metadata and opens the rental receipt (re-issuing keys if the rental is still active). You reference this export from the item definition — you don't call it yourself.

On QB-Core, the usable item is registered internally by the resource via CreateUseableItem, so no export wiring is needed there — only the item definition.

ox_lib callbacks (client → server)

Callback Purpose
bupa-rental:getData Returns the fleet, units, prices, categories, the player's balance and their active + history rentals
bupa-rental:rent Validates, charges and creates a rental; returns the spawn payload and breakdown
bupa-rental:getActive Returns the player's active rentals and recent history

Net events (client → server)

Event Purpose
bupa-rental:registerVehicle(id, netId) Client reports the network id of the car it spawned
bupa-rental:returnVehicle(id) Early drop-off of an active rental

Net events (server → client)

Event Purpose
bupa-rental:notify(message, type) Show a notification
bupa-rental:openContract(data) Open the rental receipt from the contract item
bupa-rental:expireVehicle(info) Despawn the vehicle and remove keys
bupa-rental:reissueKeys(plate) Re-issue keys for a plate
bupa-rental:activeUpdated(list) Push the player's updated active-rentals list to the UI

Command

Command Access Effect
endrental <plate> Admin (Config.AdminAce) Force-ends the rental on that plate immediately
server.cfg
add_ace group.admin bupa.rental.admin allow

When Config.EnableDebug is on, a client-side rentalui command opens the interface directly for testing.