Koja Scripts
FREE

Exports & Commands

All public API surface of koja-carmarket.

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')
ArgType
zoneIdstring | 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
ArgType
zoneIdstring | 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)
ArgType
targetSourceint — player's server ID
modelNamestring — spawn name (e.g. 'zentorno')
cbfunction(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
PermissionACE group
RequiredConfig.Commands.AdminAce (default group.admin)

Configurable in shared/config.lua:

Config.Commands = {
    AdminAce = 'group.admin',
}

🔔 Client events you can hook into

EventWhen
koja_carmarket:client:vehicleSoldAny vehicle changes hands; arg = plate (string, 1–8 chars)
koja_carmarket:client:auctionUpdatedAuction state changes; arg = { listingId, event }
koja_carmarket:client:notifyContactA buyer clicked "Contact seller" on your listing

Example:

RegisterNetEvent('koja_carmarket:client:vehicleSold', function(plate)
    print('Vehicle sold:', plate)
end)
  • 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