CreatorsServer exports
AddVehicle
Last updated on
Gives a character a vehicle: a row in the garage, owned by them.
local res = exports.opx_infinity:AddVehicle(target, record, options)Scope write · must be awaited.
Parameters
-
target:
number | string— a loaded player id, or a citizen id -
record:
string— a TweakDB vehicle record,Vehicle.v_sport2_quadra_type66 -
options?:
table- garage?:
string— where it is stored; default the vehicles module'sDEFAULT_GARAGE
- garage?:
-
Through the vehicles module: a fresh plate,
PER_CHARACTERholds (vehicle.limit), andopx:on:vehicles:registeredis raised. -
No key is cut: add
GiveKeys.
Returns
table— the new vehicle, asGetVehicle
Errors
vehicle.limit,vehicle.registering,vehicle.badRecord,export.badArgument,export.callerDenied
CreateThread(function()
local pending, why = Open77.exports.call('opx_infinity', 'AddVehicle', playerId, 'Vehicle.v_sport2_quadra_type66', { garage = 'city' })
if not pending then return print('not sent: ' .. tostring(why)) end
local res = pending:await()
if not (res and res.ok) then return print('refused: ' .. tostring(res and res.error)) end
print('new plate ' .. res.value.plate)
end)