life is cheap, death is free!
-
Автор темы
- #1
Thx for visual nozoom / Спасибо за визуальное отсутствие зума:
Original skeet scope theme / Оригинальная тема откуда брал скит скоуп: https://yougame.biz/threads/232731
Пожалуйста, авторизуйтесь для просмотра ссылки.
(noad)Original skeet scope theme / Оригинальная тема откуда брал скит скоуп: https://yougame.biz/threads/232731
Код:
local m_bIsScoped = se.get_netvar("DT_CSPlayer", "m_bIsScoped")
local Scope = false
local offset = ui.add_slider_int("Offset", "offset_scope", 0, 500, 10)
local length = ui.add_slider_int("Length", "length_scope", 0, 1000, 60)
local anim_speed = ui.add_slider_int("Animation speed", "anim_speed_scope", 1, 30, 15)
local animoffset = ui.add_check_box("Animate offset", "animoffset_scope", false)
local col_1 = ui.add_color_edit("First color", "scope_color1", true, color_t.new(255, 255, 255, 255))
local col_2 = ui.add_color_edit("Second color", "scope_color2", true, color_t.new(255, 255, 255, 10))
local anim_num = 0
local lerp = function(a, b, t)
return a + (b - a) * t
end
client.register_callback("frame_stage_notify", function(s)
if s ~= 5 then return end
local local_player = entitylist:get_local_player()
local bIsScoped = local_player:get_prop_bool(se.get_netvar("DT_CSPlayer", "m_bIsScoped"))
local_player:set_prop_int(m_bIsScoped, bIsScoped and 1 or 0)
Scope = bIsScoped and true or false
if local_player:get_prop_int(m_bIsScoped) then
local_player:set_prop_int(m_bIsScoped, 0)
end
end)
client.register_callback("paint", function()
local local_player = entitylist:get_local_player()
local screen = engine.get_screen_size()
local start_x, start_y = screen.x /2, screen.y /2
local offsett = offset:get_value()
local lengthh = length:get_value() * anim_num
local width = 1
local col1 = col_1:get_value() col1.a = col1.a * anim_num
local col2 = col_2:get_value() col2.a = col2.a * anim_num
local animcond = Scope and local_player:is_alive()
anim_num = lerp(anim_num, animcond and 1 or 0, anim_speed:get_value() * globalvars.get_frame_time())
offsett = animoffset:get_value() and offsett * anim_num or offsett
--left
renderer.rect_filled_fade(vec2_t.new(start_x - offsett + 1, start_y), vec2_t.new(start_x - offsett - lengthh + 1, start_y + width), col1, col2, col2, col1)
--right
renderer.rect_filled_fade(vec2_t.new(start_x + offsett, start_y), vec2_t.new(start_x + offsett + lengthh, start_y + width), col1, col2, col2, col1)
--down
renderer.rect_filled_fade(vec2_t.new(start_x, start_y + offsett), vec2_t.new(start_x + width, start_y + offsett + lengthh), col1, col1, col2, col2)
--up
renderer.rect_filled_fade(vec2_t.new(start_x, start_y - offsett + 1), vec2_t.new(start_x + width, start_y - offsett - lengthh + 1), col1, col1, col2, col2)
end)
Последнее редактирование: