Attempt to fix ox_lib's setVehicleProperites + 1.0.2

This commit is contained in:
Jim Shield
2024-01-18 20:21:22 +00:00
committed by GitHub
parent 78c3e33d38
commit 6eed194287
4 changed files with 24 additions and 6 deletions

View File

@@ -863,4 +863,4 @@ function StopEffects() -- Used to clear up any effects stuck on screen
AnimpostfxStop('RaceTurbo')
AnimpostfxStop('FocusIn')
AnimpostfxStop('Rampage')
end
end

View File

@@ -1,6 +1,6 @@
name "Jim_Bridge"
author "Jimathy"
version "1.0.1"
version "1.0.2"
description "Framework Bridge By Jimathy"
fx_version "cerulean"
game "gta5"

View File

@@ -1 +1 @@
1.0.1
1.0.2

View File

@@ -60,7 +60,7 @@ end
-- Load Vehicles
if GetResourceState(QBXExport):find("start") then
Core = Core or exports[QBXExport]:GetCoreObject()
Core = Core or exports[QBExport]:GetCoreObject()
print("^6Bridge^7: ^2Loading ^3Vehicles^2 from ^7"..QBXExport)
Vehicles = exports[QBXExport]:GetVehiclesByHash()
elseif GetResourceState(QBExport):find("start") then
@@ -937,12 +937,30 @@ function setVehicleProperties(vehicle, props)
format(vehicle))
end
if GetResourceState(OXLibExport):find("start") then
lib.setVehicleProperties(vehicle, props)
TriggerServerEvent(GetCurrentResourceName()..":ox:setVehicleProperties", VehToNet(vehicle), props)
elseif GetResourceState(QBExport):find("start") then
Core.Functions.SetVehicleProperties(vehicle, props)
end
end
RegisterNetEvent(GetCurrentResourceName()..":ox:setVehicleProperties", function(netId, props)
local vehicle = NetworkGetEntityFromNetworkId(netId)
local value = props
Entity(vehicle).state[GetCurrentResourceName()..':setVehicleProperties'] = value
end)
AddStateBagChangeHandler(GetCurrentResourceName()..':setVehicleProperties', '', function(bagName, _, value)
if not value or not GetEntityFromStateBagName then return end
local entity = GetEntityFromStateBagName(bagName)
local networked = not bagName:find('localEntity')
if networked and NetworkGetEntityOwner(entity) ~= cache.playerId then return end
if lib.setVehicleProperties(entity, value) then
Entity(entity).state:set('setVehicleProperties', nil, true)
end
end)
RegisterNetEvent(GetCurrentResourceName()..":server:ChargePlayer", function(cost, type) local src = source
if Config.System.Debug then print("^6Bridge^7: ^2Charging ^2Player: '^6"..cost.."^7'", type) end
if type == "cash" then
@@ -1213,4 +1231,4 @@ function registerStash(name, label)
exports[QSInv]:RegisterStash(name, 50, 4000000)
end
end
-- IN NO WAY PERFECT --
-- IN NO WAY PERFECT --