Untitled

 avatar
unknown
plain_text
9 months ago
1.9 kB
4
Indexable
hook.Add("PostDrawHUD", "SH_SZ.RenderScreenspaceEffects", function()
    local mKos = SH_SZ.m_Kos

    if not mKos or not mKos.opts.kosplyind then
        return
    end

    local kosZoneEntID = LocalPlayer():GetNWInt("SH_SZ.KosZone", -1)
    local kosZoneEnt = Entity(kosZoneEntID)

    if kosZoneEntID == -1 and not (kosZoneEnt:IsValid() and kosZoneEnt.m_Options) then
        return
    end

    local bossPresent = false
    for _, ent in pairs(ents.FindByClass("zpn_boss")) do
        if IsValid(ent) then
            bossPresent = true
            break
        end
    end

    cam.Start3D()
        render.SuppressEngineLighting(true)
        for _, ply in pairs(player.GetAll()) do
            if IsValid(ply) and ply ~= LocalPlayer() then
                local plyInKos = ply:GetNWInt("SH_SZ.KosZone", -1)

                if plyInKos == -1 then
                    ply:SetColor(Color(255, 255, 255, 255))
                    ply:SetMaterial("")
                    continue
                end

                local sameKosZone = SH_SZ.KosConfig.SameZone and plyInKos == kosZoneEntID or true
                if not sameKosZone or not ply:Alive() then
                    continue
                end

                local col = mKos.opts.kosplyindcol or Color(255, 255, 255, 255)

                -- Check if boss is present in zone 1999 and set player color accordingly
                if bossPresent and kosZoneEntID == 1999 then
                    col = Color(0, 255, 0)  -- Green color
                end

                render.MaterialOverride(matOverride)
                render.SetColorModulation(col.r / 255, col.g / 255, col.b / 255)
                ply:DrawModel()
            end
        end
        render.SuppressEngineLighting(false)
        render.SetColorModulation(1, 1, 1)
        render.MaterialOverride()
    cam.End3D()
end)
Editor is loading...
Leave a Comment