这部分函数可以用于读取和设置载具的信息与属性
Vehicles.GetProperties
函数作用:获取载具的属性
返回类型:table(载具属性)
基本构造:ZeroDream.Vehicles.GetProperties( vehicle )
示例代码:
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
local props = ZeroDream.Vehicles.GetProperties(vehicle)
print(json.encode(props))
Vehicles.SetProperties
函数作用:设置载具的属性
基本构造:ZeroDream.Vehicles.SetProperties( vehicle, props )
示例代码:
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
local plate = GetVehicleNumberPlateText(vehicle)
ZeroDream.Callbacks.Trigger("zerodream_vehicles:getProperties", function(result)
if result.success then
ZeroDream.Vehicles.SetProperties(vehicle, result.props)
else
ZeroDream.Hud.SendNotification("无法获取载具属性")
end
end, plate)