mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-18 22:36:04 +01:00
fix job crafting breaking and needing grades
This commit is contained in:
@@ -28,7 +28,7 @@ function GetStashTimeout(stashName, stop)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local CraftLock = false
|
local CraftLock = false
|
||||||
function craftingMenu(data)
|
function craftingMenu(data) local hasjob = false
|
||||||
if CraftLock then return end
|
if CraftLock then return end
|
||||||
if data.stashName and not GetStashTimeout(data.stashName) then
|
if data.stashName and not GetStashTimeout(data.stashName) then
|
||||||
--triggerNotify(nil, "Chacking", "success")
|
--triggerNotify(nil, "Chacking", "success")
|
||||||
@@ -40,12 +40,11 @@ function craftingMenu(data)
|
|||||||
for k, v in pairs(Recipes[i]) do
|
for k, v in pairs(Recipes[i]) do
|
||||||
if k ~= "amount" and k ~= "job" and k ~= "gang" then
|
if k ~= "amount" and k ~= "job" and k ~= "gang" then
|
||||||
if Recipes[i].job then hasjob = false
|
if Recipes[i].job then hasjob = false
|
||||||
for l, b in pairs(data.craftable[i]["job"]) do
|
for l, b in pairs(data.craftable.Recipes[i]["job"]) do
|
||||||
hasjob = hasJob(l)
|
hasjob = hasJob(l, nil, b)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local setheader, settext = "", ""
|
local setheader, settext = "", ""
|
||||||
local text = ""
|
|
||||||
local disable = false
|
local disable = false
|
||||||
local checktable = {}
|
local checktable = {}
|
||||||
if Recipes[i].job and hasjob == false then else
|
if Recipes[i].job and hasjob == false then else
|
||||||
|
|||||||
119
wrapper.lua
119
wrapper.lua
@@ -364,6 +364,18 @@ function isOx() return (Config.System.Menu == "ox" or Config.System.Menu == "gta
|
|||||||
|
|
||||||
function isWarMenuOpen() if Config.System.Menu == "gta" then return WarMenu.IsAnyMenuOpened() else return false end end
|
function isWarMenuOpen() if Config.System.Menu == "gta" then return WarMenu.IsAnyMenuOpened() else return false end end
|
||||||
|
|
||||||
|
local TextTargets = {}
|
||||||
|
local Keys = {
|
||||||
|
[322] = "ESC", [288] = "F1", [289] = "F2", [170] = "F3", [166] = "F5",
|
||||||
|
[167] = "F6", [168] = "F7", [169] = "F8", [56] = "F9", [57] = "F10",
|
||||||
|
[243] = "~", [157] = "1", [158] = "2", [160] = "3", [164] = "4", [165] = "5", [159] = "6", [161] = "7", [162] = "8", [163] = "9", [84] = "-", [83] = "=", [177] = "BACKSPACE", [37] = "TAB",
|
||||||
|
[44] = "Q", [32] = "W", [38] = "E", [45] = "R", [245] = "T", [246] = "Y", [303] = "U", [199] = "P",
|
||||||
|
[39] = "[", [40] = "]", [18] = "ENTER", [137] = "CAPS",
|
||||||
|
[34] = "A", [8] = "S", [9] = "D", [23] = "F", [47] = "G",
|
||||||
|
[74] = "H", [311] = "K", [182] = "L", [21] = "LEFTSHIFT",
|
||||||
|
[20] = "Z", [73] = "X", [26] = "C", [0] = "V", [29] = "B", [249] = "N",
|
||||||
|
[244] = "M", [82] = ",", [81] = "."
|
||||||
|
}
|
||||||
-- Targets --
|
-- Targets --
|
||||||
local targetEntities = {}
|
local targetEntities = {}
|
||||||
function createEntityTarget(entity, opts, dist)
|
function createEntityTarget(entity, opts, dist)
|
||||||
@@ -392,6 +404,14 @@ function createEntityTarget(entity, opts, dist)
|
|||||||
end
|
end
|
||||||
local options = { options = opts, distance = dist }
|
local options = { options = opts, distance = dist }
|
||||||
exports[QBTargetExport]:AddTargetEntity(entity, options)
|
exports[QBTargetExport]:AddTargetEntity(entity, options)
|
||||||
|
else
|
||||||
|
local tempText = ""
|
||||||
|
local keyTable = { 38, 29, 303, }
|
||||||
|
for i = 1, #opts do
|
||||||
|
opts[i].key = keyTable[i]
|
||||||
|
tempText = tempText.."~b~["..Keys[opts[i].key].."] ~w~"..opts[i].label.." "
|
||||||
|
end
|
||||||
|
TextTargets[entity] = { coords = GetEntityCoords(entity), buttontext = tempText, options = opts, dist = dist }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -435,6 +455,15 @@ function createBoxTarget(data, opts, dist)
|
|||||||
local target = exports[QBTargetExport]:AddBoxZone(data[1], data[2], data[3], data[4], data[5], options)
|
local target = exports[QBTargetExport]:AddBoxZone(data[1], data[2], data[3], data[4], data[5], options)
|
||||||
boxTargets[#boxTargets+1] = target
|
boxTargets[#boxTargets+1] = target
|
||||||
return target
|
return target
|
||||||
|
else
|
||||||
|
local tempText = ""
|
||||||
|
local keyTable = { 38, 29, 303, }
|
||||||
|
for i = 1, #opts do
|
||||||
|
opts[i].key = keyTable[i]
|
||||||
|
tempText = tempText.."~b~["..Keys[opts[i].key].."] ~w~"..opts[i].label.." "
|
||||||
|
end
|
||||||
|
TextTargets[data[1]] = { coords = data[2], buttontext = tempText, options = opts, dist = dist }
|
||||||
|
return data[1]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -475,17 +504,57 @@ function createCircleTarget(data, opts, dist)
|
|||||||
|
|
||||||
circleTargets[#circleTargets+1] = target
|
circleTargets[#circleTargets+1] = target
|
||||||
return target
|
return target
|
||||||
|
else
|
||||||
|
local tempText = ""
|
||||||
|
local keyTable = { 38, 29, 303, }
|
||||||
|
for i = 1, #opts do
|
||||||
|
opts[i].key = keyTable[i]
|
||||||
|
tempText = tempText.."~b~["..Keys[opts[i].key].."] ~w~"..opts[i].label.." "
|
||||||
|
end
|
||||||
|
TextTargets[data[1]] = { coords = data[2], buttontext = tempText, options = opts, dist = dist }
|
||||||
|
return data[1]
|
||||||
end
|
end
|
||||||
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
|
||||||
|
if not GetResourceState(OXTargetExport):find("start") and not GetResourceState(QBTargetExport):find("start") then
|
||||||
|
TextTargets[entity] = nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function removeZoneTarget(target)
|
function removeZoneTarget(target)
|
||||||
if GetResourceState(QBTargetExport):find("start") then exports[QBTargetExport]:RemoveZone(target) end
|
if GetResourceState(QBTargetExport):find("start") then exports[QBTargetExport]:RemoveZone(target) end
|
||||||
if GetResourceState(OXTargetExport):find("start") then exports[OXTargetExport]:removeZone(target, true) end
|
if GetResourceState(OXTargetExport):find("start") then exports[OXTargetExport]:removeZone(target, true) end
|
||||||
|
if not GetResourceState(OXTargetExport):find("start") and not GetResourceState(QBTargetExport):find("start") then
|
||||||
|
TextTargets[target] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if not GetResourceState(OXTargetExport):find("start") and not GetResourceState(QBTargetExport):find("start") and not IsDuplicityVersion() then
|
||||||
|
CreateThread(function()
|
||||||
|
while true do
|
||||||
|
local pedCoords = GetEntityCoords(PlayerPedId())
|
||||||
|
for k, v in pairs (TextTargets) do
|
||||||
|
if #(pedCoords - v.coords) <= v.dist then
|
||||||
|
DrawText3D(
|
||||||
|
v.coords.x,
|
||||||
|
v.coords.y,
|
||||||
|
v.coords.z + 1.0,
|
||||||
|
v.buttontext
|
||||||
|
)
|
||||||
|
for i = 1, #v.options do
|
||||||
|
if IsControlJustPressed(0, v.options[i].key) then
|
||||||
|
if v.options[i].onSelect then v.options[i].onSelect() end
|
||||||
|
if v.options[i].action then v.options[i].action() end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
Wait(0)
|
||||||
|
end
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
AddEventHandler('onResourceStop', function(r)
|
AddEventHandler('onResourceStop', function(r)
|
||||||
@@ -656,7 +725,6 @@ function createInput(title, opts)
|
|||||||
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",
|
||||||
@@ -676,6 +744,13 @@ function createInput(title, opts)
|
|||||||
options = opts[i].options,
|
options = opts[i].options,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
if opts[i].type == "text" then
|
||||||
|
options[i] = {
|
||||||
|
type = "input",
|
||||||
|
label = opts[i].text ..(opts[i].txt and " - "..opts[i].txt or ""),
|
||||||
|
isRequired = opts[i].isRequired,
|
||||||
|
}
|
||||||
|
end
|
||||||
if opts[i].type == "select" then
|
if opts[i].type == "select" then
|
||||||
options[i] = {
|
options[i] = {
|
||||||
type = "select",
|
type = "select",
|
||||||
@@ -885,7 +960,7 @@ function createUseableItem(item, funct)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function hasJob(job, src) local hasJob = false
|
function hasJob(job, src, grade) local hasJob = false
|
||||||
if src then
|
if src then
|
||||||
if GetResourceState(ESXExport):find("start") then
|
if GetResourceState(ESXExport):find("start") then
|
||||||
local info = ESX.GetPlayerFromId(src).job
|
local info = ESX.GetPlayerFromId(src).job
|
||||||
@@ -905,14 +980,26 @@ function hasJob(job, src) local hasJob = false
|
|||||||
|
|
||||||
elseif GetResourceState(QBXExport):find("start") then
|
elseif GetResourceState(QBXExport):find("start") then
|
||||||
local jobinfo = exports[QBXExport]:GetPlayer(src).PlayerData.job
|
local jobinfo = exports[QBXExport]:GetPlayer(src).PlayerData.job
|
||||||
if jobinfo.name == job then hasJob = true end
|
if jobinfo.name == job then
|
||||||
|
hasJob = true
|
||||||
|
if grade and not jobinfo.grade.level then hasJob = false end
|
||||||
|
end
|
||||||
local ganginfo = exports[QBXExport]:GetPlayer(src).PlayerData.gang
|
local ganginfo = exports[QBXExport]:GetPlayer(src).PlayerData.gang
|
||||||
if ganginfo.name == job then hasJob = true end
|
if ganginfo.name == job then
|
||||||
|
hasJob = true
|
||||||
|
if grade and not ganginfo.grade.level then hasJob = false end
|
||||||
|
end
|
||||||
else
|
else
|
||||||
local jobinfo = exports[QBExport]:GetPlayer(src).PlayerData.job
|
local jobinfo = exports[QBExport]:GetPlayer(src).PlayerData.job
|
||||||
if jobinfo.name == job then hasJob = true end
|
if jobinfo.name == job then
|
||||||
|
hasJob = true
|
||||||
|
if grade and not jobinfo.grade.level then hasJob = false end
|
||||||
|
end
|
||||||
local ganginfo = exports[QBExport]:GetPlayer(src).PlayerData.gang
|
local ganginfo = exports[QBExport]:GetPlayer(src).PlayerData.gang
|
||||||
if ganginfo.name == job then hasJob = true end
|
if ganginfo.name == job then
|
||||||
|
hasJob = true
|
||||||
|
if grade and not ganginfo.grade.level then hasJob = false end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if GetResourceState(ESXExport):find("start") then
|
if GetResourceState(ESXExport):find("start") then
|
||||||
@@ -931,18 +1018,30 @@ function hasJob(job, src) local hasJob = false
|
|||||||
|
|
||||||
elseif GetResourceState(QBXExport):find("start") then
|
elseif GetResourceState(QBXExport):find("start") then
|
||||||
local jobinfo = QBX.PlayerData.job
|
local jobinfo = QBX.PlayerData.job
|
||||||
if jobinfo.name == job then hasJob = true end
|
if jobinfo.name == job then
|
||||||
|
hasJob = true
|
||||||
|
if grade and not jobinfo.grade.level then hasJob = false end
|
||||||
|
end
|
||||||
local ganginfo = QBX.PlayerData.gang
|
local ganginfo = QBX.PlayerData.gang
|
||||||
if ganginfo.name == job then hasJob = true end
|
if ganginfo.name == job then
|
||||||
|
hasJob = true
|
||||||
|
if grade and not ganginfo.grade.level then hasJob = false end
|
||||||
|
end
|
||||||
else
|
else
|
||||||
local info = nil
|
local info = nil
|
||||||
Core.Functions.GetPlayerData(function(PlayerData)
|
Core.Functions.GetPlayerData(function(PlayerData)
|
||||||
info = PlayerData
|
info = PlayerData
|
||||||
end)
|
end)
|
||||||
local jobinfo = info.job
|
local jobinfo = info.job
|
||||||
if jobinfo.name == job then hasJob = true end
|
if jobinfo.name == job then
|
||||||
|
hasJob = true
|
||||||
|
if grade and not jobinfo.grade.level then hasJob = false end
|
||||||
|
end
|
||||||
local ganginfo = info.gang
|
local ganginfo = info.gang
|
||||||
if ganginfo.name == job then hasJob = true end
|
if ganginfo.name == job then
|
||||||
|
hasJob = true
|
||||||
|
if grade and not ganginfo.grade.level then hasJob = false end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return hasJob
|
return hasJob
|
||||||
|
|||||||
Reference in New Issue
Block a user