local dt = ui.get('Rage', 'Exploits', 'General', 'Double tap key');
local hs = ui.get('Rage', 'Exploits', 'General', 'Hide shots key');
local dt_state = false;
local hs_state = false;
local was_vis = false;
local in_air_ticker = 0;
local mp_teammates_are_enemies = cvar.find_var("mp_teammates_are_enemies");
local function vec_dist(v1, v2)
return math.sqrt((v2.x-v1.x)^2 + (v2.y-v1.y)^2 + (v2.z-v1.z)^2)
end
local function get_is_vis(plocal)
local CCSPlayer = entity_list.get_all("CCSPlayer");
if #CCSPlayer < 2 then return end
local local_index = plocal:index();
local local_team = plocal:get_prop("DT_BaseEntity", "m_iTeamNum"):get_int();
local local_pos = plocal:eye_position();
for i = 1, #CCSPlayer do
local ent = entity_list.get_client_entity(CCSPlayer[i]);
local ent_team = ent:get_prop("DT_BaseEntity", "m_iTeamNum"):get_int();
if ent:index() ~= local_index and (ent_team ~= local_team or mp_teammates_are_enemies:get_int() == 1) and ent_team ~= 1 and ent:get_prop("DT_CSPlayer", "m_iHealth"):get_int() > 0 and not ent:dormant() then
local pos = ent:eye_position();
local line = engine_trace.trace_ray(local_pos, pos, plocal, 1)
if vec_dist(pos, line.endpos) <= 25 then
return true
end
end
end
return false
end
local function reset()
if was_vis then
dt:set(dt_state)
hs:set(hs_state)
was_vis = false;
end
end
callbacks.register("post_move", function()
if not client.is_alive() then reset() return end
plocal = entity_list.get_client_entity(engine.get_local_player());
if not plocal then reset() return end
local m_fFlags, tr = math.modf(plocal:get_prop("DT_CSPlayer", "m_fFlags"):get_int()/2);
in_air_ticker = (tr~=0.5) and 2 or (in_air_ticker > 0) and in_air_ticker - 1 or in_air_ticker
if in_air_ticker == 0 then reset() return end
local is_vis = get_is_vis(plocal);
if is_vis == was_vis then
if is_vis then
if dt:get() then
dt_state = not dt_state;
dt:set(false)
end
if hs:get() then
hs_state = not hs_state;
hs:set(false)
end
end
return
end
if is_vis then
dt_state = dt:get();
hs_state = hs:get();
dt:set(false)
hs:set(false)
else
dt:set(dt_state)
hs:set(hs_state)
end
was_vis = is_vis;
end)