For the complete documentation index, see llms.txt. This page is also available as Markdown.

Exports & Commands

All public API surface of koja-carmarket.


πŸ–₯️ Client exports

OpenTablet()

Open the market tablet UI for the local player. No-op if already open.

exports['koja-carmarket']:OpenTablet()

CloseTablet()

Force-close the tablet UI.

exports['koja-carmarket']:CloseTablet()

IsTabletOpen()

local open = exports['koja-carmarket']:IsTabletOpen()
if open then ...
end

Returns boolean.

RefreshZone(zoneId)

Re-fetch and re-spawn vehicles in the given zone. Useful after a manual SQL change or an external script that listed a vehicle.

Arg
Type

zoneId

string | number


πŸ›°οΈ Server exports

GetCarsInZone(zoneId)

Returns a table of every vehicle currently spawned/listed in the zone, keyed by plate.

Arg
Type

zoneId

string | number

Returns { [plate] = { owner, vehicle, plate, coords, heading, slot_id }, ... }.

GiveVehicleToPlayer(targetSource, modelName, cb)

Insert a vehicle directly into a player's garage (ESX owned_vehicles or QBCore player_vehicles).

Arg
Type

targetSource

int β€” player's server ID

modelName

string β€” spawn name (e.g. 'zentorno')

cb

function(ok: boolean, plate: string|nil)

The plate is randomly generated as XXXXABCD where XXXX is math.random(4444, 9999). Collisions are statistically unlikely but not impossible β€” handle the error in cb.


⌨️ Commands

/savecar <model> <playerId>

Grant a vehicle (by model name) to a player's garage. Admin only.

Permission
ACE group

Required

Config.Commands.AdminAce (default group.admin)

Configurable in shared/config.lua:


πŸ”” Client events you can hook into

Event
When

koja_carmarket:client:vehicleSold

Any vehicle changes hands; arg = plate (string, 1–8 chars)

koja_carmarket:client:auctionUpdated

Auction state changes; arg = { listingId, event }

koja_carmarket:client:notifyContact

A buyer clicked "Contact seller" on your listing

Example:

Last updated