-
Автор темы
- #1
Привет! Искал на форуме SpirtHack'а и не нашел Trail, пришлось писать самому. Надеюсь оцените)
Ссылка на Скачивание:
V1.0
V2.0
Пожалуйста, авторизуйтесь для просмотра ссылки.
C++:
local enable = Menu.Switch("MonixLITE","Enable Trail", false)
local enableSphere = Menu.Switch("MonixLITE","Enable Sphere", false)
local lifetime = Menu.SliderInt("MonixLITE","LifeTime", 100, 10, 1000)
local trails = {}
local i = 1
local function hsv_to_rgb(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 Color.new(r, g, b)
end
function drawTrail()
if enable:Get() == false then return end
local local_player = EntityList.GetLocalPlayer()
if not local_player or local_player:GetProp("m_lifeState") ~= false then return end
local local_player_origin = local_player:GetProp("m_vecOrigin")
local netchann_info = EngineClient.GetNetChannelInfo()
local latency = netchann_info:GetLatency(0) / GlobalVars.interval_per_tick
local tickcount_pred = GlobalVars.tickcount + latency
table.insert(trails,
{
x = local_player_origin.x,
y = local_player_origin.y,
z = local_player_origin.z,
time = tickcount_pred + lifetime:Get()
}
)
end
function drawTrails()
if enable:Get() == false then return end
local hue_offset = 0
hue_offset = ((GlobalVars.realtime * (2 * 50)) + i) % 360
hue_offset = math.min(360, math.max(0, hue_offset))
local r, g, b = hsv_to_rgb(hue_offset / 360, 1, 1).r, hsv_to_rgb(hue_offset / 360, 1, 1).g, hsv_to_rgb(hue_offset / 360, 1, 1).b
clr = Color.new(r, g, b)
for i = 2, #trails do
local netchann_info = EngineClient.GetNetChannelInfo()
local latency = netchann_info:GetLatency(0) / GlobalVars.interval_per_tick
local tickcount_pred = GlobalVars.tickcount + latency
if trails[i-1].time > tickcount_pred then
local position1 = Render.WorldToScreen(Vector.new(trails[i].x, trails[i].y, trails[i].z))
local position2 = Render.WorldToScreen(Vector.new(trails[i-1].x, trails[i-1].y, trails[i-1].z))
Render.Line(Vector2.new(position1.x, position1.y), Vector2.new(position2.x, position2.y), clr)
Render.Line(Vector2.new(position1.x+1, position1.y+1), Vector2.new(position2.x+1, position2.y+1), clr)
Render.Line(Vector2.new(position1.x+2, position1.y+2), Vector2.new(position2.x+2, position2.y+2), clr)
if enableSphere:Get() == true then Render.Circle3DFilled(Vector.new(trails[#trails].x, trails[#trails].y, trails[#trails].z), 25, 3, clr) end
end
end
end
Cheat.RegisterCallback("draw", function()
drawTrail()
drawTrails()
end)
C++:
local enable = Menu.Switch("MonixLITE","Enable Trail", false)
local enableSphere = Menu.Switch("MonixLITE","Enable Sphere", false)
local lifetime = Menu.SliderInt("MonixLITE","LifeTime", 100, 10, 500)
local trails = {}
local i = 1
local function hsv_to_rgb(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 Color.new(r, g, b)
end
function drawTrail()
if enable:Get() == false then return end
local local_player = EntityList.GetLocalPlayer()
if not local_player or local_player:GetProp("m_lifeState") ~= false then return end
local local_player_origin = local_player:GetProp("m_vecOrigin")
local netchann_info = EngineClient.GetNetChannelInfo()
local latency = netchann_info:GetLatency(0) / GlobalVars.interval_per_tick
local tickcount_pred = GlobalVars.tickcount + latency
table.insert(trails,
{
x = local_player_origin.x,
y = local_player_origin.y,
z = local_player_origin.z,
time = tickcount_pred + lifetime:Get()
}
)
end
function drawTrails()
if enable:Get() == false then return end
local hue_offset = 0
hue_offset = ((GlobalVars.realtime * (2 * 50)) + i) % 360
hue_offset = math.min(360, math.max(0, hue_offset))
local r, g, b = hsv_to_rgb(hue_offset / 360, 1, 1).r, hsv_to_rgb(hue_offset / 360, 1, 1).g, hsv_to_rgb(hue_offset / 360, 1, 1).b
clr = Color.new(r, g, b)
for i = 2, #trails do
local netchann_info = EngineClient.GetNetChannelInfo()
local latency = netchann_info:GetLatency(0) / GlobalVars.interval_per_tick
local tickcount_pred = GlobalVars.tickcount + latency
if trails[i-1].time > tickcount_pred then
local position1 = Render.WorldToScreen(Vector.new(trails[i].x, trails[i].y, trails[i].z))
local position2 = Render.WorldToScreen(Vector.new(trails[i-1].x, trails[i-1].y, trails[i-1].z))
Render.Line(Vector2.new(position1.x, position1.y), Vector2.new(position2.x, position2.y), clr)
Render.Line(Vector2.new(position1.x+1, position1.y+1), Vector2.new(position2.x+1, position2.y+1), clr)
Render.Line(Vector2.new(position1.x+2, position1.y+2), Vector2.new(position2.x+2, position2.y+2), clr)
if enableSphere:Get() == true then Render.Circle3DFilled(Vector.new(trails[#trails].x, trails[#trails].y, trails[#trails].z), 25, 3, clr) end
end
end
if #trails > lifetime:Get() then
for a = 1, lifetime:Get() do
table.remove(trails, a)
end
end
end
Cheat.RegisterCallback("draw", function()
drawTrail()
drawTrails()
end)
Последнее редактирование: