local shots = {}
local FA = gui.get_config_item("rage>Anti-aim>Desync>fake amount")
local JitterAmt = gui.get_config_item("rage>Anti-aim>Angles>Jitter range")
local Jitter = gui.get_config_item("rage>Anti-aim>Angles>Jitter")
local EnableAntiBrute = gui.add_checkbox("Enable Anti-Brute", "lua>Tab b")
local Enable = gui.add_checkbox("Custom Anti-Brute Angs", "lua>Tab b")
local A1 = gui.add_slider("Angle 1", "lua>tab b", -100, 100, 1)
local A2 = gui.add_slider("Angle 2", "lua>tab b", -100, 100, 1)
local A3 = gui.add_slider("Angle 3", "lua>tab b", -100, 100, 1)
local A4 = gui.add_slider("Angle 4", "lua>tab b", -100, 100, 1)
local A5 = gui.add_slider("Angle 5", "lua>tab b", -100, 100, 1)
local A6 = gui.add_slider("Angle 6", "lua>tab b", -100, 100, 1)
local A7 = gui.add_slider("Angle 7", "lua>tab b", -100, 100, 1)
local Panic = gui.add_checkbox("Panic on hit", "lua>Tab a")
local PanicFA = gui.add_slider("Panic FA", "lua>tab a", -100, 100, 1)
local PanicJit = gui.add_slider("Panic Jit", "lua>tab a", 0, 100, 1)
local waitbeforswitch = 0;
local AAStage = 0;
local panictime = 0;
local storeFA = 0
local jitterstore = 0
local jitval = false
local function mathclamp(x, min, max)
if x < min then return min end
if x > max then return max end
return x
end
local function magnitude(vec3)
return(vec3.x^2 + vec3.y^2 + vec3.z^2)
end
local function GetClosestPointOnFiniteLine(point, line_start, line_end)
local heading = (line_end - line_start);
local magnitudeMax = magnitude(heading);
heading:normalize();
--Do projection from the point but clamp it
local lhs = point - line_start;
local dotP = lhs:dot(heading);
dotP = mathclamp(dotP, 0, magnitudeMax);
return line_start + heading * dotP;
end
local function AntiBrute(LP)
local LX, LY, LZ = LP:get_hitbox_position(1)
local LX2, LY2, LZ2 = LP:get_hitbox_position(4)
if(waitbeforswitch > 0) then
waitbeforswitch = waitbeforswitch - global_vars.frametime
end
--print(waitbeforswitch)
for i, Shot in pairs(shots) do
if(LP ~= nil and LP:get_hitbox_position(1) ~= nil) then
local test = GetClosestPointOnFiniteLine(math.vec3(LX, LY, LZ),math.vec3(Shot.X, Shot.Y, Shot.Z),math.vec3(Shot.posx, Shot.posy, Shot.posz))
local test2 = GetClosestPointOnFiniteLine(math.vec3(LX2, LY2, LZ2),math.vec3(Shot.X, Shot.Y, Shot.Z),math.vec3(Shot.posx, Shot.posy, Shot.posz))
Shot.fade = (Shot.fade - global_vars.frametime)
if(test:dist(math.vec3(LX, LY, LZ)) < 25 and waitbeforswitch <= 0 or test2:dist(math.vec3(LX2, LY2, LZ2)) < 25 and waitbeforswitch <= 0) then
if(Enable:get_bool() == true) then
if(AAStage == 0) then
FA:set_int(A1:get_int())
end
if(AAStage == 1) then
FA:set_int(A2:get_int())
end
if(AAStage == 2) then
FA:set_int(A3:get_int())
end
if(AAStage == 3) then
FA:set_int(A4:get_int())
end
if(AAStage == 4) then
FA:set_int(A5:get_int())
end
if(AAStage == 5) then
FA:set_int(A6:get_int())
end
if(AAStage == 6) then
FA:set_int(A7:get_int())
end
if(AAStage > 6) then
AAStage = -1
end
AAStage = AAStage + 1
else
FA:set_int(FA:get_int() * -1)
end
waitbeforswitch = 0.5
end
if(Shot.fade < 0) then
table.remove(shots, i)
end
end
end
if(panictime > 0 and Panic:get_bool() == true) then
Jitter:set_bool(true)
JitterAmt:set_int(PanicJit:get_int())
FA:set_int(PanicFA:get_int())
panictime = (panictime - global_vars.frametime)
end
if(panictime == 0 and Panic:get_bool() == true) then
JitterAmt:set_int(jitterstore)
FA:set_int(storeFA)
Jitter:set_bool(jitval)
panictime = panictime - 1
end
end
function on_player_hurt(event)
if(engine.get_player_for_user_id(event:get_int("userid")) == 1 and Panic:get_bool() == true and panictime < 0) then
storeFA = FA:get_int()
jitterstore = JitterAmt:get_int()
jitval = Jitter:get_bool()
panictime = 2
end
end
function on_game_event(event)
local LP = entities.get_entity(engine.get_local_player())
if event:get_name() == "bullet_impact" then
local p = entities.get_entity(engine.get_player_for_user_id(event:get_int("userid")))
local startposx, startposy, startposz = p:get_eye_position()
if(LP ~= nil and LP:get_eye_position() ~= nil and engine.get_player_for_user_id(event:get_int("userid")) ~= engine.get_local_player() and p:get_prop("m_iTeamNum", 0) ~= LP:get_prop("m_iTeamNum", 0) and EnableAntiBrute:get_bool() == true) then
table.insert(shots,
{
Player = entities.get_entity(engine.get_player_for_user_id(event:get_int("userid"))),
X = event:get_float("x"),
Y = event:get_float("y"),
Z = event:get_float("z"),
posx = startposx,
posy = startposy,
posz = startposz,
fade = 0.1
})
end
end
end
function on_create_move(cmd)
local LP = entities.get_entity(engine.get_local_player())
if(LP and LP:get_hitbox_position(1) ~= nil) then
AntiBrute(LP)
end
end