From d5c59f1355afdf854e10e98194d53991b401b73f Mon Sep 17 00:00:00 2001 From: HC DEV <36608116+ArturMichalak@users.noreply.github.com> Date: Sun, 12 May 2024 02:54:01 +0200 Subject: [PATCH] fix: entitiesblacklist feat: disable itempickup and entitiesblacklist on empty config --- qbx_entitiesblacklist/config.json | 55 ------------------------------- qbx_entitiesblacklist/config.lua | 55 +++++++++++++++++++++++++++++++ qbx_entitiesblacklist/server.lua | 4 +-- qbx_itempickup/client.lua | 2 ++ 4 files changed, 59 insertions(+), 57 deletions(-) delete mode 100644 qbx_entitiesblacklist/config.json create mode 100644 qbx_entitiesblacklist/config.lua diff --git a/qbx_entitiesblacklist/config.json b/qbx_entitiesblacklist/config.json deleted file mode 100644 index eb0edfe..0000000 --- a/qbx_entitiesblacklist/config.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "blacklisted": { - "SHAMAL": true, - "LUXOR": true, - "LUXOR2": true, - "JET": true, - "LAZER": true, - "BUZZARD": true, - "BUZZARD2": true, - "ANNIHILATOR": true, - "SAVAGE": true, - "TITAN": true, - "RHINO": true, - "FIRETRUK": true, - "MULE": true, - "MAVERICK": true, - "BLIMP": true, - "AIRTUG": true, - "CAMPER": true, - "HYDRA": true, - "OPPRESSOR": true, - "technical3": true, - "insurgent3": true, - "apc": true, - "tampa3": true, - "trailersmall2": true, - "halftrack": true, - "hunter": true, - "vigilante": true, - "akula": true, - "barrage": true, - "khanjali": true, - "caracara": true, - "blimp3": true, - "menacer": true, - "oppressor2": true, - "scramjet": true, - "strikeforce": true, - "cerberus": true, - "cerberus2": true, - "cerberus3": true, - "scarab": true, - "scarab2": true, - "scarab3": true, - "rrocket": true, - "ruiner2": true, - "deluxo": true, - "s_m_y_ranger_01": true, - "s_m_y_sheriff_01": true, - "s_m_y_cop_01": true, - "s_f_y_sheriff_01": true, - "s_f_y_cop_01": true, - "s_m_y_hwaycop_01": true - } -} diff --git a/qbx_entitiesblacklist/config.lua b/qbx_entitiesblacklist/config.lua new file mode 100644 index 0000000..b664294 --- /dev/null +++ b/qbx_entitiesblacklist/config.lua @@ -0,0 +1,55 @@ +return { + blacklisted = { + [`SHAMAL`] = true, + [`LUXOR`] = true, + [`LUXOR2`] = true, + [`JET`] = true, + [`LAZER`] = true, + [`BUZZARD`] = true, + [`BUZZARD2`] = true, + [`ANNIHILATOR`] = true, + [`SAVAGE`] = true, + [`TITAN`] = true, + [`RHINO`] = true, + [`FIRETRUK`] = true, + [`MULE`] = true, + [`MAVERICK`] = true, + [`BLIMP`] = true, + [`AIRTUG`] = true, + [`CAMPER`] = true, + [`HYDRA`] = true, + [`OPPRESSOR`] = true, + [`technical3`] = true, + [`insurgent3`] = true, + [`apc`] = true, + [`tampa3`] = true, + [`trailersmall2`] = true, + [`halftrack`] = true, + [`hunter`] = true, + [`vigilante`] = true, + [`akula`] = true, + [`barrage`] = true, + [`khanjali`] = true, + [`caracara`] = true, + [`blimp3`] = true, + [`menacer`] = true, + [`oppressor2`] = true, + [`scramjet`] = true, + [`strikeforce`] = true, + [`cerberus`] = true, + [`cerberus2`] = true, + [`cerberus3`] = true, + [`scarab`] = true, + [`scarab2`] = true, + [`scarab3`] = true, + [`rrocket`] = true, + [`ruiner2`] = true, + [`deluxo`] = true, + [`s_m_y_ranger_01`] = true, + [`s_m_y_sheriff_01`] = true, + [`s_m_y_cop_01`] = true, + [`s_f_y_sheriff_01`] = true, + [`s_f_y_cop_01`] = true, + [`s_m_y_hwaycop_01`] = true + } +} diff --git a/qbx_entitiesblacklist/server.lua b/qbx_entitiesblacklist/server.lua index d749655..b64f11e 100644 --- a/qbx_entitiesblacklist/server.lua +++ b/qbx_entitiesblacklist/server.lua @@ -1,8 +1,8 @@ -local config = lib.loadJson('qbx_entitiesblacklist.config') +local config = require 'qbx_entitiesblacklist.config' local bucketLockDownMode = GetConvar('qbx:bucketlockdownmode', 'relaxed') -- If you want to blacklist peds and vehicles from certaiin locations utilize Car gens ymaps as done in streams/car_gen_disablers, as entityCreating handler is very expensive compared to ymap. -if bucketLockDownMode == 'inactive' then return end +if bucketLockDownMode == 'inactive' or #config.blacklisted == 0 then return end -- Blacklisting entities can just be handled entirely server side with onesync events -- No need to run coroutines to supress or delete these when we can simply delete them before they spawn diff --git a/qbx_itempickup/client.lua b/qbx_itempickup/client.lua index 380c1dd..db548c8 100644 --- a/qbx_itempickup/client.lua +++ b/qbx_itempickup/client.lua @@ -1,5 +1,7 @@ local config = lib.loadJson('qbx_itempickup.config') +if #config.disabledPickups == 0 then return end + CreateThread(function() for _, hash in ipairs(config.disabledPickups) do ToggleUsePickupsForPlayer(cache.playerId, hash, false)