mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-17 05:56:02 +01:00
Fixes and updates
This commit is contained in:
12
crafting.lua
12
crafting.lua
@@ -1,7 +1,9 @@
|
|||||||
if GetResourceState(OXLibExport):find("start") then
|
if IsDuplicityVersion() then
|
||||||
createCallback(GetCurrentResourceName()..':server:GetStashItems', function(source, stashName) local stash = getStash(stashName) return stash end)
|
if GetResourceState(OXLibExport):find("start") then
|
||||||
else
|
createCallback(GetCurrentResourceName()..':server:GetStashItems', function(source, stashName) local stash = getStash(stashName) return stash end)
|
||||||
createCallback(GetCurrentResourceName()..':server:GetStashItems', function(source, cb, stashName) local stash = getStash(stashName) cb(stash) end)
|
else
|
||||||
|
createCallback(GetCurrentResourceName()..':server:GetStashItems', function(source, cb, stashName) local stash = getStash(stashName) cb(stash) end)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local timeout = 0
|
local timeout = 0
|
||||||
@@ -216,7 +218,7 @@ function openShop(data)
|
|||||||
if GetResourceState(OXInv):find("start") then
|
if GetResourceState(OXInv):find("start") then
|
||||||
exports[OXInv]:openInventory('shop', { type = data.shop })
|
exports[OXInv]:openInventory('shop', { type = data.shop })
|
||||||
else
|
else
|
||||||
TriggerServerEvent(Config.JimShops and "jim-shops:ShopOpen" or "inventory:server:OpenInventory", "shop", data.shop, data.items)
|
TriggerServerEvent(Config.General.JimShops and "jim-shops:ShopOpen" or "inventory:server:OpenInventory", "shop", data.items.label, data.items)
|
||||||
end
|
end
|
||||||
lookEnt(data.coords)
|
lookEnt(data.coords)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -94,6 +94,12 @@ function makeProp(data, freeze, synced)
|
|||||||
return prop
|
return prop
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function cv(amount)
|
||||||
|
local formatted = amount
|
||||||
|
while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') if (k==0) then break end Wait(0) end
|
||||||
|
return formatted
|
||||||
|
end
|
||||||
|
|
||||||
AddEventHandler('onResourceStop', function(r)
|
AddEventHandler('onResourceStop', function(r)
|
||||||
if r ~= GetCurrentResourceName() then return end
|
if r ~= GetCurrentResourceName() then return end
|
||||||
stopSpinner()
|
stopSpinner()
|
||||||
@@ -211,7 +217,12 @@ function createTempCam(ent, coords)
|
|||||||
if Config.System.Debug then
|
if Config.System.Debug then
|
||||||
triggerNotify(nil, "ModCam Created", "success")
|
triggerNotify(nil, "ModCam Created", "success")
|
||||||
end
|
end
|
||||||
local camCoords = GetOffsetFromEntityInWorldCoords(ent, 1.2, -0.3, 0.8)
|
local camCoords = nil
|
||||||
|
if type(ent) ~= "vector3" then
|
||||||
|
camCoords = GetOffsetFromEntityInWorldCoords(ent, 1.2, -0.3, 0.8)
|
||||||
|
else
|
||||||
|
camCoords = ent
|
||||||
|
end
|
||||||
--local pedCoords = GetEntityCoords(PlayerPedId())
|
--local pedCoords = GetEntityCoords(PlayerPedId())
|
||||||
cam = CreateCamWithParams("DEFAULT_SCRIPTED_CAMERA", camCoords.x, camCoords.y, camCoords.z+0.5, 1.0, 0.0, 0.0, 60.00, false, 0)
|
cam = CreateCamWithParams("DEFAULT_SCRIPTED_CAMERA", camCoords.x, camCoords.y, camCoords.z+0.5, 1.0, 0.0, 0.0, 60.00, false, 0)
|
||||||
PointCamAtCoord(cam, coords)
|
PointCamAtCoord(cam, coords)
|
||||||
@@ -276,6 +287,9 @@ function progressBar(data)
|
|||||||
lockInv(false)
|
lockInv(false)
|
||||||
if data.cam then stopTempCam(data.cam) end
|
if data.cam then stopTempCam(data.cam) end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
exports["esx_progressbar"]:Progressbar(message, length, Options)
|
||||||
|
|
||||||
elseif Config.System.ProgressBar == "qb" then
|
elseif Config.System.ProgressBar == "qb" then
|
||||||
Core.Functions.Progressbar("mechbar",
|
Core.Functions.Progressbar("mechbar",
|
||||||
data.label,
|
data.label,
|
||||||
@@ -297,10 +311,35 @@ function progressBar(data)
|
|||||||
stopTempCam(data.cam)
|
stopTempCam(data.cam)
|
||||||
end
|
end
|
||||||
end, data.icon)
|
end, data.icon)
|
||||||
elseif Config.System.ProgressBar == "gta" then
|
|
||||||
|
|
||||||
--local wait, inProgress = (Config.System.Debug and 1000 or data.time), true
|
elseif Config.System.ProgressBar == "esx" then
|
||||||
local wait = data.time
|
ESX.Progressbar(data.label, Config.System.Debug and 1000 or data.time, {
|
||||||
|
FreezePlayer = true,
|
||||||
|
animation ={
|
||||||
|
type =data.anim,
|
||||||
|
dict = data.dict,
|
||||||
|
scenario = data.task,
|
||||||
|
},
|
||||||
|
onFinish = function()
|
||||||
|
result = true
|
||||||
|
FreezeEntityPosition(PlayerPedId(), false)
|
||||||
|
lockInv(false)
|
||||||
|
if data.cam then
|
||||||
|
stopTempCam(data.cam)
|
||||||
|
end
|
||||||
|
end, onCancel = function()
|
||||||
|
result = false
|
||||||
|
FreezeEntityPosition(PlayerPedId(), false)
|
||||||
|
lockInv(false)
|
||||||
|
if data.cam then
|
||||||
|
stopTempCam(data.cam)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
elseif Config.System.ProgressBar == "gta" then
|
||||||
|
local wait, inProgress = (Config.System.Debug and 1000 or data.time), true
|
||||||
|
--local wait = data.time
|
||||||
inProgress = true
|
inProgress = true
|
||||||
if not (data.dead and data.dead or false) then
|
if not (data.dead and data.dead or false) then
|
||||||
lockInv(true)
|
lockInv(true)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
name "Jim_Bridge"
|
name "Jim_Bridge"
|
||||||
author "Jimathy"
|
author "Jimathy"
|
||||||
version "help"
|
version "alpha"
|
||||||
description "Framework Bridge By Jimathy"
|
description "Framework Bridge By Jimathy"
|
||||||
fx_version "cerulean"
|
fx_version "cerulean"
|
||||||
game "gta5"
|
game "gta5"
|
||||||
|
|||||||
95
wrapper.lua
95
wrapper.lua
@@ -11,6 +11,7 @@ OXInv = Exports and Exports.OXInv or ""
|
|||||||
QBInv = Exports and Exports.QBInv or ""
|
QBInv = Exports and Exports.QBInv or ""
|
||||||
QSInv = Exports and Exports.QSInv or ""
|
QSInv = Exports and Exports.QSInv or ""
|
||||||
CoreInv = Exports and Exports.CoreInv or ""
|
CoreInv = Exports and Exports.CoreInv or ""
|
||||||
|
CodeMInv = Exports and Exports.CodeMInv or ""
|
||||||
|
|
||||||
QBMenuExport = Exports and Exports.QBMenuExport or ""
|
QBMenuExport = Exports and Exports.QBMenuExport or ""
|
||||||
|
|
||||||
@@ -35,7 +36,7 @@ if GetResourceState(OXInv):find("start") then
|
|||||||
end
|
end
|
||||||
elseif GetResourceState(QBExport):find("start") then
|
elseif GetResourceState(QBExport):find("start") then
|
||||||
print("^6Bridge^7: ^2Loading ^3Items^2 from ^7"..QBExport)
|
print("^6Bridge^7: ^2Loading ^3Items^2 from ^7"..QBExport)
|
||||||
Core = exports[QBExport]:GetCoreObject()
|
Core = Core or exports[QBExport]:GetCoreObject()
|
||||||
Items = Core.Shared.Items
|
Items = Core.Shared.Items
|
||||||
elseif GetResourceState(ESXExport):find("start") then
|
elseif GetResourceState(ESXExport):find("start") then
|
||||||
print("^6Bridge^7: ^2Loading ^3Items^2 from ^7"..ESXExport)
|
print("^6Bridge^7: ^2Loading ^3Items^2 from ^7"..ESXExport)
|
||||||
@@ -45,14 +46,14 @@ end
|
|||||||
|
|
||||||
-- Load Vehicles
|
-- Load Vehicles
|
||||||
if GetResourceState(QBXExport):find("start") then
|
if GetResourceState(QBXExport):find("start") then
|
||||||
Core = exports[QBExport]:GetCoreObject()
|
Core = Core or exports[QBExport]:GetCoreObject()
|
||||||
print("^6Bridge^7: ^2Loading ^3Vehicles^2 from ^7"..QBXExport)
|
print("^6Bridge^7: ^2Loading ^3Vehicles^2 from ^7"..QBXExport)
|
||||||
Vehicles = exports[QBXExport]:GetVehiclesByHash()
|
Vehicles = exports[QBXExport]:GetVehiclesByHash()
|
||||||
elseif GetResourceState(QBExport):find("start") then
|
elseif GetResourceState(QBExport):find("start") then
|
||||||
print("^6Bridge^7: ^2Loading ^3Vehicles^2 from ^7"..QBExport)
|
print("^6Bridge^7: ^2Loading ^3Vehicles^2 from ^7"..QBExport)
|
||||||
Core = exports[QBExport]:GetCoreObject()
|
Core = Core or exports[QBExport]:GetCoreObject()
|
||||||
RegisterNetEvent('QBCore:Client:UpdateObject', function()
|
RegisterNetEvent('QBCore:Client:UpdateObject', function()
|
||||||
Core = exports[QBExport]:GetCoreObject()
|
Core = Core or exports[QBExport]:GetCoreObject()
|
||||||
end)
|
end)
|
||||||
Vehicles = Core.Shared.Vehicles
|
Vehicles = Core.Shared.Vehicles
|
||||||
elseif GetResourceState(OXCoreExport):find("start") then
|
elseif GetResourceState(OXCoreExport):find("start") then
|
||||||
@@ -82,7 +83,7 @@ end
|
|||||||
|
|
||||||
-- Load Jobs
|
-- Load Jobs
|
||||||
if GetResourceState(QBXExport):find("start") then
|
if GetResourceState(QBXExport):find("start") then
|
||||||
Core = exports[QBExport]:GetCoreObject()
|
Core = Core or exports[QBExport]:GetCoreObject()
|
||||||
print("^6Bridge^7: ^2Loading ^3Jobs^7/^3Gangs^2 from ^7"..QBXExport)
|
print("^6Bridge^7: ^2Loading ^3Jobs^7/^3Gangs^2 from ^7"..QBXExport)
|
||||||
Jobs = exports[QBXExport]:GetJobs()
|
Jobs = exports[QBXExport]:GetJobs()
|
||||||
Gangs = exports[QBXExport]:GetGangs()
|
Gangs = exports[QBXExport]:GetGangs()
|
||||||
@@ -108,8 +109,8 @@ elseif GetResourceState(OXCoreExport):find("start") then
|
|||||||
|
|
||||||
elseif GetResourceState(QBExport):find("start") then
|
elseif GetResourceState(QBExport):find("start") then
|
||||||
print("^6Bridge^7: ^2Loading ^3Jobs^7/^3Gangs^2 from ^7"..QBExport)
|
print("^6Bridge^7: ^2Loading ^3Jobs^7/^3Gangs^2 from ^7"..QBExport)
|
||||||
Core = Core or exports[QBExport]:GetCoreObject()
|
Core = Core or Core or exports[QBExport]:GetCoreObject()
|
||||||
RegisterNetEvent('QBCore:Client:UpdateObject', function() Core = exports[QBExport]:GetCoreObject() end)
|
RegisterNetEvent('QBCore:Client:UpdateObject', function() Core = Core or exports[QBExport]:GetCoreObject() end)
|
||||||
Jobs = Core.Shared.Jobs
|
Jobs = Core.Shared.Jobs
|
||||||
Gangs = Core.Shared.Gangs
|
Gangs = Core.Shared.Gangs
|
||||||
|
|
||||||
@@ -437,6 +438,46 @@ function createBoxTarget(data, opts, dist)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local circleTargets = {}
|
||||||
|
function createCircleTarget(data, opts, dist)
|
||||||
|
if GetResourceState(OXTargetExport):find("start") then
|
||||||
|
if Config.System.Debug then
|
||||||
|
print("^6Bridge^7: ^2Creating new ^3Sphere^2 target with ^6"..OXTargetExport.." ^7"..data[1])
|
||||||
|
end
|
||||||
|
local options = {}
|
||||||
|
for i = 1, #opts do
|
||||||
|
options[i] = {
|
||||||
|
icon = opts[i].icon,
|
||||||
|
label = opts[i].label,
|
||||||
|
item = opts[i].item or nil,
|
||||||
|
groups = opts[i].job or opts[i].gang,
|
||||||
|
onSelect = opts[i].onSelect or opts[i].action,
|
||||||
|
canInteract = function(_, distance)
|
||||||
|
return distance < dist and true or false
|
||||||
|
end
|
||||||
|
}
|
||||||
|
end
|
||||||
|
local target = exports[OXTargetExport]:addSphereZone({
|
||||||
|
coords = data[2],
|
||||||
|
radius = data[3],
|
||||||
|
debug = data[4].debugPoly,
|
||||||
|
options = options
|
||||||
|
})
|
||||||
|
circleTargets[#circleTargets+1] = target
|
||||||
|
return target
|
||||||
|
elseif GetResourceState(QBTargetExport):find("start") then
|
||||||
|
if Config.System.Debug then
|
||||||
|
print("^6Bridge^7: ^2Creating new ^3Circle^2 target with ^6"..QBTargetExport.." ^7"..data[1])
|
||||||
|
end
|
||||||
|
local options = { options = opts, distance = dist }
|
||||||
|
|
||||||
|
local target = exports[QBTargetExport]:AddCircleZone(data[1], data[2], data[3], data[4], options)
|
||||||
|
|
||||||
|
circleTargets[#circleTargets+1] = target
|
||||||
|
return target
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function removeEntityTarget(entity)
|
function removeEntityTarget(entity)
|
||||||
if GetResourceState(QBTargetExport):find("start") then exports[QBTargetExport]:RemoveTargetEntity(entity) end
|
if GetResourceState(QBTargetExport):find("start") then exports[QBTargetExport]:RemoveTargetEntity(entity) end
|
||||||
if GetResourceState(OXTargetExport):find("start") then exports[OXTargetExport]:removeLocalEntity(entity, nil) end
|
if GetResourceState(OXTargetExport):find("start") then exports[OXTargetExport]:removeLocalEntity(entity, nil) end
|
||||||
@@ -457,6 +498,10 @@ AddEventHandler('onResourceStop', function(r)
|
|||||||
if GetResourceState(OXTargetExport):find("start") then exports[OXTargetExport]:removeZone(boxTargets[i], true)
|
if GetResourceState(OXTargetExport):find("start") then exports[OXTargetExport]:removeZone(boxTargets[i], true)
|
||||||
elseif GetResourceState(QBTargetExport):find("start") then exports[QBTargetExport]:RemoveZone(boxTargets[i].name) end
|
elseif GetResourceState(QBTargetExport):find("start") then exports[QBTargetExport]:RemoveZone(boxTargets[i].name) end
|
||||||
end
|
end
|
||||||
|
for i = 1, #circleTargets do
|
||||||
|
if GetResourceState(OXTargetExport):find("start") then exports[OXTargetExport]:removeZone(circleTargets[i], true)
|
||||||
|
elseif GetResourceState(QBTargetExport):find("start") then exports[QBTargetExport]:RemoveZone(circleTargets[i].name) end
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- NOTIFICATIONS --
|
-- NOTIFICATIONS --
|
||||||
@@ -554,14 +599,14 @@ end
|
|||||||
-- Callbacks
|
-- Callbacks
|
||||||
function createCallback(callbackName, funct)
|
function createCallback(callbackName, funct)
|
||||||
if GetResourceState(OXLibExport):find("start") then
|
if GetResourceState(OXLibExport):find("start") then
|
||||||
if Config and Config.System.Debug then print("^6Bridge^7: ^2Registering ^3Callback^2 with ^7"..OXLibExport, callbackName) end
|
if Config.System.Debug then print("^6Bridge^7: ^2Registering ^3Callback^2 with ^7"..OXLibExport, callbackName) end
|
||||||
lib.callback.register(callbackName, funct)
|
lib.callback.register(callbackName, funct)
|
||||||
elseif GetResourceState(QBExport):find("start") then
|
elseif GetResourceState(QBExport):find("start") then
|
||||||
if Config and Config.System.Debug then print("^6Bridge^7: ^2Registering ^3Callback^2 with ^7"..QBExport, callbackName) end
|
if Config.System.Debug then print("^6Bridge^7: ^2Registering ^3Callback^2 with ^7"..QBExport, callbackName) end
|
||||||
Core = exports[QBExport]:GetCoreObject()
|
Core = Core or exports[QBExport]:GetCoreObject()
|
||||||
Core.Functions.CreateCallback(callbackName, funct)
|
Core.Functions.CreateCallback(callbackName, funct)
|
||||||
elseif GetResourceState(ESXExport):find("start") then
|
elseif GetResourceState(ESXExport):find("start") then
|
||||||
if Config and Config.System.Debug then print("^6Bridge^7: ^2Registering ^3Callback^2 with ^7"..ESXExport, callbackName) end
|
if Config.System.Debug then print("^6Bridge^7: ^2Registering ^3Callback^2 with ^7"..ESXExport, callbackName) end
|
||||||
ESX.RegisterServerCallback(callbackName, funct)
|
ESX.RegisterServerCallback(callbackName, funct)
|
||||||
else
|
else
|
||||||
print("^6Bridge^7: ^1ERROR^7: ^3Can't find any script to register callback with", callbackName)
|
print("^6Bridge^7: ^1ERROR^7: ^3Can't find any script to register callback with", callbackName)
|
||||||
@@ -570,15 +615,15 @@ end
|
|||||||
|
|
||||||
function triggerCallback(callBackName, value) local result = nil
|
function triggerCallback(callBackName, value) local result = nil
|
||||||
if GetResourceState(OXLibExport):find("start") then
|
if GetResourceState(OXLibExport):find("start") then
|
||||||
if Config and Config.System.Debug then print("^6Bridge^7: ^2Triggering ^3Callback^2 with ^7"..OXLibExport, callBackName) end
|
if Config.System.Debug then print("^6Bridge^7: ^2Triggering ^3Callback^2 with ^7"..OXLibExport, callBackName) end
|
||||||
result = lib.callback.await(callBackName, false, value)
|
result = lib.callback.await(callBackName, false, value)
|
||||||
elseif GetResourceState(QBExport):find("start") then
|
elseif GetResourceState(QBExport):find("start") then
|
||||||
if Config and Config.System.Debug then print("^6Bridge^7: ^2Triggering ^3Callback^2 with ^7"..QBExport, callBackName) end
|
if Config.System.Debug then print("^6Bridge^7: ^2Triggering ^3Callback^2 with ^7"..QBExport, callBackName) end
|
||||||
local p = promise.new()
|
local p = promise.new()
|
||||||
Core.Functions.TriggerCallback(callBackName, function(cb) p:resolve(cb) end, value)
|
Core.Functions.TriggerCallback(callBackName, function(cb) p:resolve(cb) end, value)
|
||||||
result = Citizen.Await(p)
|
result = Citizen.Await(p)
|
||||||
elseif GetResourceState(ESXExport):find("start") then
|
elseif GetResourceState(ESXExport):find("start") then
|
||||||
if Config and Config.System.Debug then print("^6Bridge^7: ^2Triggering ^3Callback^2 with ^7"..ESXExport, callBackName) end
|
if Config.System.Debug then print("^6Bridge^7: ^2Triggering ^3Callback^2 with ^7"..ESXExport, callBackName) end
|
||||||
local p = promise.new()
|
local p = promise.new()
|
||||||
ESX.TriggerServerCallback(callBackName, function(cb) p:resolve(cb) end, value)
|
ESX.TriggerServerCallback(callBackName, function(cb) p:resolve(cb) end, value)
|
||||||
result = Citizen.Await(p)
|
result = Citizen.Await(p)
|
||||||
@@ -606,16 +651,17 @@ end
|
|||||||
function createInput(title, opts)
|
function createInput(title, opts)
|
||||||
local dialog = nil
|
local dialog = nil
|
||||||
local options = {}
|
local options = {}
|
||||||
if Config.Input.Menu == "ox" then
|
if Config.System.Menu == "ox" then
|
||||||
for i = 1, #opts do
|
for i = 1, #opts do
|
||||||
if opts[i].type == "radio" then
|
if opts[i].type == "radio" then
|
||||||
for k in pairs(opts[i].options) do
|
for k in pairs(opts[i].options) do
|
||||||
opts[i].options[k].label = opts[i].options[k].text
|
opts[i].options[k].label = opts[i].options[k].text
|
||||||
|
print(opts[i].options[k].text)
|
||||||
end
|
end
|
||||||
options[i] = {
|
options[i] = {
|
||||||
type = "select",
|
type = "select",
|
||||||
isRequired = opts[i].isRequired,
|
isRequired = opts[i].isRequired,
|
||||||
label = opts[i].label,
|
label = opts[i].label or opts[i].text,
|
||||||
name = opts[i].name,
|
name = opts[i].name,
|
||||||
default = opts[i].options[1].value,
|
default = opts[i].options[1].value,
|
||||||
options = opts[i].options,
|
options = opts[i].options,
|
||||||
@@ -624,7 +670,16 @@ function createInput(title, opts)
|
|||||||
if opts[i].type == "number" then
|
if opts[i].type == "number" then
|
||||||
options[i] = {
|
options[i] = {
|
||||||
type = "number",
|
type = "number",
|
||||||
label = opts[i].text.." - "..opts[i].txt,
|
label = opts[i].text ..(opts[i].txt and " - "..opts[i].txt or ""),
|
||||||
|
isRequired = opts[i].isRequired,
|
||||||
|
name = opts[i].name,
|
||||||
|
options = opts[i].options,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
if opts[i].type == "select" then
|
||||||
|
options[i] = {
|
||||||
|
type = "select",
|
||||||
|
label = opts[i].text ..(opts[i].txt and " - "..opts[i].txt or ""),
|
||||||
isRequired = opts[i].isRequired,
|
isRequired = opts[i].isRequired,
|
||||||
name = opts[i].name,
|
name = opts[i].name,
|
||||||
options = opts[i].options,
|
options = opts[i].options,
|
||||||
@@ -637,11 +692,11 @@ function createInput(title, opts)
|
|||||||
dialog = exports[OXLibExport]:inputDialog(title, options)
|
dialog = exports[OXLibExport]:inputDialog(title, options)
|
||||||
return dialog
|
return dialog
|
||||||
end
|
end
|
||||||
if Config.Input.Menu == "qb" then
|
if Config.System.Menu == "qb" then
|
||||||
dialog = exports['qb-input']:ShowInput({ header = title, submitText = "Pay", inputs = opts })
|
dialog = exports['qb-input']:ShowInput({ header = title, submitText = "Accept", inputs = opts })
|
||||||
return dialog
|
return dialog
|
||||||
end
|
end
|
||||||
if Config.Input.Menu == "gta" then
|
if Config.System.Menu == "gta" then
|
||||||
WarMenu.CreateMenu(tostring(opts),
|
WarMenu.CreateMenu(tostring(opts),
|
||||||
title,
|
title,
|
||||||
" ",
|
" ",
|
||||||
|
|||||||
Reference in New Issue
Block a user