forked from Simnation/Main
fix
This commit is contained in:
parent
755cf22c53
commit
2c2060cdc6
1 changed files with 98 additions and 54 deletions
|
@ -73,8 +73,24 @@ function openBank()
|
||||||
QBCore.Functions.TriggerCallback("okokBanking:GetPlayerInfo", function(data)
|
QBCore.Functions.TriggerCallback("okokBanking:GetPlayerInfo", function(data)
|
||||||
QBCore.Functions.TriggerCallback("okokBanking:GetOverviewTransactions", function(cb, identifier, allDays)
|
QBCore.Functions.TriggerCallback("okokBanking:GetOverviewTransactions", function(cb, identifier, allDays)
|
||||||
for k,v in pairs(Config.Societies) do
|
for k,v in pairs(Config.Societies) do
|
||||||
if playerJobName == v then
|
if playerJobName == v then
|
||||||
|
-- Check if job has configuration in JobBossRanks
|
||||||
|
if Config.JobBossRanks and Config.JobBossRanks[playerJobName] then
|
||||||
|
-- Check for specific ranks first
|
||||||
|
if Config.JobBossRanks[playerJobName].specificRanks and #Config.JobBossRanks[playerJobName].specificRanks > 0 then
|
||||||
|
for _, rank in ipairs(Config.JobBossRanks[playerJobName].specificRanks) do
|
||||||
|
if playeJob.grade.level == rank then
|
||||||
|
canAccessSociety = true
|
||||||
|
print("Boss access granted for " .. playerJobName .. " with specific rank " .. rank)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- If not already granted access and maxRank is enabled, check for highest rank
|
||||||
|
if not canAccessSociety and Config.JobBossRanks[playerJobName].maxRank then
|
||||||
-- Get all job grades for this job
|
-- Get all job grades for this job
|
||||||
|
if QBCore.Shared.Jobs[playerJobName] and QBCore.Shared.Jobs[playerJobName].grades then
|
||||||
local jobGrades = QBCore.Shared.Jobs[playerJobName].grades
|
local jobGrades = QBCore.Shared.Jobs[playerJobName].grades
|
||||||
local highestRank = -1
|
local highestRank = -1
|
||||||
|
|
||||||
|
@ -93,10 +109,38 @@ if playerJobName == v then
|
||||||
else
|
else
|
||||||
print("Not highest rank for " .. playerJobName .. ", current rank: " .. playeJob.grade.level .. ", highest: " .. highestRank)
|
print("Not highest rank for " .. playerJobName .. ", current rank: " .. playeJob.grade.level .. ", highest: " .. highestRank)
|
||||||
end
|
end
|
||||||
elseif playerGangName == v then
|
end
|
||||||
-- Similar logic for gangs if needed
|
end
|
||||||
end
|
else
|
||||||
|
-- Fallback to original highest rank check if no configuration exists
|
||||||
|
if QBCore.Shared.Jobs[playerJobName] and QBCore.Shared.Jobs[playerJobName].grades then
|
||||||
|
local jobGrades = QBCore.Shared.Jobs[playerJobName].grades
|
||||||
|
local highestRank = -1
|
||||||
|
|
||||||
|
-- Find the highest rank number
|
||||||
|
for grade, _ in pairs(jobGrades) do
|
||||||
|
local gradeNum = tonumber(grade)
|
||||||
|
if gradeNum and gradeNum > highestRank then
|
||||||
|
highestRank = gradeNum
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Check if player has the highest rank
|
||||||
|
if playeJob.grade.level == highestRank then
|
||||||
|
canAccessSociety = true
|
||||||
|
print("Boss access granted for " .. playerJobName .. " with highest rank " .. highestRank)
|
||||||
|
else
|
||||||
|
print("Not highest rank for " .. playerJobName .. ", current rank: " .. playeJob.grade.level .. ", highest: " .. highestRank)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elseif playerGangName == v then
|
||||||
|
if data.isBossGang == true then
|
||||||
|
jobLabel = playerGangName
|
||||||
|
society = playerGangName
|
||||||
|
canAccessSociety = true
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if canAccessSociety then
|
if canAccessSociety then
|
||||||
|
@ -597,8 +641,6 @@ AddEventHandler("okokBanking:OpenATM", function(pin)
|
||||||
})
|
})
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RegisterNUICallback("action", function(data, cb)
|
RegisterNUICallback("action", function(data, cb)
|
||||||
if data.action == "close" then
|
if data.action == "close" then
|
||||||
isBankOpened = false
|
isBankOpened = false
|
||||||
|
@ -843,6 +885,7 @@ RegisterNUICallback("action", function(data, cb)
|
||||||
cb('ok')
|
cb('ok')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
RegisterNetEvent("okokBanking:updateTransactions")
|
RegisterNetEvent("okokBanking:updateTransactions")
|
||||||
AddEventHandler("okokBanking:updateTransactions", function(money, wallet)
|
AddEventHandler("okokBanking:updateTransactions", function(money, wallet)
|
||||||
Wait(100)
|
Wait(100)
|
||||||
|
@ -931,3 +974,4 @@ AddEventHandler("okokBanking:updateTransactionsSociety", function(wallet)
|
||||||
end, society)
|
end, society)
|
||||||
end, society)
|
end, society)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue