ЧВК EB_LAN
-
Автор темы
- #1
Делал очень давно, чуть ли не год назад до того как я сменил кодстайл, больше в них нет нужды тк сделал более новое и красивое
code_language.lua:
local vec3_t, ffi, render = require("vector"), require("ffi"), require("gamesense/surface")
local Get, Set, Find, AddCheckbox, AddSlider, AddCombo, AddMultiCombo, AddLabel, AddHotkey, AddListbox, SetVisible, RegisterCallback, GetProp = ui.get, ui.set, ui.reference, ui.new_checkbox, ui.new_slider, ui.new_combobox, ui.new_multiselect, ui.new_label, ui.new_hotkey, ui.new_listbox, ui.set_visible, client.set_event_callback, entity.get_prop
local ss = { a = "RAGE", b = "Aimbot", c = "AA", d = "Anti-aimbot angles" }
local LuaTab, LuaChildA, LuaChildB = "LUA", "A", "B"
local Cheat = {
Menu = {
Rage = {
MinDamage = Find(ss.a, ss.b, 'Minimum damage'),
MinDamageOverride = { Find(ss.a, ss.b, 'Minimum damage override') },
ForceSafepoint = Find(ss.a, ss.b, "Force safe point"),
ForceBodyaim = Find(ss.a, ss.b, "Force body aim")
},
Exploits = {
Doubletap = { Find(ss.a, ss.b, 'Double tap') },
Hideshots = { Find(ss.c, 'Other', 'On shot anti-aim') },
Fakeduck = Find(ss.a, 'Other', 'Duck peek assist')
},
Misc = {
Autopeek = { Find(ss.a, 'Other', 'Quick peek assist') },
Freestanding = { Find(ss.c, ss.d, 'Freestanding') },
Slowwalk = { Find(ss.c, 'Other', 'Slow motion') },
}
},
Lua = {
Enable = AddCheckbox(LuaTab, LuaChildB, "Gamesense indicators"),
Indicators = AddMultiCombo(LuaTab, LuaChildB, "Select", { "Watermark", "Hitlogs", "Keybinds" })
}
}
local Cache = {
Screen = vec3_t(client.screen_size()),
Watermark = { Cheat = "gamesense", User = "lordhatori", GradientSize = 30, BoxSize = 0, Alpha = 0 },
Hitlogs = { Hitgroups = {"generic", "head", "chest", "stomach", "left arm", "right arm", "left leg", "right leg", "neck", "?", "gear"}, Missed = false, Fired = false, Damage = 0, Hitbox = "", PredictedDamage = 0, PredictedHitbox = "", Backtrack = 0, Chance = 0, Reason = "", Alpha = 0 },
Keybinds = { HaveBinds = false, WindowWidth = 0, Alpha = 0 }
}
local Helpers = { Contains = function(tab, val) for i = 1, #tab do if tab[i] == val then return true end end return false end, }
local GradientText = function(color1, color2, text, alpha)
local output = ""
if alpha >= 1.0 then alpha = 1.0 end
local len = #text - 1
local rinc = (color2.x - color1.x) / len
local ginc = (color2.y - color1.y) / len
local binc = (color2.z - color1.z) / len
for i = 1, len + 1 do
output = output .. ('\a%02x%02x%02x%02x%s'):format(color1.x, color1.y, color1.z, 255 * alpha, text:sub(i, i))
color1.x = color1.x + rinc
color1.y = color1.y + ginc
color1.z = color1.z + binc
end
return output
end
local function vmt_entry(instance, index, type) return ffi.cast(type, (ffi.cast("void***", instance)[0])[index]) end
local function vmt_thunk(index, typestring) local t = ffi.typeof(typestring) return function(instance, ...) assert(instance ~= nil) if instance then return vmt_entry(instance, index, t)(instance, ...) end end end
local function vmt_bind(module, interface, index, typestring) local instance = client.create_interface(module, interface) or error("invalid interface") local fnptr = vmt_entry(instance, index, ffi.typeof(typestring)) or error("invalid vtable") return function(...) return fnptr(instance, ...) end end
local native_GetNetChannelInfo = vmt_bind("engine.dll", "VEngineClient014", 78, "void*(__thiscall*)(void*)")
local native_GetLatency = vmt_thunk(9, "float(__thiscall*)(void*, int)")
local native_GetAvgLatency = vmt_thunk(10, "float(__thiscall*)(void*, int)")
local Lerp = function(a, b, t)
local fixed_point_scale = 1000
local a_fixed = math.floor(a * fixed_point_scale)
local b_fixed = math.floor(b * fixed_point_scale)
local t_fixed = math.floor(t * fixed_point_scale)
local result_fixed = a_fixed + (b_fixed - a_fixed) * t_fixed / fixed_point_scale
local result = result_fixed / fixed_point_scale
if result > 0.90 and b == 1.0 then return 1.0 end
if result < 0.10 and b == 0.0 then return 0.0 end
return result
end
local GamesenseWindow = function(pos, size, color, alpha)
if alpha >= 1.0 then alpha = 1.0 end
renderer.blur(pos.x, pos.y - 4, size.x + 30, size.y + 4, .5, (.5) * alpha)
renderer.rectangle(pos.x + 30, pos.y - 4, size.x - 30, size.y + 4, color.x, color.y, color.z, 125 * alpha)
renderer.gradient(pos.x, pos.y - 4, 30, size.y + 4, color.x, color.y, color.z, 0 * alpha, color.x, color.y, color.z, 125 * alpha, true)
renderer.gradient(pos.x + size.x, pos.y - 4, 30, size.y + 4, color.x, color.y, color.z, 125 * alpha, color.x, color.y, color.z, 0, true)
end
local HitlogStack = {}
local RecordAimbotShot = function(idx)
if Cache.Hitlogs.Missed then
Cache.Hitlogs.PredictedDamage, Cache.Hitlogs.Backtrack = idx.damage, idx.backtrack
end
Cache.Hitlogs.Fired = true
end
local RecordAimbotHittedShot = function(idx)
client.log(("Hit %s in the %s for %d damage (%d health remaining)"):format(entity.get_player_name(idx.target), Cache.Hitlogs.Hitgroups[idx.hitgroup + 1] or "?", idx.damage, GetProp(idx.target, "m_iHealth")))
table.insert(HitlogStack, 1, { Text = ("Hit %s in the %s for %d damage (%d health remaining)"):format(entity.get_player_name(idx.target), Cache.Hitlogs.Hitgroups[idx.hitgroup + 1] or "?", idx.damage, GetProp(idx.target, "m_iHealth")), Alpha = 1.0, Timer = 2.5 })
Cache.Hitlogs.Missed = false
end
local RecordAimbotMissedShot = function(idx)
client.log(("Missed %s in the %s for %d damage with chance %.2f (Reason: %s)"):format(entity.get_player_name(idx.target), Cache.Hitlogs.Hitgroups[idx.hitgroup + 1] or "?", Cache.Hitlogs.PredictedDamage or "?", math.floor(idx.hit_chance) / 100.0, idx.reason))
table.insert(HitlogStack, 1, { Text = ("Missed %s in the %s for %d damage with chance %.2f (Reason: %s)"):format(entity.get_player_name(idx.target), Cache.Hitlogs.Hitgroups[idx.hitgroup + 1] or "?", Cache.Hitlogs.PredictedDamage or "?", math.floor(idx.hit_chance) / 100.0, idx.reason), Alpha = 1.0, Timer = 2.5 })
Cache.Hitlogs.Missed = true
end
local Binds = {
{ Bind = function() return Get(Cheat.Menu.Exploits.Doubletap[2]) end, Text = "Double tap" },
{ Bind = function() return Get(Cheat.Menu.Exploits.Hideshots[2]) end, Text = "On shot anti-aim" },
{ Bind = function() return Get(Cheat.Menu.Exploits.Fakeduck) end, Text = "Duck peek assist" },
{ Bind = function() return Get(Cheat.Menu.Rage.MinDamageOverride[2]) end, Text = "Damage override" },
{ Bind = function() return Get(Cheat.Menu.Misc.Slowwalk[2]) end, Text = "Slow motion" },
{ Bind = function() return Get(Cheat.Menu.Misc.Freestanding[2]) end, Text = "Freestanding" },
{ Bind = function() return Get(Cheat.Menu.Misc.Autopeek[2]) end, Text = "Quick peek assist" },
{ Bind = function() return Get(Cheat.Menu.Misc.ForceSafepoint) end, Text = "Force safety" },
{ Bind = function() return Get(Cheat.Menu.Misc.ForceBodyaim) end, Text = "Force body" },
}
local GamesenseIndicators = function()
if not Get(Cheat.Lua.Enable) then return end
local LocalPlayer = entity.get_local_player()
if not LocalPlayer then return end
local NetChannel = native_GetNetChannelInfo()
if not NetChannel then return false end
local Channel = { Outgoing = native_GetAvgLatency(NetChannel, 0), Incoming = native_GetAvgLatency(NetChannel, 1) }
local Specs = { FPS = math.floor(1.0 / globals.frametime()), PING = math.floor(Channel.Incoming * 1000), SPEED = math.floor(vec3_t(GetProp(LocalPlayer, "m_vecVelocity")):length2d()), TIME = vec3_t(client.system_time()) }
Cache.Keybinds.HaveBinds = false
for k = 1, #Binds do if Binds[k].Bind() then Cache.Keybinds.HaveBinds = true break end end
Cache.Watermark.Alpha = Lerp(Cache.Watermark.Alpha, Helpers.Contains(Get(Cheat.Lua.Indicators), "Watermark") and 1.0 or .0, 0.03)
Cache.Hitlogs.Alpha = Lerp(Cache.Hitlogs.Alpha, Helpers.Contains(Get(Cheat.Lua.Indicators), "Hitlogs") and Cache.Hitlogs.Fired and 1.0 or .0, 0.01)
Cache.Keybinds.Alpha = Lerp(Cache.Keybinds.Alpha, (Helpers.Contains(Get(Cheat.Lua.Indicators), "Keybinds") and Cache.Keybinds.HaveBinds) and 1.0 or .0, 0.05)
if Cache.Watermark.Alpha ~= .0 then
local Logo = GradientText(vec3_t(255, 255, 255), vec3_t(125, 255, 125), Cache.Watermark.Cheat, Cache.Watermark.Alpha)
local Time = ((math.floor(Specs.TIME.x) < 10 and "0%s" or "%s") .. ":" .. (math.floor(Specs.TIME.y) < 10 and "0%s" or "%s") .. ":" .. (math.floor(Specs.TIME.z) < 10 and "0%s" or "%s")):format(math.floor(Specs.TIME.x), math.floor(Specs.TIME.y), math.floor(Specs.TIME.z))
local Text = ("%s %s:FPS %s:PING %s:SPEED " .. Time):format(Cache.Watermark.User, Specs.FPS, Specs.PING, Specs.SPEED, math.floor(Specs.TIME.x), math.floor(Specs.TIME.y), math.floor(Specs.TIME.z))
local Watermark = { LogoSize = vec3_t(renderer.measure_text("c", Logo)), Size = vec3_t(renderer.measure_text("c", Text)), Spacing = 5 }
GamesenseWindow(vec3_t((Cache.Screen.x - 20) - Watermark.Size.x - Watermark.LogoSize.x - (Watermark.Spacing * 2), Watermark.Size.y), vec3_t(Watermark.Size.x + Watermark.LogoSize.x - (Watermark.Spacing * 2), Watermark.Size.y + 5), vec3_t(5, 5, 5), Cache.Watermark.Alpha)
renderer.text((Cache.Screen.x - 20) - Watermark.Size.x - Watermark.LogoSize.x - Watermark.Spacing, Watermark.Size.y, 255, 255, 255, 255 * Cache.Watermark.Alpha, "d", 0, Logo)
renderer.text((Cache.Screen.x - 20) - Watermark.Size.x, Watermark.Size.y, 255, 255, 255, 255 * Cache.Watermark.Alpha, "d", 0, Text)
end
if Cache.Hitlogs.Alpha ~= .0 then
for i, hitlog in ipairs(HitlogStack) do
hitlog.Timer = hitlog.Timer - globals.frametime()
if hitlog.Timer <= 0 then
table.remove(HitlogStack, i)
else
hitlog.Alpha = math.max(0, hitlog.Alpha - 0.002)
end
end
for i, hitlog in ipairs(HitlogStack) do
local HitlogSize = vec3_t(renderer.measure_text("c", hitlog.Text))
local HitlogWindow = GamesenseWindow(vec3_t(20, HitlogSize.y + (i - 1) * 25), vec3_t(HitlogSize.x + 5, HitlogSize.y + 5), vec3_t(5, 5, 5), hitlog.Alpha)
renderer.text(35, HitlogSize.y + (i - 1) * 25, 255, 255, 255, 255 * hitlog.Alpha, "d", 0, hitlog.Text)
end
end
if Cache.Keybinds.Alpha ~= .0 then
local KeybindsSize = vec3_t(renderer.measure_text("c", "keybinds"))
local KeybindsPos = vec3_t(350, 350)
local KeybindsWidth = 0
for i = 1, #Binds do
local feature = Binds[i]
if feature.Bind() then
local textSize = vec3_t(renderer.measure_text("d", feature.Text))
KeybindsWidth = math.max(KeybindsWidth, textSize.x + 20)
end
end
KeybindsWidth = math.max(KeybindsWidth, KeybindsSize.x + 45)
Cache.Keybinds.WindowWidth = Lerp(Cache.Keybinds.WindowWidth, Cache.Keybinds.HaveBinds and KeybindsWidth or 45, 0.05)
GamesenseWindow(KeybindsPos, vec3_t(Cache.Keybinds.WindowWidth, KeybindsSize.y + 6), vec3_t(5, 5, 5), Cache.Keybinds.Alpha)
local keybindsTextX = KeybindsPos.x + (Cache.Keybinds.WindowWidth - KeybindsSize.x) / 2
renderer.text(keybindsTextX + 13, KeybindsPos.y + 1, 255, 255, 255, 255 * Cache.Keybinds.Alpha, "d", 0, "keybinds")
local BindPosition = KeybindsPos.y + 23
for i = 1, #Binds do
local feature = Binds[i]
if feature.Bind() then
local textSize = vec3_t(renderer.measure_text("d", feature.Text))
local centerX = KeybindsPos.x + Cache.Keybinds.WindowWidth / 2
local textX = centerX - textSize.x / 2 + 13
renderer.text(textX, BindPosition, 255, 255, 255, 255 * Cache.Keybinds.Alpha, "d", 0, feature.Text)
BindPosition = BindPosition + 15
end
end
end
end
RegisterCallback("paint", GamesenseIndicators)
RegisterCallback("aim_fire", RecordAimbotShot)
RegisterCallback("aim_hit", RecordAimbotHittedShot)
RegisterCallback("aim_miss", RecordAimbotMissedShot)