Начинающий
- Статус
- Оффлайн
- Регистрация
- 31 Мар 2020
- Сообщения
- 70
- Реакции
- 25
Видел тему с этим же прицелом, но код был неактуален, чет там поменял бла бла, в итоге чет да вышло, ну и добавил настройку размера
Код:
crosshair_nixware = Menu.Switch('Visual','Crosshair nixware', false)
crosshair_custom = Menu.SliderInt('Visual','Crosshair size', 60, 10, 100)
local function DEG2RAD(x) return x * math.pi / 180 end
local function RAD2DEG(x) return x * 180 / math.pi end
function menu()
crosshair_custom:SetVisible(crosshair_nixware:Get())
end
local function hsv2rgb(h, s, v, a)
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 * 999, g * 999, b * 999, a * 999
end
local rainbow = 0.00
local rotationdegree = 0.000;
local function crosshair(x, y, size) -- crosshair
local frametime = GlobalVars.frametime
local a = size / crosshair_custom:Get()
local gamma = math.atan(a / a)
rainbow = rainbow + (frametime * 0.5)
if rainbow > 1.0 then rainbow = 0.0 end
if rotationdegree > 89 then rotationdegree = 0 end
for i = 0, 4 do
local p_0 = (a * math.sin(DEG2RAD(rotationdegree + (i * 90))))
local p_1 = (a * math.cos(DEG2RAD(rotationdegree + (i * 90))))
local p_2 =((a / math.cos(gamma)) * math.sin(DEG2RAD(rotationdegree + (i * 90) + RAD2DEG(gamma))))
local p_3 =((a / math.cos(gamma)) * math.cos(DEG2RAD(rotationdegree + (i * 90) + RAD2DEG(gamma))))
Render.Line(Vector2.new(x, y), Vector2.new(x + p_0, y - p_1), Color.new(hsv2rgb(rainbow, 1, 1, 1)))
Render.Line(Vector2.new(x + p_0, y - p_1), Vector2.new(x + p_2, y - p_3), Color.new(hsv2rgb(rainbow, 1, 1, 1)))
end
rotationdegree = rotationdegree + (frametime * 150)
end
local crossalpha = CVar.FindVar("cl_crosshairalpha"):GetString()
local function on_paint()
local screen = EngineClient:GetScreenSize()
if not EngineClient:IsConnected() then
return
end
if(crosshair_nixware:Get()) then
EngineClient.ExecuteClientCmd("cl_crosshairalpha 0")
crosshair(screen.x / 2, screen.y / 2, screen.y /2)
else
EngineClient.ExecuteClientCmd("cl_crosshairalpha " .. crossalpha)
end
end
Cheat.RegisterCallback("draw",function()
menu()
on_paint()
end)