Client
SpawnVehicle
Yields until the model is loaded. The vehicle is networked.
Parameters
modelstring|number— model name or hashcoordsvector3— optional. Defaults to the local player.headingnumber— optional
Returns
number — vehicle entity, or 0 when the model cannot be loaded.
Example
local vehicle = Bridge.SpawnVehicle('adder', GetEntityCoords(PlayerPedId()), 90.0)
if vehicle ~= 0 then
TaskWarpPedIntoVehicle(PlayerPedId(), vehicle, -1)
endDeleteVehicle
Parameters
vehiclenumber— vehicle entity
Returns
boolean
Example
local vehicle = Bridge.GetClosestVehicle(nil, 4.0)
if vehicle ~= 0 then
Bridge.DeleteVehicle(vehicle)
endGetPlate
Parameters
vehiclenumber— vehicle entity
Returns
string|nil — plate text with surrounding spaces removed.
Example
local plate = Bridge.GetPlate(vehicle)
if plate then
Bridge.GiveKeys(plate)
endGetClosestVehicle
Parameters
coordsvector3— optionalradiusnumber— optional. Defaults to5.0.
Returns
number, number|nil — vehicle entity, or 0 when none is in range, and the distance.
Example
local vehicle, distance = Bridge.GetClosestVehicle(nil, 6.0)
if vehicle ~= 0 then
print(Bridge.GetPlate(vehicle), distance)
endGetVehicleProperties
The table is the one that framework already stores for its vehicles. Qbox, ox, and ND need ox_lib. Without it the result is nil.
Parameters
vehiclenumber— vehicle entity
Returns
table|nil
Example
local props = Bridge.GetVehicleProperties(vehicle)
if props then
print(props.plate or props.model)
endSetVehicleProperties
Parameters
vehiclenumber— vehicle entitypropstable— a table previously returned byGetVehiclePropertieson this server
Returns
boolean — false when ox_lib is required and not started.
Example
local props = Bridge.GetVehicleProperties(vehicle)
if props then
props.fuelLevel = 100.0
Bridge.SetVehicleProperties(vehicle, props)
end