UI.AddCheckbox("Predicted targeted hitbox");
Render.FadedCircle = function(x, y, radius, color) {
const step = color[3] / radius;
for (var i = 0; i <= radius; i++) {
Render.FilledCircle(x, y, i, [color[0], color[1], color[2], color[3] - step * i]);
}
}
function radToDeg(radians) {
return radians * 180 / Math.PI;
}
var Cache = {
values: []
};
Cache.InvokeCallback = function(label, state, func, args) {
if (this.values[label] == null)
this.values[label] = null;
if (this.values[label] === state)
return;
this.values[label] = state;
F
func.apply(null, args);
}
var Targeting = {
currentData: {target: null, hitbox: 0, last_hitbox: -1},
hitboxMap: [6, 5, 4, 3, 2],
weaponId: [
[2, 3, 4, 30, 32, 36, 61, 63],
[1, 64],
[40],
[9],
[11, 38]
],
configuration: [
"GENERAL",
"PISTOL",
"HEAVY PISTOL",
"SCOUT",
"AWP",
"AUTOSNIPER"
],
HITBOX: {
"UNSURE": -1,
"BODY": 3,
"HEAD": 0
}
};
Targeting.FindOptimalTarget = function() {
const players = Entity.GetEnemies();
const me = Entity.GetLocalPlayer();
if (!me || !Entity.IsAlive(me))
return null;
const eye_position = Entity.GetEyePosition(me);
const view_angles = Local.GetViewAngles();
var data = {fov: 180, id: null};
for (var i = 0; i < players.length; i++) {
const e = players[i];
if (!Entity.IsAlive(e) || Entity.IsDormant(e))
continue;
const head_position = Entity.GetHitboxPosition(e, 0);
const sub = [head_position[0] - eye_position[0], head_position[1] - eye_position[1], head_position[2] - eye_position[2]];
const pitch = -radToDeg(Math.atan2(sub[2], Math.sqrt(sub[0] ** 2 + sub[1] ** 2)));
const yaw = radToDeg(Math.atan2(sub[1], sub[0]));
const delta_x = Math.abs(view_angles[0] - pitch);
const delta_y = Math.abs(view_angles[1] % 360 - yaw % 360) % 360;
const fov = Math.sqrt(delta_x * delta_x + delta_y * delta_y);
if (fov < data.fov) {
data.fov = fov;
data.id = e;
}
}
return data.id;
}
Targeting.GetNextTargetedHitbox = function(e) {
if (!e)
return this.HITBOX.UNSURE;
const me = Entity.GetLocalPlayer();
const wpn = Entity.GetWeapon(me);
if (!me || !wpn)
return this.HITBOX.UNSURE;
const eye_position = Entity.GetEyePosition(me);
const wpn_id = Entity.GetProp(wpn, "CBaseAttributableItem", "m_iItemDefinitionIndex") & 0xFFFF;
const tab = "GENERAL";
for (var i = 0; i < this.weaponId.length; i++)
for (var j = 0; j < this.weaponId[i].length; j++)
if (this.weaponId[i][j] === wpn_id)
tab = this.configuration[i+1];
const prefer_baim = UI.GetValue("Rage", tab, "Accuracy", "Prefer body aim");
const is_head_aiming = UI.GetValue("Rage", tab, "Targeting", "Hitboxes") & (1 << 0);
if (prefer_baim)
return this.HITBOX.BODY;
if (!is_head_aiming)
return this.HITBOX.BODY;
const head = Trace.Bullet(me, e, eye_position, Entity.GetHitboxPosition(e, 0));
const stomach = Trace.Bullet(me, e, eye_position, Entity.GetHitboxPosition(e, 3));
const health = Entity.GetProp(e, "CBasePlayer", "m_iHealth");
if (!head[2] && this.currentData.last_hitbox === 0)
{
if (health < 25)
return this.HITBOX.BODY;
return this.HITBOX.HEAD;
}
this.currentData.last_hitbox = -1;
if (health < stomach[1])
{
return this.HITBOX.BODY;
}
return this.HITBOX.HEAD;
}
function hkCreateMove() {
const enabled = UI.GetValue("Misc", "JAVASCRIPT", "Script items", "Predicted targeted hitbox");
if (!enabled)
return;
const target = Targeting.FindOptimalTarget();
const hitbox = Targeting.GetNextTargetedHitbox(target);
Targeting.currentData.target = target;
Targeting.currentData.hitbox = hitbox;
}
function hkRagebotFire() {
const enabled = UI.GetValue("Misc", "JAVASCRIPT", "Script items", "Predicted targeted hitbox");
if (!enabled)
return;
const target = Event.GetInt("target_index");
if (target !== Targeting.currentData.target)
return;
Targeting.currentData.last_hitbox = Event.GetInt("hitbox");
}
function hkDraw() {
const enabled = UI.GetValue("Misc", "JAVASCRIPT", "Script items", "Predicted targeted hitbox");
if (!enabled)
return;
const me = Entity.GetLocalPlayer();
if (!me || !Entity.IsAlive(me))
return;
if (!Targeting.currentData.target || !Entity.IsAlive(Targeting.currentData.target) || Targeting.currentData.hitbox < 0)
return;
const wts = Render.WorldToScreen(Entity.GetHitboxPosition(Targeting.currentData.target, Targeting.currentData.hitbox));
const ssize = Render.GetScreenSize();
if (!wts)
return;
if (wts[0] < 0 || wts[0] > ssize[0] || wts[1] < 0 || wts[1] > ssize[1])
return;
Render.FadedCircle(wts[0], wts[1], 15, [255, 255, 255, 40]);
}
Cheat.RegisterCallback("CreateMove", "hkCreateMove");
Cheat.RegisterCallback("Draw", "hkDraw");
Cheat.RegisterCallback("ragebot_fire", "hkRagebotFire");
для нла сделайПофиксил для в4
апи иссуедля нла сделай
Не смог пофиксить фейд, работает как на скринедля нла сделай
local enabled = Menu.Switch('Predict targeted hitbox', 'Enable', false)
local circle_size = Menu.SliderIntColor('Predict targeted hitbox', 'Circle size', 3, 0, 20, Color.new(1.0, 1.0, 1.0, 0.15))
function radToDeg(radians)
return radians * 180 / math.pi;
end
local Targeting = {
currentData = { target = nil, hitbox = 0, last_hitbox = -1 },
HITBOX = { UNSURE = -1, BODY = 3, HEAD = 0}
};
Targeting.FindOptimalTarget = function()
local players = EntityList.GetPlayers()
local me = EntityList.GetLocalPlayer()
if not me or me:GetProp("DT_BasePlayer", "m_iHealth") <= 0 then return nil end
local eye_position = me:GetEyePosition()
local view_angles = EngineClient.GetViewAngles()
local data = { fov = 180, id = nil};
for _, e in pairs(players) do
if e:GetProp("DT_BasePlayer", "m_iHealth") <= 0 or e:IsDormant() then goto continue end
if e == me then goto continue end
local head_position = e:GetHitboxCenter(0);
local sub_x = head_position.x - eye_position.x
local sub_y = head_position.y - eye_position.y
local sub_z = head_position.z - eye_position.z
local pitch = -radToDeg(math.atan2(sub_z, math.sqrt(sub_x ^ 2 + sub_y ^ 2)));
local yaw = radToDeg(math.atan2(sub_y, sub_x));
local delta_x = math.abs(view_angles.pitch - pitch);
local delta_y = math.abs(view_angles.yaw % 360 - yaw % 360) % 360;
local fov = math.sqrt(delta_x * delta_x + delta_y * delta_y);
if fov < data.fov then
data.fov = fov;
data.id = e;
end
::continue::
end
return data.id;
end
Targeting.GetNextTargetedHitbox = function(e)
if not e then
return Targeting.HITBOX.UNSURE;
end
local me = EntityList.GetLocalPlayer()
local wpn = me:GetPlayer():GetActiveWeapon();
if not me or not wpn then
return Targeting.HITBOX.UNSURE;
end
local eye_position = me:GetEyePosition();
-- local wpn_name = Entity.GetName(wpn);
-- local tab = "General";
-- switch (wpn_name){
-- case 'ssg 08' : tab = 'SSG08'; break;
-- case 'awp' : tab = 'AWP'; break;
-- case 'scar 20' : tab = 'SCAR20'; break;
-- case 'g3sg1' : tab = 'G3SG1'; break;
-- case 'glock 18' : tab = 'Glock'; break;
-- case 'cz75 auto' : tab = 'CZ-75'; break;
-- case 'p2000' : tab = 'P2000'; break;
-- case 'usp s' : tab = 'USP'; break;
-- case 'p250' : tab = 'P250'; break;
-- case 'five seven' : tab = 'Five Seven'; break;
-- case 'desert eagle' : tab = 'Deagle'; break;
-- case 'r8 revolver' : tab = 'Revolver'; break;
-- case 'dual berretas' : tab = 'Dualies'; break;
-- case 'tec 9' : tab = 'Tec-9'; break;
-- default : tab = 'General'; break;
-- }
local prefer_baim = Menu.FindVar("Aimbot", "Ragebot", "Misc", "Body Aim"):Get() > 0 --UI.GetValue(['Rage', 'Accuracy', tab, 'Prefer body aim']);
local is_head_aiming = Menu.GetRageHitboxState(0) --UI.GetValue(['Rage', 'Target', tab, 'Hitboxes']) & (1 << 0);
if prefer_baim then
return Targeting.HITBOX.BODY;
end
if not is_head_aiming then
return Targeting.HITBOX.BODY;
end
local head = e:IsVisible(eye_position);
local stomach = Cheat.FireBullet(me, eye_position, e:GetHitboxCenter(3));
local health = e:GetProp("DT_BasePlayer", "m_iHealth");
if not head and Targeting.currentData.last_hitbox == 0 then
if health < 25 then
return Targeting.HITBOX.BODY
end
return Targeting.HITBOX.HEAD;
end
Targeting.currentData.last_hitbox = -1;
if health < stomach.damage then
return Targeting.HITBOX.BODY;
end
return Targeting.HITBOX.HEAD;
end
function hkCreateMove()
if not enabled:Get() then
return;
end
local target = Targeting.FindOptimalTarget();
local hitbox = Targeting.GetNextTargetedHitbox(target);
if EntityList.GetLocalPlayer() == target then return end
Targeting.currentData.target = target;
Targeting.currentData.hitbox = hitbox;
end
function hkRagebotFire(event)
if not enabled:Get() then
return;
end
Targeting.currentData.last_hitbox = event.hitgroup;
end
function hkDraw()
if not enabled:Get() then
return;
end
local me = EntityList.GetLocalPlayer();
if not me or me:GetProp("DT_BasePlayer", "m_iHealth") <= 0 then
return;
end
if not Targeting.currentData.target or Targeting.currentData.target:GetProp("DT_BasePlayer", "m_iHealth") <= 0 or Targeting.currentData.hitbox < 0 then
return;
end
local wts = Render.WorldToScreen(Targeting.currentData.target:GetHitboxCenter(Targeting.currentData.hitbox));
local ssize = EngineClient.GetScreenSize();
if not wts then
return;
end
if wts.x < 0 or wts.x > ssize.x or wts.y < 0 or wts.y > ssize.y then
return;
end
r = circle_size:GetColor().r; g = circle_size:GetColor().g; b = circle_size:GetColor().b; a = circle_size:GetColor().a;
Render.CircleFilled(Vector2.new(wts.x, wts.y), circle_size:Get(), 30, Color.new(r, g, b, a))
end
Cheat.RegisterCallback("prediction", hkCreateMove);
Cheat.RegisterCallback("draw", hkDraw);
Cheat.RegisterCallback("ragebot_shot", hkRagebotFire);