const setvalaa1 = function(name, value){
return UI.SetValue(["Rage", "Anti Aim", "General", name], value);
}
const getvalaa1 = function(name){
return UI.GetValue(["Rage", "Anti Aim", "General", name]);
}
const setvalaa2 = function(name, value){
return UI.SetValue(["Rage", "Anti Aim", "Directions", name], value);
}
const getvalaa2 = function(name){
return UI.GetValue(["Rage", "Anti Aim", "Directions", name]);
}
const keybind = UI.AddHotkey(["Rage", "Anti Aim", "General", "Key assignment"], "Legit AA", "Legit AA")
const legitaa_time = Global.Realtime();
var E = true;
var Defuse = false;
var x = 1;
var key = 0;
var distance = 0;
var distance1 = 0;
var original_aa = true;
function on_E(){
var buttons = UserCMD.GetButtons();
if(UI.GetValue(keybind)) {
if (original_aa)
{
restrictions_cache = UI.GetValue(["Config", "Cheat", "General", "Restrictions"]);
yaw_offset_cache = getvalaa2("Yaw offset");
jitter_offset_cache = getvalaa2("Jitter offset");
pitch_cache = getvalaa1("Pitch mode");
at_tar = getvalaa2("At targets");
autodir = getvalaa2("Auto direction");
original_aa = false;
}
UI.SetValue(["Config", "Cheat", "General", "Restrictions"], 0);
setvalaa2("Yaw offset", 180);
setvalaa2("Jitter offset", 0);
setvalaa1("Pitch mode", 0);
setvalaa2("At targets", 0);
setvalaa2("Auto direction", 0);
if (Input.IsKeyPressed(0x45) == true ){
E = false;
if(Globals.Realtime() > legitaa_time + 0.2){
if(E == false){
Cheat.ExecuteCommand("+use");
E = true;
}
if(E == true){
Cheat.ExecuteCommand("-use");
}
}
}else{
if(E == true){
Cheat.ExecuteCommand("-use");
E = false;
}
}
}else{
if (!original_aa){
UI.SetValue(["Config", "Cheat", "General", "Restrictions"], restrictions_cache);
setvalaa2("Yaw offset", yaw_offset_cache);
setvalaa2("Jitter offset", jitter_offset_cache);
setvalaa1("Pitch mode", pitch_cache);
setvalaa2("At targets", at_tar);
setvalaa2("Auto direction", autodir);
original_aa = true;
}
legitaa_time = Global.Realtime();
}
}
function Bomb(){
var buttons = UserCMD.GetButtons();
var C4 = Entity.GetEntitiesByClassID(129)[0];
var Host = Entity.GetEntitiesByClassID(97)[0];
if (C4){
var C4Loc = Entity.GetRenderOrigin(C4);
var local = Entity.GetLocalPlayer();
var lLoc = Entity.GetRenderOrigin(local)
distance = calcDist(C4Loc, lLoc);
//Cheat.Print(distance +"\n");
if(distance >= 100){
on_E()
}
}else if(Host != undefined){
var HLoc = Entity.GetRenderOrigin(Host);
var local = Entity.GetLocalPlayer();
var lLoc = Entity.GetRenderOrigin(local)
distance1 = calcDist(HLoc, lLoc);
//Cheat.Print(distance1 +"\n");
if(distance1 >= 100){
on_E()
}
}else{
on_E()
}
}
function calcDist(local, target) {
var lx = local[0];
var ly = local[1];
var lz = local[2];
var tx = target[0];
var ty = target[1];
var tz = target[2];
var dx = lx - tx;
var dy = ly - ty;
var dz = lz - tz;
return Math.sqrt(dx * dx + dy * dy + dz * dz);
}
Cheat.RegisterCallback("CreateMove","Bomb");