Skip to content

Commit

Permalink
feat(entityCreating): Only load if clients can spawn networked entities
Browse files Browse the repository at this point in the history
* feat(entityCreating): Only load if clients can spawn networked entities

* add comment
  • Loading branch information
FjamZoo authored Nov 30, 2023
1 parent 78822af commit 7da5017
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion server/entities.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
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

-- 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
AddEventHandler('entityCreating', function(handle)
Expand All @@ -6,4 +11,4 @@ AddEventHandler('entityCreating', function(handle)
if Config.BlacklistedVehs[entityModel] or Config.BlacklistedPeds[entityModel] then
CancelEvent()
end
end)
end)

0 comments on commit 7da5017

Please sign in to comment.