Hooks
The files under public/ and the exports other resources can call.
Everything in public/ stays readable and editable in the release, and an update replaces the rest, not these. Only decisions a server actually makes are in here. The machinery behind them is not, so there is nothing in this folder you can break by leaving it alone.
public/server.lua
CanEnterGarage(source, garageID, garage) | runs before a player is put inside. Return false and they stay out. |
CanUseVehicle(identifier, plate) | whether this player may put that plate away and take it out again. |
ImpoundFee(source, plate, fee) | what one release costs. Return a number. |
SpawnVehicle(source, model, coords, warpInto) | how a vehicle is created. Return the entity handle or nil. |
NotifyByWebhook(source, event, description) | where the log goes when it leaves the server. |
CanEnterGarage is the first thing asked when a player enters, before the owner, the co-owner and requireOwnerPresent are worked out. It gets the garage as it stands in the definition, so it is the place for a rule of your own: a licence, a level, a gang, or a garage closed while an event runs. It is not the place to read who the garage belongs to, because that is decided after it.
function PublicServer.CanEnterGarage(source, garageID, garage)
if garage.job == "police" then
return exports.my_licences:has(source, "police_academy")
end
return true
endCanUseVehicle answers ownership by default: the plate stands in your vehicle table under this identifier. A server where a company or a shared set of keys decides instead answers from its own table here. Saying yes to a plate the player does not own lets them drive it away.
ImpoundFee is handed Config.Impound.fee and returns what to charge, so the fee can depend on the vehicle, the player, or how long it has been sitting there.
public/client.lua
FormatMoney(money) | how a price is written. The default is $1,234, and the interface writes the same, so change both or neither. |
GetVehicleData(vehicle) | the properties saved when a vehicle is stored. |
SetVehicleData(vehicle, props) | how those properties are applied again. |
GetVehicleData and SetVehicleData are the pair to touch when your server keeps more on a vehicle than ox_lib's properties, tuning from another resource for example. They have to match each other.
The other two
public/ui.lua is the notification adapter and works the same way in all four resources, see Notifications.
public/framework.lua does not. It holds what this resource asks of the framework, and every resource asks something else: eight functions here, seven in ktx_cases, seven in ktx_fishing, four in ktx_dispatch, and not one name in common with this one. Fill in the file that ships with the resource you are running, and do not copy one over from another. See Frameworks.
Exports
exports.ktx_garages:parkVehicle(identifier, plate)
exports.ktx_garages:parkLooseVehicles(identifier)
exports.ktx_garages:impoundVehicle(identifier, plate, reason)
exports.ktx_garages:persistVehicle(entity, plate)
exports.ktx_garages:unpersistVehicle(plate)
exports.ktx_garages:isVehiclePersisted(plate)parkLooseVehicles is the one another resource usually wants. On a server running this resource the garage column holds garage ids, not a framework garage name, so a script that hands out a vehicle calls this afterwards and the vehicle lands somewhere its owner can actually reach.
The three persistence exports are for a vehicle that was created by another resource and should survive a restart like a garage vehicle does.