mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-19 06:46:04 +01:00
return duty check for hasJob
This commit is contained in:
23
wrapper.lua
23
wrapper.lua
@@ -560,12 +560,7 @@ if not GetResourceState(OXTargetExport):find("start") and not GetResourceState(Q
|
|||||||
local pedCoords = GetEntityCoords(PlayerPedId())
|
local pedCoords = GetEntityCoords(PlayerPedId())
|
||||||
for k, v in pairs (TextTargets) do
|
for k, v in pairs (TextTargets) do
|
||||||
if #(pedCoords - v.coords) <= v.dist then
|
if #(pedCoords - v.coords) <= v.dist then
|
||||||
DrawText3D(
|
DrawText3D(v.coords.x, v.coords.y, v.coords.z + 1.0, v.buttontext)
|
||||||
v.coords.x,
|
|
||||||
v.coords.y,
|
|
||||||
v.coords.z + 1.0,
|
|
||||||
v.buttontext
|
|
||||||
)
|
|
||||||
for i = 1, #v.options do
|
for i = 1, #v.options do
|
||||||
if IsControlJustPressed(0, v.options[i].key) then
|
if IsControlJustPressed(0, v.options[i].key) then
|
||||||
if v.options[i].onSelect then v.options[i].onSelect() end
|
if v.options[i].onSelect then v.options[i].onSelect() end
|
||||||
@@ -740,7 +735,6 @@ function onPlayerLoaded(func)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- INPUT --
|
-- INPUT --
|
||||||
function createInput(title, opts)
|
function createInput(title, opts)
|
||||||
local dialog = nil
|
local dialog = nil
|
||||||
@@ -990,7 +984,7 @@ function createUseableItem(item, funct)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function hasJob(job, source, grade) local hasJob = false
|
function hasJob(job, source, grade) local hasJob, duty = false, true
|
||||||
if source then
|
if source then
|
||||||
local src = tonumber(source)
|
local src = tonumber(source)
|
||||||
if GetResourceState(ESXExport):find("start") then
|
if GetResourceState(ESXExport):find("start") then
|
||||||
@@ -1012,16 +1006,19 @@ function hasJob(job, source, grade) 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
|
if jobinfo.name == job then hasJob = true
|
||||||
|
duty = exports[QBXExport]:GetPlayer(src).PlayerData.job.onduty
|
||||||
if grade and not (grade <= jobinfo.grade.level) then hasJob = false end
|
if grade and not (grade <= jobinfo.grade.level) then hasJob = false end
|
||||||
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
|
if ganginfo.name == job then hasJob = true
|
||||||
if grade and not (grade <= ganginfo.grade.level) then hasJob = false end
|
if grade and not (grade <= ganginfo.grade.level) then hasJob = false end
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif GetResourceState(QBExport):find("start") and not GetResourceState(QBXExport):find("start") then
|
elseif GetResourceState(QBExport):find("start") and not GetResourceState(QBXExport):find("start") then
|
||||||
if Core.Functions.GetPlayer then -- support older qb-core functions
|
if Core.Functions.GetPlayer then -- support older qb-core functions
|
||||||
local jobinfo = Core.Functions.GetPlayer(src).PlayerData.job
|
local jobinfo = Core.Functions.GetPlayer(src).PlayerData.job
|
||||||
if jobinfo.name == job then hasJob = true
|
if jobinfo.name == job then hasJob = true
|
||||||
|
duty = Core.Functions.GetPlayer(src).PlayerData.job.onduty
|
||||||
if grade and not (grade <= jobinfo.grade.level) then hasJob = false end
|
if grade and not (grade <= jobinfo.grade.level) then hasJob = false end
|
||||||
end
|
end
|
||||||
local ganginfo = Core.Functions.GetPlayer(src).PlayerData.gang
|
local ganginfo = Core.Functions.GetPlayer(src).PlayerData.gang
|
||||||
@@ -1031,6 +1028,7 @@ function hasJob(job, source, grade) local hasJob = false
|
|||||||
else -- support newer qb-core exports
|
else -- support newer qb-core exports
|
||||||
local jobinfo = exports[QBExport]:GetPlayer(src).PlayerData.job
|
local jobinfo = exports[QBExport]:GetPlayer(src).PlayerData.job
|
||||||
if jobinfo.name == job then hasJob = true
|
if jobinfo.name == job then hasJob = true
|
||||||
|
duty = exports[QBExport]:GetPlayer(src).PlayerData.job.onduty
|
||||||
if grade and not (grade <= jobinfo.grade.level) then hasJob = false end
|
if grade and not (grade <= jobinfo.grade.level) then hasJob = false end
|
||||||
end
|
end
|
||||||
local ganginfo = exports[QBExport]:GetPlayer(src).PlayerData.gang
|
local ganginfo = exports[QBExport]:GetPlayer(src).PlayerData.gang
|
||||||
@@ -1059,6 +1057,7 @@ function hasJob(job, source, grade) 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
|
if jobinfo.name == job then hasJob = true
|
||||||
|
duty = QBX.PlayerData.job.onduty
|
||||||
if grade and not (grade <= jobinfo.grade.level) then hasJob = false end
|
if grade and not (grade <= jobinfo.grade.level) then hasJob = false end
|
||||||
end
|
end
|
||||||
local ganginfo = QBX.PlayerData.gang
|
local ganginfo = QBX.PlayerData.gang
|
||||||
@@ -1071,8 +1070,8 @@ function hasJob(job, source, grade) local hasJob = false
|
|||||||
info = PlayerData
|
info = PlayerData
|
||||||
end)
|
end)
|
||||||
local jobinfo = info.job
|
local jobinfo = info.job
|
||||||
if jobinfo.name == job then
|
if jobinfo.name == job then hasJob = true
|
||||||
hasJob = true
|
duty = jobinfo.onduty
|
||||||
if grade and not (grade <= jobinfo.grade.level) then hasJob = false end
|
if grade and not (grade <= jobinfo.grade.level) then hasJob = false end
|
||||||
end
|
end
|
||||||
local ganginfo = info.gang
|
local ganginfo = info.gang
|
||||||
@@ -1084,7 +1083,7 @@ function hasJob(job, source, grade) local hasJob = false
|
|||||||
print("^4ERROR^7: ^2No Core detected for hasJob() ^7- ^2Check ^3exports^1.^2lua^7")
|
print("^4ERROR^7: ^2No Core detected for hasJob() ^7- ^2Check ^3exports^1.^2lua^7")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return hasJob
|
return hasJob, duty
|
||||||
end
|
end
|
||||||
|
|
||||||
function getPlayer(source) local Player = {}
|
function getPlayer(source) local Player = {}
|
||||||
@@ -1214,4 +1213,4 @@ function registerStash(name, label)
|
|||||||
exports[QSInv]:RegisterStash(name, 50, 4000000)
|
exports[QSInv]:RegisterStash(name, 50, 4000000)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- IN NO WAY PERFECT --
|
-- IN NO WAY PERFECT --
|
||||||
Reference in New Issue
Block a user