From 370c77433b1f0d9452103cede3ce234ec2424de7 Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Sat, 20 Jan 2024 13:01:26 +0000 Subject: [PATCH 1/3] Version Bump - v1.0.4 --- fxmanifest.lua | 2 +- version.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fxmanifest.lua b/fxmanifest.lua index 7091819..014697c 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -1,6 +1,6 @@ name "Jim_Bridge" author "Jimathy" -version "1.0.3" +version "1.0.4" description "Framework Bridge By Jimathy" fx_version "cerulean" game "gta5" diff --git a/version.txt b/version.txt index 21e8796..ee90284 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.0.3 +1.0.4 From 0caea0b4739c944b0ef2f2bb3fc265b5299b475e Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Sat, 20 Jan 2024 14:28:10 +0000 Subject: [PATCH 2/3] advanced checking and handling of setVehicle --- wrapper.lua | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/wrapper.lua b/wrapper.lua index f32c36a..143d34d 100644 --- a/wrapper.lua +++ b/wrapper.lua @@ -925,25 +925,49 @@ function getVehicleProperties(vehicle) if vehicle == nil then return nil end if GetResourceState(QBExport):find("start") and not GetResourceState(QBXExport):find("start") then properties = Core.Functions.GetVehicleProperties(vehicle) + if Config.System.Debug then print("^6Bridge^7: ^2Getting Vehicle Properties ^7[^6"..QBExport.."^7] - [^3"..vehicle.."^7] - [^3"..GetEntityModel(vehicle).."^7/^3"..properties.model.."^7] - [^3"..properties.plate.."^7]") end elseif GetResourceState(OXLibExport):find("start") then properties = lib.getVehicleProperties(vehicle) + if Config.System.Debug then print("^6Bridge^7: ^2Getting Vehicle Properties ^7[^6"..OXLibExport.."^7] - [^3"..vehicle.."^7] - [^3"..GetEntityModel(vehicle).."^7/^3"..properties.model.."^7] - [^3"..properties.plate.."^7]") end end return properties end function setVehicleProperties(vehicle, props) - if not DoesEntityExist(vehicle) then - print(("Unable to set vehicle properties for '%s' (entity does not exist)"): - format(vehicle)) - end - if GetResourceState(QBExport):find("start") and not GetResourceState(QBXExport):find("start") then - if Config.System.Debug then print("^6Bridge^7: ^2Setting Vehicle Properties ^7[^6"..QBExport.."^7] - [^3"..vehicle.."^7] - [^3"..GetEntityModel(vehicle).."^7] - [^3"..props.plate.."^7]") end - Core.Functions.SetVehicleProperties(vehicle, props) + local oldProps = getVehicleProperties(vehicle) + if checkDifferences(vehicle, props) then + --if Config.System.Debug then debugDifferences(vehicle, props) end + if not DoesEntityExist(vehicle) then + print(("Unable to set vehicle properties for '%s' (entity does not exist)"): + format(vehicle)) + end + if GetResourceState(QBExport):find("start") and not GetResourceState(QBXExport):find("start") then + Core.Functions.SetVehicleProperties(vehicle, props) + if Config.System.Debug then print("^6Bridge^7: ^2Setting Vehicle Properties ^7[^6"..QBExport.."^7] - [^3"..vehicle.."^7] - [^3"..GetEntityModel(vehicle).."^7/^3"..props.model.."^7] - [^3"..props.plate.."^7]") end + else + TriggerServerEvent(GetCurrentResourceName()..":ox:setVehicleProperties", VehToNet(vehicle), props) + end else - TriggerServerEvent(GetCurrentResourceName()..":ox:setVehicleProperties", VehToNet(vehicle), props) + if Config.System.Debug then print("^6Bridge^7: ^2No Changes Found ^7 [^3"..vehicle.."^7] - [^3"..GetEntityModel(vehicle).."^7/^3"..props.model.."^7] - [^3"..props.plate.."^7]") end end end +function checkDifferences(vehicle, newProps) + local oldProps = getVehicleProperties(vehicle) + if Config.System.Debug then print("^6Bridge^7: ^2Finding differences in ^3Vehicle Properties^7") end + local allow = false + for k in pairs(oldProps) do + if json.encode(oldProps[k]) ~= json.encode(newProps[k]) then + allow = true + if Config.System.Debug then + print("^6Bridge^7: ^5Old ^7[^3"..k.."^7] - "..json.encode(oldProps[k], { indent = true })) + print("^6Bridge^7: ^5New ^7[^3"..k.."^7] - "..json.encode(newProps[k], { indent = true })) + end + end + end + return allow +end + RegisterNetEvent(GetCurrentResourceName()..":ox:setVehicleProperties", function(netId, props) local vehicle = NetworkGetEntityFromNetworkId(netId) local value = props From fe27a1ca1cf00e7c324c35ef69b2fda83944e451 Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Sun, 21 Jan 2024 00:25:42 +0000 Subject: [PATCH 3/3] speed playAnim up + add default input message --- functions.lua | 2 +- version.txt | 2 +- wrapper.lua | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/functions.lua b/functions.lua index 3ceddaf..f2cfb9a 100644 --- a/functions.lua +++ b/functions.lua @@ -29,7 +29,7 @@ function pairsByKeys(t) local a = {} for n in pairs(t) do a[#a+1] = n end table. function playAnim(animDict, animName, duration, flag, ped) loadAnimDict(animDict) - TaskPlayAnim(ped and ped or PlayerPedId(), animDict, animName, 1.0, -1.0, duration or 30000, flag or 50, 1, false, false, false) + TaskPlayAnim(ped and ped or PlayerPedId(), animDict, animName, 8.0, -8.0, duration or 30000, flag or 50, 1, false, false, false) end function stopAnim(animDict, animName) diff --git a/version.txt b/version.txt index ee90284..72d1562 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.0.4 +1.0.3 diff --git a/wrapper.lua b/wrapper.lua index 143d34d..01eba4b 100644 --- a/wrapper.lua +++ b/wrapper.lua @@ -767,6 +767,7 @@ function createInput(title, opts) options[i] = { type = "input", label = opts[i].text ..(opts[i].txt and " - "..opts[i].txt or ""), + default = opts[i].default, isRequired = opts[i].isRequired, } end