1. Sign up for news, events and more!

    You're currently visiting the official DarkRP Forums as a guest. Sign up now to participate in our community and we'll let you know when we have news.

Help with overlay

Discussion in 'DarkRP Modding Questions & Help' started by Ozor, Oct 4, 2017.

  1. Ozor

    Ozor New Member

    I want to make the overlay work CP.
    Here is the code.
    local lastTexture, mat_Overlay = nil, nil

    local function DrawMaterialOverlay2(texture, refractamount)
    if (texture ~= lastTexture or mat_Overlay == nil) then
    mat_Overlay = Material(texture)
    lastTexture = texture
    end

    if (mat_Overlay == nil or mat_Overlay:IsError()) then return end
    render.UpdateScreenEffectTexture()
    -- FIXME: Changing refract amount affects textures used in the map/models.
    mat_Overlay:SetFloat("$envmap", 0)
    mat_Overlay:SetFloat("$envmaptint", 0)
    mat_Overlay:SetFloat("$refractamount", refractamount)
    mat_Overlay:SetInt("$ignorez", 1)
    render.SetMaterial(mat_Overlay)
    render.DrawScreenQuad()
    end

    local jobs = {
    [TEAM_CPRCT] = true,
    [TEAM_CPMED] = true
    }

    local function DrawInternal2()
    local lp = LocalPlayer()
    if (not IsValid(lp)) then return end
    local overlay = "effects/combine_binocoverlay"

    if jobs[lp:Team()] then
    DrawMaterialOverlay2(overlay, 0.3)
    end
    end

    hook.Add("RenderScreenspaceEffects", "RenderMaterialOverlay", DrawInternal2)
     

Share This Page