Deattach from QBcore object

This commit is contained in:
Mitroxs
2021-12-03 18:25:00 +01:00
parent b9712a0fe5
commit 315f70600d
+8 -8
View File
@@ -108,15 +108,15 @@ function QBCore.Functions.GetDutyCount(job)
end
--- Routingbucket stuff (Only touch if you know what you are doing)
_G.QBCore.Player_Buckets = {} -- Bucket array containing all players that have been set to a different bucket
_G.QBCore.Entity_Buckets = {} -- Bucket array containing all entities that have been set to a different bucket
_G.Player_Buckets = {} -- Bucket array containing all players that have been set to a different bucket
_G.Entity_Buckets = {} -- Bucket array containing all entities that have been set to a different bucket
--- Will set the provided player id / source into the provided bucket id
function QBCore.Functions.SetPlayerBucket(player_source --[[int]],bucket --[[int]])
if player_source and bucket then
local plicense = QBCore.Functions.GetIdentifier(player, 'license')
SetPlayerRoutingBucket(player_source, bucket)
_G.QBCore.Player_Buckets[plicense] = {player_id = player_source, player_bucket = bucket}
_G.Player_Buckets[plicense] = {player_id = player_source, player_bucket = bucket}
return true
else
return false
@@ -127,7 +127,7 @@ end
function QBCore.Functions.SetEntityBucket(entity --[[int]],bucket --[[int]])
if entity and bucket then
SetEntityRoutingBucket(entity, bucket)
_G.QBCore.Entity_Buckets[entity] = {entity_id = entity, entity_bucket = bucket}
_G.Entity_Buckets[entity] = {entity_id = entity, entity_bucket = bucket}
return true
else
return false
@@ -138,8 +138,8 @@ end
-- Will return an array of all the player ids inside the current bucket
function QBCore.Functions.GetPlayersInBucket(bucket --[[int]])
local curr_bucket_pool = {}
if _G.QBCore.Player_Buckets ~= nil then
for k, v in pairs(_G.QBCore.Player_Buckets) do
if _G.Player_Buckets ~= nil then
for k, v in pairs(_G.Player_Buckets) do
if k['player_bucket'] == bucket then
curr_bucket_pool[#curr_bucket_pool + 1] = k['player_id']
end
@@ -154,8 +154,8 @@ end
--- Will return an array of all the entities inside the current bucket (Not player entities , use GetPlayersInBucket for that)
function QBCore.Functions.GetEntitiesInBucket(bucket --[[int]])
local curr_bucket_pool = {}
if _G.QBCore.Entity_Buckets ~= nil then
for k, v in pairs(_G.QBCore.Entity_Buckets) do
if _G.Entity_Buckets ~= nil then
for k, v in pairs(_G.Entity_Buckets) do
if k['entity_bucket'] == bucket then
curr_bucket_pool[#curr_bucket_pool + 1] = k['entity_id']
end