local scope_line = {}
scope_line.var = Menu.FindVar("Visuals", "View", "Camera", "Remove Scope")
scope_line.screen = EngineClient:GetScreenSize()
scope_line.ref = scope_line.var:GetInt()
scope_line.menu = {}
scope_line.menu.offset = Menu.SliderInt("Custom Scope", "Offset", 10, 0, 500)
scope_line.menu.length = Menu.SliderInt("Custom Scope", "Length", 60, 0, 1000)
scope_line.menu.anim_speed = Menu.SliderInt("Custom Scope", "Anim Speed", 15, 1, 30)
scope_line.menu.col_1 = Menu.ColorEdit("Custom Scope", "Color 1", Color.RGBA(255, 255, 255))
scope_line.menu.col_2 = Menu.ColorEdit("Custom Scope", "Color 2", Color.RGBA(255, 255, 255, 0))
scope_line.anim_num = 0
scope_line.lerp = function(a, b, t)
return a + (b - a) * t
end
scope_line.on_draw = function()
scope_line.var:SetInt(2)
local_player = EntityList.GetLocalPlayer()
scope_line.anim_speed = scope_line.menu.anim_speed:Get()
if not local_player or not local_player:IsAlive() or not local_player:GetProp("m_bIsScoped") then
scope_line.anim_num = scope_line.lerp(scope_line.anim_num, 0, scope_line.anim_speed * GlobalVars.frametime)
else
scope_line.anim_num = scope_line.lerp(scope_line.anim_num, 1, scope_line.anim_speed * GlobalVars.frametime)
end
scope_line.offset = scope_line.menu.offset:Get() * scope_line.anim_num
scope_line.length = scope_line.menu.length:Get() * scope_line.anim_num
scope_line.col_1 = scope_line.menu.col_1:Get()
scope_line.col_2 = scope_line.menu.col_2:Get()
scope_line.width = 1
scope_line.col_1.a = scope_line.col_1.a * scope_line.anim_num
scope_line.col_2.a = scope_line.col_2.a * scope_line.anim_num
scope_line.start_x = scope_line.screen.x / 2
scope_line.start_y = scope_line.screen.y / 2
--Left
Render.GradientBoxFilled(Vector2.new(scope_line.start_x - scope_line.offset, scope_line.start_y), Vector2.new(scope_line.start_x - scope_line.offset - scope_line.length, scope_line.start_y + scope_line.width), scope_line.col_1, scope_line.col_2, scope_line.col_1, scope_line.col_2)
--Right
Render.GradientBoxFilled(Vector2.new(scope_line.start_x + scope_line.offset, scope_line.start_y), Vector2.new(scope_line.start_x + scope_line.offset + scope_line.length, scope_line.start_y + scope_line.width), scope_line.col_1, scope_line.col_2, scope_line.col_1, scope_line.col_2)
--Up
Render.GradientBoxFilled(Vector2.new(scope_line.start_x, scope_line.start_y + scope_line.offset), Vector2.new(scope_line.start_x + scope_line.width, scope_line.start_y + scope_line.offset + scope_line.length), scope_line.col_1, scope_line.col_1, scope_line.col_2, scope_line.col_2)
--Down
Render.GradientBoxFilled(Vector2.new(scope_line.start_x, scope_line.start_y - scope_line.offset), Vector2.new(scope_line.start_x + scope_line.width, scope_line.start_y - scope_line.offset - scope_line.length), scope_line.col_1, scope_line.col_1, scope_line.col_2, scope_line.col_2)
end
scope_line.on_destroy = function()
scope_line.var:SetInt(scope_line.ref)
end
Cheat.RegisterCallback("draw", scope_line.on_draw)
Cheat.RegisterCallback("destroy", scope_line.on_destroy)