[OPEN SOURCE]
local function clamp(v, min, max) local num = v; num = num < min and min or num; num = num > max and max or num; return num end
local function linear(t, b, c, d) return c * t / d + b end
local function SetTableVisibility(table, state) for i = 1, #table do table[i]:SetVisible(state) end end
local m_alpha = 0
local remove_scope, master_switch, color_picker, overlay_position, overlay_offset, fade_time =
Menu.FindVar("Visuals", "View", "Camera", "Remove Scope"),
Menu.Switch("Custom scope", "Custom scope lines", false),
Menu.ColorEdit("Setting LUA", "Scope lines color", Color.new(0.0, 0.0, 0.0, 1.0)),
Menu.SliderInt("Custom scope", "Lines Initial Pos", 15, 0, 500),
Menu.SliderInt("Custom scope", "Lines Offset", 190, 0, 500),
Menu.SliderInt("Setting LUA", "Animation Speed", 12, 3, 20)
local cache_remove_scope = remove_scope:Get()
function loh_scope()
remove_scope:Set(master_switch:Get() and 2 or cache_remove_scope)
SetTableVisibility({color_picker, overlay_position, overlay_offset, fade_time}, master_switch:Get())
if not master_switch:Get() then return end
local localplayer = EntityList.GetClientEntity(EngineClient.GetLocalPlayer())
if not localplayer then return end
if localplayer:GetProp("DT_BasePlayer", "m_iHealth") > 0 then
local screen_size = EngineClient.GetScreenSize()
local width, height = screen_size.x, screen_size.y
local offset, initial_position, speed, color =
overlay_offset:Get() * screen_size.y / 1080,
overlay_position:Get() * screen_size.y / 1080,
fade_time:Get(),
color_picker:GetColor()
local me = localplayer:GetPlayer()
local wpn = me:GetActiveWeapon()
local scope_level, scoped, resume_zoom =
wpn:GetProp("m_zoomLevel"),
me:GetProp("m_bIsScoped"),
me:GetProp("m_bResumeZoom")
local act = wpn ~= nil and scope_level ~= nil and scope_level > 0 and scoped and not resume_zoom
local FT = speed > 3 and GlobalVars.frametime * speed or 1
local alpha = linear(m_alpha, 0, 1, 1)
Render.GradientBoxFilled(Vector2.new(width / 2 - initial_position + 2, height / 2), Vector2.new(width / 2 + 2 - offset, height / 2 + 1), Color.new(color.r, color.g, color.b, color.a * alpha), Color.new(color.r, color.g, color.b, 0), Color.new(color.r, color.g, color.b, color.a * alpha), Color.new(color.r, color.g, color.b, 0)) -- LEFT
Render.GradientBoxFilled(Vector2.new(width / 2 + offset, height / 2), Vector2.new(width / 2 + initial_position, height / 2 + 1), Color.new(color.r, color.g, color.b, 0), Color.new(color.r, color.g, color.b, color.a * alpha), Color.new(color.r, color.g, color.b, 0), Color.new(color.r, color.g, color.b, color.a * alpha)) -- RIGHT
Render.GradientBoxFilled(Vector2.new(width / 2, height / 2 - initial_position + 2), Vector2.new(width / 2 + 1, height / 2 + 2 - offset), Color.new(color.r, color.g, color.b, color.a * alpha), Color.new(color.r, color.g, color.b, color.a * alpha), Color.new(color.r, color.g, color.b, 0), Color.new(color.r, color.g, color.b, 0)) -- TOP
Render.GradientBoxFilled(Vector2.new(width / 2, height / 2 + offset), Vector2.new(width / 2 + 1, height / 2 + initial_position), Color.new(color.r, color.g, color.b, 0), Color.new(color.r, color.g, color.b, 0), Color.new(color.r, color.g, color.b, color.a * alpha), Color.new(color.r, color.g, color.b, color.a * alpha))
m_alpha = clamp(m_alpha + (act and FT or -FT), 0, 1)
end
end
Cheat.RegisterCallback("draw", loh_scope)
Cheat.RegisterCallback("destroy", function()
remove_scope:Set(cache_remove_scope)
end)
everything works, thanksLua:local function clamp(v, min, max) local num = v; num = num < min and min or num; num = num > max and max or num; return num end local function linear(t, b, c, d) return c * t / d + b end local function SetTableVisibility(table, state) for i = 1, #table do table[i]:SetVisible(state) end end local m_alpha = 0 local remove_scope, master_switch, color_picker, overlay_position, overlay_offset, fade_time = Menu.FindVar("Visuals", "View", "Camera", "Remove Scope"), Menu.Switch("Custom scope", "Custom scope lines", false), Menu.ColorEdit("Setting LUA", "Scope lines color", Color.new(0.0, 0.0, 0.0, 1.0)), Menu.SliderInt("Custom scope", "Lines Initial Pos", 15, 0, 500), Menu.SliderInt("Custom scope", "Lines Offset", 190, 0, 500), Menu.SliderInt("Setting LUA", "Animation Speed", 12, 3, 20) local cache_remove_scope = remove_scope:Get() function loh_scope() remove_scope:Set(master_switch:Get() and 2 or cache_remove_scope) SetTableVisibility({color_picker, overlay_position, overlay_offset, fade_time}, master_switch:Get()) if not master_switch:Get() then return end local localplayer = EntityList.GetClientEntity(EngineClient.GetLocalPlayer()) if not localplayer then return end if localplayer:GetProp("DT_BasePlayer", "m_iHealth") > 0 then local screen_size = EngineClient.GetScreenSize() local width, height = screen_size.x, screen_size.y local offset, initial_position, speed, color = overlay_offset:Get() * screen_size.y / 1080, overlay_position:Get() * screen_size.y / 1080, fade_time:Get(), color_picker:GetColor() local me = localplayer:GetPlayer() local wpn = me:GetActiveWeapon() local scope_level, scoped, resume_zoom = wpn:GetProp("m_zoomLevel"), me:GetProp("m_bIsScoped"), me:GetProp("m_bResumeZoom") local act = wpn ~= nil and scope_level ~= nil and scope_level > 0 and scoped and not resume_zoom local FT = speed > 3 and GlobalVars.frametime * speed or 1 local alpha = linear(m_alpha, 0, 1, 1) Render.GradientBoxFilled(Vector2.new(width / 2 - initial_position + 2, height / 2), Vector2.new(width / 2 + 2 - offset, height / 2 + 1), Color.new(color.r, color.g, color.b, color.a * alpha), Color.new(color.r, color.g, color.b, 0), Color.new(color.r, color.g, color.b, color.a * alpha), Color.new(color.r, color.g, color.b, 0)) -- LEFT Render.GradientBoxFilled(Vector2.new(width / 2 + offset, height / 2), Vector2.new(width / 2 + initial_position, height / 2 + 1), Color.new(color.r, color.g, color.b, 0), Color.new(color.r, color.g, color.b, color.a * alpha), Color.new(color.r, color.g, color.b, 0), Color.new(color.r, color.g, color.b, color.a * alpha)) -- RIGHT Render.GradientBoxFilled(Vector2.new(width / 2, height / 2 - initial_position + 2), Vector2.new(width / 2 + 1, height / 2 + 2 - offset), Color.new(color.r, color.g, color.b, color.a * alpha), Color.new(color.r, color.g, color.b, color.a * alpha), Color.new(color.r, color.g, color.b, 0), Color.new(color.r, color.g, color.b, 0)) -- TOP Render.GradientBoxFilled(Vector2.new(width / 2, height / 2 + offset), Vector2.new(width / 2 + 1, height / 2 + initial_position), Color.new(color.r, color.g, color.b, 0), Color.new(color.r, color.g, color.b, 0), Color.new(color.r, color.g, color.b, color.a * alpha), Color.new(color.r, color.g, color.b, color.a * alpha)) m_alpha = clamp(m_alpha + (act and FT or -FT), 0, 1) end end Cheat.RegisterCallback("draw", loh_scope) Cheat.RegisterCallback("destroy", function() remove_scope:Set(cache_remove_scope) end)