mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-17 05:56:02 +01:00
add support for older QBCore GetPlayer event
This commit is contained in:
40
wrapper.lua
40
wrapper.lua
@@ -960,8 +960,9 @@ function createUseableItem(item, funct)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function hasJob(job, src, grade) local hasJob = false
|
function hasJob(job, source, grade) local hasJob = false
|
||||||
if src then
|
if source then
|
||||||
|
local src = tonumber(source)
|
||||||
if GetResourceState(ESXExport):find("start") then
|
if GetResourceState(ESXExport):find("start") then
|
||||||
local info = ESX.GetPlayerFromId(src).job
|
local info = ESX.GetPlayerFromId(src).job
|
||||||
while not info do
|
while not info do
|
||||||
@@ -989,16 +990,31 @@ function hasJob(job, src, grade) local hasJob = false
|
|||||||
hasJob = true
|
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
|
||||||
else
|
elseif GetResourceState(QBExport):find("start") and not GetResourceState(QBXExport):find("start") then
|
||||||
local jobinfo = exports[QBExport]:GetPlayer(src).PlayerData.job
|
if Core.Functions.GetPlayer ~= nil then -- support older qb-core
|
||||||
if jobinfo.name == job then
|
local Player = Core.Functions.GetPlayer(src).PlayerData
|
||||||
hasJob = true
|
|
||||||
if grade and not (grade <= jobinfo.grade.level) then hasJob = false end
|
local jobinfo = Player.job
|
||||||
end
|
if jobinfo.name == job then
|
||||||
local ganginfo = exports[QBExport]:GetPlayer(src).PlayerData.gang
|
hasJob = true
|
||||||
if ganginfo.name == job then
|
if grade and not (grade <= jobinfo.grade.level) then hasJob = false end
|
||||||
hasJob = true
|
end
|
||||||
if grade and not (grade <= ganginfo.grade.level) then hasJob = false end
|
local ganginfo = Player.gang
|
||||||
|
if ganginfo.name == job then
|
||||||
|
hasJob = true
|
||||||
|
if grade and not (grade <= ganginfo.grade.level) then hasJob = false end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
local jobinfo = Core.Functions.GetPlayer(src).PlayerData.job
|
||||||
|
if jobinfo.name == job then
|
||||||
|
hasJob = true
|
||||||
|
if grade and not (grade <= jobinfo.grade.level) then hasJob = false end
|
||||||
|
end
|
||||||
|
local ganginfo = Core.Functions.GetPlayer(src).PlayerData.gang
|
||||||
|
if ganginfo.name == job then
|
||||||
|
hasJob = true
|
||||||
|
if grade and not (grade <= ganginfo.grade.level) then hasJob = false end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user