mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-18 22:36:04 +01:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8642733b78 | ||
|
|
5a4293182c | ||
|
|
6075878038 | ||
|
|
7eaeac886f | ||
|
|
fe27a1ca1c | ||
|
|
0caea0b473 |
@@ -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)
|
function playAnim(animDict, animName, duration, flag, ped)
|
||||||
loadAnimDict(animDict)
|
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
|
end
|
||||||
|
|
||||||
function stopAnim(animDict, animName)
|
function stopAnim(animDict, animName)
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
1.0.4
|
1.0.5
|
||||||
|
|||||||
27
wrapper.lua
27
wrapper.lua
@@ -767,6 +767,7 @@ function createInput(title, opts)
|
|||||||
options[i] = {
|
options[i] = {
|
||||||
type = "input",
|
type = "input",
|
||||||
label = opts[i].text ..(opts[i].txt and " - "..opts[i].txt or ""),
|
label = opts[i].text ..(opts[i].txt and " - "..opts[i].txt or ""),
|
||||||
|
default = opts[i].default,
|
||||||
isRequired = opts[i].isRequired,
|
isRequired = opts[i].isRequired,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@@ -925,23 +926,47 @@ function getVehicleProperties(vehicle)
|
|||||||
if vehicle == nil then return nil end
|
if vehicle == nil then return nil end
|
||||||
if GetResourceState(QBExport):find("start") and not GetResourceState(QBXExport):find("start") then
|
if GetResourceState(QBExport):find("start") and not GetResourceState(QBXExport):find("start") then
|
||||||
properties = Core.Functions.GetVehicleProperties(vehicle)
|
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
|
elseif GetResourceState(OXLibExport):find("start") then
|
||||||
properties = lib.getVehicleProperties(vehicle)
|
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
|
end
|
||||||
return properties
|
return properties
|
||||||
end
|
end
|
||||||
|
|
||||||
function setVehicleProperties(vehicle, props)
|
function 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
|
if not DoesEntityExist(vehicle) then
|
||||||
print(("Unable to set vehicle properties for '%s' (entity does not exist)"):
|
print(("Unable to set vehicle properties for '%s' (entity does not exist)"):
|
||||||
format(vehicle))
|
format(vehicle))
|
||||||
end
|
end
|
||||||
if GetResourceState(QBExport):find("start") and not GetResourceState(QBXExport):find("start") then
|
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)
|
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
|
else
|
||||||
TriggerServerEvent(GetCurrentResourceName()..":ox:setVehicleProperties", VehToNet(vehicle), props)
|
TriggerServerEvent(GetCurrentResourceName()..":ox:setVehicleProperties", VehToNet(vehicle), props)
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
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
|
end
|
||||||
|
|
||||||
RegisterNetEvent(GetCurrentResourceName()..":ox:setVehicleProperties", function(netId, props)
|
RegisterNetEvent(GetCurrentResourceName()..":ox:setVehicleProperties", function(netId, props)
|
||||||
|
|||||||
Reference in New Issue
Block a user