1
0
mirror of https://github.com/CFC-Servers/cfc_chip_lister.git synced 2025-03-04 03:03:14 -05:00

Still check for players using the HUD even if no lister ents are spawned (#12)

* Still check for players using the HUD even if no lister ents are spawned

* Clarity
This commit is contained in:
legokidlogan 2024-03-25 10:16:50 -06:00 committed by GitHub
parent 75c6ccb1a7
commit 551f5c5c99
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -115,9 +115,11 @@ local function isPlateVisible( ent, ply )
end
-- Can a player see at least one chip lister?
-- Give listers as false to only check for the HUD setting (i.e. no lister entities exist).
local function canSeeALister( ply, listers )
if not IsValid( ply ) then return false end
if ply:GetInfoNum( "cfc_chiplister_hud_persist", 0 ) == 1 then return true end
if not listers then return false end
local aimEnt = ply:GetEyeTrace().Entity
if IsValid( aimEnt ) and aimEnt:GetClass() == "cfc_chip_lister" then return true end
@ -134,7 +136,10 @@ local function getVisibleListUsers()
if listUserCount == 0 then return {}, 0 end
local listers = ents.FindByClass( "cfc_chip_lister" )
if #listers == 0 then return {}, 0 end
if #listers == 0 then
listers = false
end
local visibleUsers = {}
local visibleUserCount = 0