Начинающий
- Статус
- Оффлайн
- Регистрация
- 16 Фев 2019
- Сообщения
- 48
- Реакции
- 1
имбовый прицелище:
local rainbow = 0.00
local rotationdegree = 0.000
local DEG2RAD = function(x) return x * math.pi / 180 end
local RAD2DEG = function(x) return x * 180 / math.pi end
local function hsv2rgb(h, s, v)
local r, g, b
local i = math.floor(h * 6)
local f = h * 6 - i
local p = v * (1 - s)
local q = v * (1 - f * s)
local t = v * (1 - (1 - f) * s)
i = i % 6
if i == 0 then
r, g, b = v, t, p
elseif i == 1 then
r, g, b = q, v, p
elseif i == 2 then
r, g, b = p, v, t
elseif i == 3 then
r, g, b = p, q, v
elseif i == 4 then
r, g, b = t, p, v
elseif i == 5 then
r, g, b = v, p, q
end
return r * 255, g * 255, b * 255
end
local function draw_svaston(x, y, size)
local frametime = 0.033
local a = size / 60
local gamma = math.atan(1)
rainbow = rainbow + (frametime * 0.5)
if rainbow > 1.0 then rainbow = 0.0 end
if rotationdegree > 360 then rotationdegree = rotationdegree - 360 end
local r, g, b = hsv2rgb(rainbow, 1, 1)
for i = 0, 4 do
local angle = rotationdegree + (i * 90)
local p_0 = (a * math.sin(DEG2RAD(angle)))
local p_1 = (a * math.cos(DEG2RAD(angle)))
local p_2 = ((a / math.cos(gamma)) * math.sin(DEG2RAD(angle + RAD2DEG(gamma))))
local p_3 = ((a / math.cos(gamma)) * math.cos(DEG2RAD(angle + RAD2DEG(gamma))))
render.line(vector(x, y), vector(x + p_0, y - p_1), color(r, g, b, 255))
render.line(vector(x + p_0, y - p_1), vector(x + p_2, y - p_3), color(r, g, b, 255))
end
rotationdegree = rotationdegree + (frametime * 100)
end
events.render:set(function()
if not globals.is_in_game then return end
local scrsz = render.screen_size()
draw_svaston(scrsz.x / 2, scrsz.y / 2, scrsz.y / 2)
end)