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.
exports['koja-carmarket']:RefreshZone('zone1')
| Arg | Type |
|---|---|
zoneId | string | number |
🛰️ Server exports
GetCarsInZone(zoneId)
Returns a table of every vehicle currently spawned/listed in the zone, keyed by plate.
local cars = exports['koja-carmarket']:GetCarsInZone('zone1')
for plate, car in pairs(cars) do
print(plate, car.owner, car.vehicle)
end
| 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).
exports['koja-carmarket']:GiveVehicleToPlayer(source, 'zentorno', function(ok, plate)
if ok then
print('granted, plate:', plate)
end
end)
| Arg | Type |
|---|---|
targetSource | int — player's server ID |
modelName | string — spawn name (e.g. 'zentorno') |
cb | function(ok: boolean, plate: string|nil) |
⌨️ Commands
/savecar <model> <playerId>
Grant a vehicle (by model name) to a player's garage. Admin only.
/savecar zentorno 4
| Permission | ACE group |
|---|---|
| Required | Config.Commands.AdminAce (default group.admin) |
Configurable in shared/config.lua:
Config.Commands = {
AdminAce = 'group.admin',
}
🔔 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:
RegisterNetEvent('koja_carmarket:client:vehicleSold', function(plate)
print('Vehicle sold:', plate)
end)
Related pages
- Configuration — Configure zones, parking, exchange rules, test drives, and custom images.
- Features — Player-facing flows and core marketplace features.
- Installation — Welcome to Koja-Carmarket, a player-driven car market with auctions, exchange zones, rentable parking slots and test drives.
- Database — Full reference for every table created by koja-carmarket.
- Zones — Market zones define where players can list and buy vehicles.
- CarMarket — back to the section overview