View difference between Paste ID: 2LQ3iJVA and iW6sds70
SHOW: | | - or go back to the newest paste.
1-
-- remake lua by zel
1+
  
2-
local engine_client 	= csgo.interface_handler:get_engine_client()
2+
/**
3-
local menu 				= fatality.menu
3+
 *
4-
local render            = fatality.render
4+
 * Title: Advanced body freestanding
5-
local input             = fatality.input
5+
 * Author: april#0001
6-
local config = fatality.config
6+
 * Description: Gives more anti-aim customization for advanced users.
7-
local entity_list = csgo.interface_handler:get_entity_list()
7+
 *
8-
local global_vars = csgo.interface_handler:get_global_vars()
8+
 */
9
10-
local stand_add_ref22 	= menu:get_reference("RAGE", "ANTI-AIM", "Standing", "Add")
10+
//region api
11-
local stand_add_ref 	= menu:get_reference("RAGE", "ANTI-AIM", "Standing", "Fake type", "Real around fake")
11+
12-
local stand_dir_ref 	= menu:get_reference("RAGE", "ANTI-AIM", "Standing", "Fake amount")
12+
// Localizing all of the functions in snake_case because why not.
13-
local move_add_ref22 	= menu:get_reference("RAGE", "ANTI-AIM", "Moving", "Add")
13+
const global_print = Global.Print, global_print_chat = Global.PrintChat, global_print_color = Global.PrintColor, global_register_callback = Global.RegisterCallback, global_execute_command = Global.ExecuteCommand, global_frame_stage = Global.FrameStage, global_tickcount = Global.Tickcount, global_tickrate = Global.Tickrate, global_tick_interval = Global.TickInterval, global_curtime = Global.Curtime, global_realtime = Global.Realtime, global_frametime = Global.Frametime, global_latency = Global.Latency, global_get_view_angles = Global.GetViewAngles, global_set_view_angles = Global.SetViewAngles, global_get_map_name = Global.GetMapName, global_is_key_pressed = Global.IsKeyPressed, global_get_screen_size = Global.GetScreenSize, global_get_cursor_position = Global.GetCursorPosition, global_play_sound = Global.PlaySound, global_play_microphone = Global.PlayMicrophone, global_stop_microphone = Global.StopMicrophone, global_get_username = Global.GetUsername, global_set_clan_tag = Global.SetClanTag, globals_tickcount = Globals.Tickcount, globals_tickrate = Globals.Tickrate, globals_tick_interval = Globals.TickInterval, globals_curtime = Globals.Curtime, globals_realtime = Globals.Realtime, globals_frametime = Globals.Frametime, sound_play = Sound.Play, sound_play_microphone = Sound.PlayMicrophone, sound_stop_microphone = Sound.StopMicrophone, cheat_get_username = Cheat.GetUsername, cheat_register_callback = cheat_register_callback = new Proxy(Cheat.RegisterCallback, { apply: function(_, _, args) { switch(args[0]) { case 'paint': Cheat.RegisterCallback('Draw', args[1]); break; case 'create_move': Cheat.RegisterCallback('CreateMove', args[1]); break; case 'fsn': Cheat.RegisterCallback('FrameStageNotify', args[1]); break; default: Cheat.RegisterCallback(args[0], args[1]); break; } } }), cheat_execute_command = Cheat.ExecuteCommand, cheat_frame_stage = Cheat.FrameStage, cheat_print = Cheat.Print, cheat_print_chat = Cheat.PrintChat, cheat_print_color = Cheat.PrintColor, local_latency = Local.Latency, local_get_view_angles = Local.GetViewAngles, local_set_view_angles = Local.SetViewAngles, local_set_clan_tag = Local.SetClanTag, local_get_real_yaw = Local.GetRealYaw, local_get_fake_yaw = Local.GetFakeYaw, local_get_spread = Local.GetSpread, local_get_inaccuracy = Local.GetInaccuracy, world_get_map_name = World.GetMapName, world_get_server_string = World.GetServerString, input_get_cursor_position = Input.GetCursorPosition, input_is_key_pressed = Input.IsKeyPressed, render_string = Render.String, render_text_size = Render.TextSize, render_line = Render.Line, render_rect = Render.Rect, render_filled_rect = Render.FilledRect, render_gradient_rect = Render.GradientRect, render_circle = Render.Circle, render_filled_circle = Render.FilledCircle, render_polygon = Render.Polygon, render_world_to_screen = Render.WorldToScreen, render_add_font = Render.AddFont, render_find_font = Render.FindFont, render_string_custom = Render.StringCustom, render_textured_rect = Render.TexturedRect, render_add_texture = Render.AddTexture, render_text_size_custom = Render.TextSizeCustom, render_get_screen_size = Render.GetScreenSize, ui_get_value = UI.GetValue, ui_set_value = UI.SetValue, ui_add_checkbox = UI.AddCheckbox, ui_add_slider_int = UI.AddSliderInt, ui_add_slider_float = UI.AddSliderFloat, ui_add_hotkey = UI.AddHotkey, ui_add_label = UI.AddLabel, ui_add_dropdown = UI.AddDropdown, ui_add_multi_dropdown = UI.AddMultiDropdown, ui_add_color_picker = UI.AddColorPicker, ui_add_textbox = UI.AddTextbox, ui_set_enabled = UI.SetEnabled, ui_get_string = UI.GetString, ui_get_color = UI.GetColor, ui_set_color = UI.SetColor, ui_is_hotkey_active = UI.IsHotkeyActive, ui_toggle_hotkey = UI.ToggleHotkey, ui_is_menu_open = UI.IsMenuOpen, convar_get_int = Convar.GetInt, convar_set_int = Convar.SetInt, convar_get_float = Convar.GetFloat, convar_set_float = Convar.SetFloat, convar_get_string = Convar.GetString, convar_set_string = Convar.SetString, event_get_int = Event.GetInt, event_get_float = Event.GetFloat, event_get_string = Event.GetString, entity_get_entities = Entity.GetEntities, entity_get_entities_by_class_i_d = Entity.GetEntitiesByClassID, entity_get_players = Entity.GetPlayers, entity_get_enemies = Entity.GetEnemies, entity_get_teammates = Entity.GetTeammates, entity_get_local_player = Entity.GetLocalPlayer, entity_get_game_rules_proxy = Entity.GetGameRulesProxy, entity_get_entity_from_user_i_d = Entity.GetEntityFromUserID, entity_is_teammate = Entity.IsTeammate, entity_is_enemy = Entity.IsEnemy, entity_is_bot = Entity.IsBot, entity_is_local_player = Entity.IsLocalPlayer, entity_is_valid = Entity.IsValid, entity_is_alive = Entity.IsAlive, entity_is_dormant = Entity.IsDormant, entity_get_class_i_d = Entity.GetClassID, entity_get_class_name = Entity.GetClassName, entity_get_name = Entity.GetName, entity_get_weapon = Entity.GetWeapon, entity_get_weapons = Entity.GetWeapons, entity_get_render_origin = Entity.GetRenderOrigin, entity_get_prop = Entity.GetProp, entity_set_prop = Entity.SetProp, entity_get_hitbox_position = Entity.GetHitboxPosition, entity_get_eye_position = Entity.GetEyePosition, trace_line = Trace.Line, trace_bullet = Trace.Bullet, usercmd_set_movement = UserCMD.SetMovement, usercmd_get_movement = UserCMD.GetMovement, usercmd_set_angles = UserCMD.SetAngles, usercmd_force_jump = UserCMD.ForceJump, usercmd_force_crouch = UserCMD.ForceCrouch, antiaim_get_override = AntiAim.GetOverride, antiaim_set_override = AntiAim.SetOverride, antiaim_set_real_offset = AntiAim.SetRealOffset, antiaim_set_fake_offset = AntiAim.SetFakeOffset, antiaim_set_l_b_y_offset = AntiAim.SetLBYOffset, exploit_get_charge = Exploit.GetCharge, exploit_recharge = Exploit.Recharge, exploit_disable_recharge = Exploit.DisableRecharge, exploit_enable_recharge = Exploit.EnableRecharge, ragebot_override_minimum_damage = Ragebot.OverrideMinimumDamage, ragebot_override_hitchance = Ragebot.OverrideHitchance, ragebot_override_accuracy_boost = Ragebot.OverrideAccuracyBoost, ragebot_override_multipoint_scale = Ragebot.OverrideMultipointScale, ragebot_force_safety = Ragebot.ForceSafety;
14-
local move_add_ref 	    = menu:get_reference("RAGE", "ANTI-AIM", "Moving", "Add")
14+
//endregion
15-
local move_dir_ref 	    = menu:get_reference("RAGE", "ANTI-AIM", "Moving", "Fake amount")
15+
16
//region dependencies
17-
-- added side for air
17+
18-
local air_add_ref2    = menu:get_reference("RAGE", "ANTI-AIM", "Air", "Add")
18+
/**
19-
local air_add_amount_2  = menu:get_reference("RAGE", "ANTI-AIM", "Air", "Add")
19+
 * @title BetterUI
20-
local air_dir_ref       = menu:get_reference("RAGE", "ANTI-AIM", "Air", "Fake amount")
20+
 * @version 2.0.0
21
 * @description A better UI system for Onetap
22-
local size_item = config:add_item( "size_item", 18 )
22+
 */
23-
local size_slider = menu:add_slider( "Arrows size", "visuals", "misc", "local", size_item, 0, 23, 1 )
23+
24-
local pos_item = config:add_item( "pos_item", 0 )
24+
var menu = [];
25-
local lise_slider = menu:add_slider( "Indicator", "rage", "aimbot", "misc" , pos_item, -1080, 0, 1 )
25+
const menu_spacer = "                                                                                  ";
26
27
/**
28
 * Creates a new menu label
29
 *
30-
local colour_item = config:add_item("C_colour_item", 19 ) -- 14
30+
 * @param label {string}
31-
local colour_slider = menu:add_slider("Arrows colour", "visuals", "misc", "local", colour_item, 0 , 20, 1)
31+
 */
32
menu.label = function(label)
33-
local rainbow_item = config:add_item( "C_rainbow_item", 0 )
33+
{
34-
local rainbow_item_checkbox = menu:add_checkbox( "Enable rainbow arrows", "visuals", "misc", "local", rainbow_item )
34+
    // Creates the label
35
    UI.AddLabel(label);
36-
local darkmode_item = config:add_item( "C_darkmode_item", 1.0 )
36+
};
37-
local darkmode_checkbox = menu:add_checkbox( "Enable dark mode for disabled arrows", "visuals", "misc", "local", darkmode_item )
37+
38
/**
39-
local directindicator_item = config:add_item( "C_directindicator_item", 1.0 )
39+
 * Creates a new menu element
40-
local global_vars = csgo.interface_handler:get_global_vars( )
40+
 *
41-
local engine = csgo.interface_handler:get_engine_client( )
41+
 * @param func {function}
42-
local entity_list = csgo.interface_handler:get_entity_list( )
42+
 * @param name {string}
43
 * @param label {string},
44
 * @param properties {array}
45
 */
46-
local side = false
46+
menu.call = function(func, name, label, properties)
47-
local side_2 = false
47+
{
48-
local side_3 = false
48+
    // Get properties
49-
local switch_key = 0x58     -- SWITCH KEY BY DEFAULT ITS  MAYBE "X"  // CHANGE IT HERE https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
49+
    const final_name = name + menu_spacer + label;
50-
local switch_held = false
50+
    var final_props = [final_name];
51-
local subpos = 0
51+
    const element_info_t = {
52
        path: ["Misc", "JAVASCRIPT", "Script Items", final_name]
53
    };
54-
-- draw arrows 1
54+
55-
function draw_side_arrow(x, y, size, color, side)
55+
    // If our properties aren't null, then pack them together.
56-
    if(side) then
56+
    if (properties != null)
57-
        for i = 0, (size - 1) do
57+
    {
58-
            render:rect(x + i, y + (i / 2) + 1, 1, size - i, color)
58+
        for (var i = 0; i < properties.length; i++)
59-
        end
59+
        {
60-
        
60+
            final_props.push(properties[i]);
61-
    else
61+
        }
62-
        for i = 0, (size - 1) do
62+
    }
63-
            render:rect(x - i, y + (i / 2) + 1, 1, size - i, color)
63+
64-
        end 
64+
    // Create our menu element and return properties
65-
    end  
65+
    func.apply(null, final_props);
66-
end
66+
    return element_info_t;
67
};
68
69-
-- draw arrows 2
69+
/**
70-
function draw_side_arrow_2(x, y, size_2, color, side_2)
70+
 * Creates a new menu reference
71-
    if(side_2) then
71+
 *
72-
        for i = 0, (size_2 - 1) do
72+
 * @param path {array}
73-
            render:rect(x + i, y + (i / 2) + 1, 1, size_2 - i, color)
73+
 */
74-
        end
74+
menu.reference = function(path)
75-
        
75+
{
76-
    else
76+
    const element_info_t = {
77-
        for i = 0, (size_2 - 1) do
77+
        path: path
78-
            render:rect(x - i, y + (i / 2) + 1, 1, size_2 - i, color)
78+
    };
79-
        end 
79+
80-
    end  
80+
    return element_info_t;
81-
end
81+
};
82
83-
local forcebaim_item = config:add_item( "forcebaimindicator", 0 )
83+
/**
84-
local slidewalk_item = config:add_item( "slidewalkindicator", 0 )
84+
 * Gets the value of a menu element
85-
local silent_item = config:add_item( "silentindicator", 0 )
85+
 *
86-
local fake_item = config:add_item("fakeindicator", 0 )
86+
 * @param elem {array}
87-
local choke_item = config:add_item("chokeindicator", 0 )
87+
 * @return {*}
88
 */
89
menu.get = function(elem)
90-
local indicator_combobox = menu:add_multi_combo( "Indicators", "rage", "aimbot", "misc" ):add_item( "Manual desync", directindicator_item ):add_item( "Force baim", forcebaim_item ):add_item( "SLOW", slidewalk_item ):add_item( "AA ON SHOT", silent_item ):add_item( "Fake", fake_item ):add_item( "Ping", choke_item )
90+
{
91
    // If the element doesn't exist
92
    if (!(elem.path))
93-
local indicator_font = render:create_font('Verdana', 25, 900, true) -- 32 700
93+
        throw new Error("[Menu] This element doesn't exist!");
94
95-
local fl_indicator = render:create_font( "Smallest Pixel-7", 11, 100, false )
95+
    // Returns the element's value
96
    return UI.GetValue.apply(null, elem.path);
97-
fatality.callbacks:add("paint", function()
97+
};
98
99-
   -- changing values from float to int
99+
/**
100-
    local size_slider = size_item:get_float() * 1 
100+
 * Gets the value of a menu element
101-
    local colour_value = colour_item:get_float( ) * 1
101+
 *
102
 * @param elem {array}
103-
    -- colours
103+
 * @return {*}
104-
    local white_colour = csgo.color(100, 100, 100, 100)
104+
 */
105-
    local black_colour = csgo.color(0, 0, 0, 100)
105+
menu.get_hotkey = function(elem)
106-
	
106+
{
107-
	  -- rainbow RGB
107+
    // If the label doesn't exist
108-
    local r = math.floor( math.sin( global_vars.realtime * 2) * 127 + 128 )
108+
    if (!(elem.path))
109-
    local g =  math.floor( math.sin( global_vars.realtime * 2 + 2 ) * 127 + 128 )
109+
        throw new Error("[Menu] This element doesn't exist!");
110-
    local b = math.floor( math.sin( global_vars.realtime * 2 + 4 ) * 127 + 128 );
110+
111
    // Returns the element's value
112
    return UI.IsHotkeyActive.apply(null, elem.path);
113-
    -- colour changer (final version) (pasted)
113+
};
114-
    if colour_value == 0 then
114+
115-
        custom_colour = csgo.color(255, 255, 255, 255) --< white
115+
/**
116-
        elseif colour_value == 1 then
116+
 * Gets the value of a menu element
117-
        custom_colour = csgo.color(0, 0, 0, 255) --< black
117+
 *
118-
        elseif colour_value == 2 then
118+
 * @param elem {array}
119-
        custom_colour = csgo.color(255, 0, 0, 255) --< deep-red
119+
 * @return {*}
120-
        elseif colour_value == 3 then
120+
 */
121-
        custom_colour = csgo.color(244,67,54, 255) --< red
121+
menu.get_color = function(elem)
122-
        elseif colour_value == 4 then
122+
{
123-
        custom_colour = csgo.color(255,87,34, 255) --< light-red
123+
    // If the label doesn't exist
124-
        elseif colour_value == 5 then
124+
    if (!(elem.path))
125-
        custom_colour = csgo.color(255,152,0, 255) --< deep-orange
125+
        throw new Error("[Menu] This element doesn't exist!");
126-
        elseif colour_value == 6 then
126+
127-
        custom_colour = csgo.color(255,193,7, 255) --< orange
127+
    // Returns the element's value
128-
        elseif colour_value == 7 then
128+
    return UI.GetColor.apply(null, elem.path);
129-
        custom_colour = csgo.color(255,235,59, 255) --< yellow
129+
};
130-
        elseif colour_value == 8 then
130+
131-
        custom_colour = csgo.color(205,220,57, 255) --< lime
131+
/**
132-
        elseif colour_value == 9 then
132+
 * Sets the value of a menu element
133-
        custom_colour = csgo.color(139,195,74, 255) --< light-green
133+
 *
134-
        elseif colour_value == 10 then
134+
 * @param elem {array}
135-
        custom_colour = csgo.color(76,175,80, 255) --< green
135+
 * @param value {any}
136-
        elseif colour_value == 11 then
136+
 */
137-
        custom_colour = csgo.color(0,150,136, 255) --< teal
137+
menu.set = function(elem, value)
138-
        elseif colour_value == 12 then
138+
{
139-
        custom_colour = csgo.color(0,188,212, 255) --< cyan
139+
    // If the label doesn't exist
140-
        elseif colour_value == 13 then
140+
    if (!(elem.path))
141-
        custom_colour = csgo.color(3,169,244, 255) --< ligh-blue
141+
        throw new Error("[Menu] This element doesn't exist!");
142-
        elseif colour_value == 14 then
142+
143-
        custom_colour = csgo.color(33,150,243, 255) --< blue
143+
    // Get properties
144-
        elseif colour_value == 15 then
144+
    const properties = elem;
145-
        custom_colour = csgo.color(63,81,181, 255) --< indigo
145+
    properties.path.push(value);
146-
        elseif colour_value == 16 then
146+
147-
        custom_colour = csgo.color(103,58,183, 255) --< deep-purple
147+
    // Set the element's value
148-
        elseif colour_value == 17 then
148+
    UI.SetValue.apply(null, properties.path);
149-
        custom_colour = csgo.color(156,39,176, 255) --< purple
149+
};
150-
        elseif colour_value == 18 then
150+
151-
        custom_colour = csgo.color(126,87,194, 255) --< -light-purple
151+
/**
152-
        elseif colour_value == 19 then
152+
 * Sets the value of a color picker
153-
        custom_colour = csgo.color(233,30,99, 255) --< deep-pink
153+
 *
154-
        elseif colour_value == 20 then
154+
 * @param elem {array}
155-
        custom_colour = csgo.color(236,64,122, 255) --< light-pink
155+
 * @param color {array|Color}
156-
        else
156+
 */
157-
        custom_colour = csgo.color(255, 255, 255, 255) --< default
157+
menu.set_color = function(elem, color)
158-
    end
158+
{
159-
	
159+
    // If the label doesn't exist
160-
	-- chroma mode for arrows
160+
    if (!(elem.path))
161-
	if rainbow_item:get_bool() then
161+
        throw new Error("[Menu] This element doesn't exist!");
162-
        custom_colour = csgo.color(r, g, b, 255) 
162+
163-
    end
163+
    // Get properties
164
    const properties = elem;
165-
    -- dark mode for arrows
165+
    properties.path.push(color);
166-
    if darkmode_item:get_bool() then
166+
167-
        white_colour = black_colour 
167+
    // Set the element's value
168-
    end
168+
    UI.SetColor.apply(null, properties.path);
169-
	
169+
};
170-
	
170+
171-
	local local_player = entity_list:get_localplayer()
171+
/**
172-
	
172+
 * Sets the value of a color picker
173-
	local screen_size = render:screen_size()
173+
 *
174
 * @param elem {array}
175-
-- check is player in game
175+
 */
176-
    if(engine_client:is_in_game()) then	
176+
menu.toggle = function(elem)
177-
	
177+
{
178-
	-- is local player alive,if not,then return
178+
    // If the label doesn't exist
179-
	  if(local_player ~= nil and local_player:is_alive()) then
179+
    if (!(elem.path))
180-
	  
180+
        throw new Error("[Menu] This element doesn't exist!");
181-
	
181+
182-
	local slide = menu:get_reference( "rage", "aimbot", "aimbot", "slide" )
182+
    // Set the element's value
183-
    local forcebaim = menu:get_reference( "rage", "aimbot", "aimbot", "force fallback" )
183+
    UI.ToggleHotkey.apply(null, elem.path);
184-
	local silent = menu:get_reference( "rage", "aimbot", "aimbot", "Silent" )
184+
};
185-
	local fake = menu:get_reference( "rage", "anti-aim", "general", "anti-aim" ) 
185+
186-
	local flchoke = menu:get_reference( "rage", "anti-aim", "general", "anti-aim" ) 
186+
/**
187-
	   local velocity = local_player:get_var_vector( "CBasePlayer->m_vecVelocity[0]" )
187+
 * Changes the visibility of a menu elements
188-
	   
188+
 *
189-
        local vel_2d = math.ceil( math.sqrt( math.abs( velocity.x ) * math.abs( velocity.x ) + math.abs( velocity.y ) * math.abs( velocity.y ) ) )
189+
 * @param elem {array}
190-
		
190+
 * @param visible {boolean}
191-
		
191+
 */
192-
  local frame_rate = 0.0;
192+
menu.visibility = function(elem, visible)
193-
    
193+
{
194-
        function get_fps( )
194+
    // If the label doesn't exist
195-
        frame_rate = 0.9 * frame_rate + ( 1.0 - 0.9 ) * global_vars.frametime;
195+
    if (!(elem.path))
196-
        return math.floor( ( 1.0 / frame_rate ) + 0.5 );
196+
        throw new Error("[Menu] This element doesn't exist!");
197-
		
197+
198-
    end
198+
    // Get properties
199-
	  local fps = get_fps( )
199+
    const properties = elem;
200-
	local clr_i = csgo.color(fps + 150, 255 - vel_2d, 0, 255) 
200+
    properties.path.push(visible);
201-
	local clr_a = csgo.color(255, 255, 255, 255) 
201+
202-
	local yaw = fps / 100 * 4
202+
    // Change the element's visibility
203-
	local syaw = 255 - vel_2d
203+
    UI.SetEnabled.apply(null, properties.path);
204-
	local lyaw = yaw / 62
204+
};
205-
	 local function get_ping( )
205+
206-
        if not engine:is_connected( ) then
206+
/**
207-
    return 0 end
207+
 * @title Vector
208-
    
208+
 * @description Simple 3d vector system
209-
        return math.abs( engine:get_ping( ) )
209+
 *
210-
    end
210+
 * @typedef Vector {x: number, y: number, z: number}
211-
	 local ping = get_ping( )
211+
 */
212-
	
212+
var vector = {
213-
	if silent:get_bool() then
213+
    _class: 'vector'
214-
        sl = true
214+
};
215-
    else
215+
216-
        sl = false
216+
/**
217-
    end
217+
 * @brief Creates a new 3d vector instance.
218-
	
218+
 * @param data {array}
219-
	if forcebaim:get_bool() then
219+
 * @returns {Vector}
220-
        fb = true
220+
 */
221-
    else
221+
vector.new = function(data)
222-
        fb = false
222+
{
223-
    end
223+
    return {
224
        x: data[0],
225-
    if slide:get_bool() then
225+
        y: data[1],
226-
        sw = true
226+
        z: data[2]
227-
    else
227+
    };
228-
        sw = false
228+
};
229-
    end
229+
230-
	
230+
/**
231-
	if fake:get_bool() then
231+
 * @brief Realizes a mathematical operation between two vectors.
232-
        fk = true
232+
 * @param vec {Vector}
233-
    else
233+
 * @param vec2 {Vector}
234-
        fk = false
234+
 * @param operation {string}
235-
    end
235+
 * @returns {Vector}
236-
	
236+
 */
237-
	if flchoke:get_bool() then
237+
vector.operate = function(vec, vec2, operation)
238-
        fl = true
238+
{
239-
    else
239+
  switch (operation)
240-
        fl = false
240+
  {
241-
    end
241+
      case '+':
242-
	 local addxx = pos_item:get_int()
242+
          return {
243-
	
243+
              x: vec.x + vec2.x,
244-
	if silent_item:get_bool() then 
244+
              y: vec.y + vec2.y,
245-
 
245+
              z: vec.z + vec2.z
246-
        render:indicator( 9, screen_size.y - 140 + addxx , "SHOT", sl , -1)
246+
          };
247-
		subpos = 125
247+
248
      case '-':
249-
    end
249+
          return {
250-
	
250+
              x: vec.x - vec2.x,
251-
	if forcebaim_item:get_bool() then 
251+
              y: vec.y - vec2.y,
252
              z: vec.z - vec2.z
253-
        render:indicator( 9, screen_size.y - 170 + addxx, "BAIM", fb , -1)
253+
          };
254-
		subpos = 100
254+
255
      case '*':
256-
    end
256+
          return {
257-
	
257+
              x: vec.x * vec2.x,
258-
	if fake_item:get_bool() then		
258+
              y: vec.y * vec2.y,
259
              z: vec.z * vec2.z
260-
render:text(indicator_font, 9, screen_size.y - 80 + addxx, "FAKE", clr_i, fk)
260+
          };
261-
--render:text(indicator_font, 70, screen_size.y - 80, yaw, clr_i, fk)
261+
262-
render:text(indicator_font, 9, screen_size.y - 200 + addxx, "YAW", clr_a, fk)
262+
      case '/':
263-
render:text(indicator_font, 70, screen_size.y - 200 + addxx , yaw, clr_a, fk)
263+
          return {
264-
--render:text(indicator_font, 160, screen_size.y - 80, syaw, clr_i, fk)
264+
              x: vec.x / vec2.x,
265-
       -- render:indicator( 9, screen_size.y - 80 , "FAKE", clr_i , fk)
265+
              y: vec.y / vec2.y,
266-
		subpos = 0
266+
              z: vec.z / vec2.z
267
          };
268-
    end
268+
269-
	
269+
      default:
270-
	if choke_item:get_bool( ) then
270+
          throw new Error("[Vector] Invalid operation type.");
271-
	
271+
  }
272-
	   render:text(indicator_font, 9, screen_size.y - 230 + addxx, "PING", clr_a, fk)
272+
};
273-
		 render:text(indicator_font, 75, screen_size.y - 230 + addxx, ping, clr_a, fk)
273+
274-
		
274+
/**
275-
    end
275+
 * @brief Returns the 2d length of a vector.
276-
	
276+
 * @param vec {Vector}
277-
	if slidewalk_item:get_bool() then 
277+
 * @returns {number}
278
 */
279-
        render:indicator( 10, screen_size.y - 110 + addxx , "SLOW", sw , -1) -- 440 -- 80
279+
vector.length2d = function(vec)
280-
		subpos = 75
280+
{
281
    return Math.sqrt(vec.x * vec.x + vec.y * vec.y);
282-
    end
282+
};
283-
	
283+
284-
        -- Logic
284+
/**
285-
        if input:is_key_down(switch_key) then
285+
 * @brief Converts a vector to angles.
286-
            if not switch_held then
286+
 * @param vec
287-
                side = not side
287+
 * @returns {Vector}
288
 */
289-
                if side then
289+
vector.angles = function(vec)
290-
                    stand_add_ref22:set_float(-52) -- STANDING YAW LEFT SIDE //
290+
{
291-
                    stand_dir_ref:set_int(100)      -- CUSTOM FAKE .. MOVING LEFT // 
291+
    return {
292-
                    move_add_ref:set_float(-52)     -- MOVING YAW LEFT SIDE // 
292+
        x: -Math.atan2(vec.z, this.length2d(vec)) * 180 / Math.PI,
293-
                    move_dir_ref:set_int(100)       -- CUSTOM FAKE // MOVING LEFT //
293+
        y: Math.atan2(vec.y, vec.x) * 180 / Math.PI,
294-
					air_dir_ref:set_int(100)        -- AIR LEFT SIDE
294+
        z: 0
295-
                else
295+
    };
296-
                    stand_add_ref22:set_float(52)  -- STANDING YAW RIGHT SIDE // 
296+
};
297-
                    stand_dir_ref:set_int(-100)       -- CUSTOM FAKE // STAND RIGHT // 
297+
298-
                    move_add_ref:set_float(52)       -- MOVING YAW RIGHT SIDE //
298+
/**
299-
                    move_dir_ref:set_int(-100)        -- CUSTOM FAKE // MOVING RIGHT //
299+
 * @brief Calculates the fov delta between two points based on a specific view angles.
300-
                    air_dir_ref:set_int(-100)			-- AIR RIGHT SIDE			
300+
 * @param origin {Vector}
301-
                end
301+
 * @param destination {Vector}
302-
            end
302+
 * @param view {Vector}
303
 * @returns {number}
304-
            switch_held = true
304+
 */
305-
        else
305+
vector.fov_to = function(origin, destination, view)
306-
            switch_held = false
306+
{
307-
        end
307+
    const angles = this.angles(this.operate(destination, origin, '-'));
308-
		
308+
309-
		if directindicator_item:get_bool() then
309+
    const delta = this.new(
310-
		    dc = true
310+
        [
311-
        else
311+
            Math.abs(view.x - angles.x),
312-
            dc = false
312+
            Math.abs(view.y % 360 - angles.y % 360) % 360,
313-
		end
313+
            0
314-
		
314+
        ]
315-
		local indicator_white = csgo.color(255, 255, 255, 255) 
315+
    );
316-
		
316+
317-
		-- B1G LOGIC OF MY RENDER
317+
    if (delta.y > 180)
318
        delta.y = 360 - delta.y;
319-
        if not side then
319+
320-
		
320+
    return this.length2d(delta);
321
};
322-
            draw_side_arrow(screen_size.x / 2 - 10 - 30 + 1, screen_size.y / 2 - 10, size_slider, custom_colour, side)	--right	
322+
323-
			side_2 = true;
323+
/**
324-
			draw_side_arrow_2(screen_size.x / 2 + 10 + 30 + 1, screen_size.y / 2 - 10, size_slider, white_colour, side_2) --left disabled 
324+
 * @brief Unpacks a vector object into an array.
325-
            
325+
 * @param vec {Vector}
326-
			if directindicator_item:get_bool() then
326+
 * @returns {[number, number, number]}
327-
       --     render:indicator( 9, screen_size.y - 75  - subpos, "DC RIGHT", dc , -1)
327+
 */
328-
	         render:text(indicator_font, 9, screen_size.y - 260, "LEFT", indicator_white, dc)
328+
vector.to_array = function(vec)
329-
		    subpos = 25
329+
{
330-
           end			
330+
    return [
331-
			
331+
        vec.x,
332-
        else
332+
        vec.y,
333-
			draw_side_arrow(screen_size.x / 2 + 10 + 30 + 1, screen_size.y / 2 - 10, size_slider, custom_colour, side) --right
333+
        vec.z
334-
				
334+
    ];
335-
			side_2 = false;
335+
};
336-
			draw_side_arrow_2(screen_size.x / 2 - 10 - 30 + 1, screen_size.y / 2 - 10, size_slider, white_colour, side_2) --left disabled
336+
337-
			
337+
/**
338-
            if directindicator_item:get_bool() then
338+
 * @brief Normalizes an yaw angle.
339-
		--	render:indicator( 9, screen_size.y - 75  - subpos, "DC LEFT", dc , -1)
339+
 * @param angle {number}
340-
		       render:text(indicator_font, 9, screen_size.y - 260 , "RIGHT", indicator_white, dc)
340+
 * @returns {number}
341-
		    subpos = 25	
341+
 */
342-
			end
342+
function normalize_yaw(angle)
343-
        end
343+
{
344-
    end
344+
    var adjusted_yaw = angle;
345-
 end
345+
    if (adjusted_yaw < -180)
346-
end)
346+
        adjusted_yaw += 360;
347
348
    if (adjusted_yaw > 180)
349
        adjusted_yaw -= 360;
350
351
    return adjusted_yaw;
352
}
353
354
//endregion
355
356
//region main
357
358
// Create our main instance
359
var plugin = {
360
    _info: {
361
        _title: "Advanced body freestanding",
362
        _version: "1.0.0",
363
        _author: "april#0001"
364
    },
365
366
    last_hit_lby: []
367
};
368
369
//endregion
370
371
//region menu
372
373
// Create our menu elements
374
const enable = menu.call(ui_add_checkbox, "Advanced body freestanding", "lby_enable", []);
375
const body = menu.call(ui_add_dropdown, "Body freestanding", "lby_body_mode", [["Hide real angle", "Hide fake angle"]]);
376
const smart = menu.call(ui_add_checkbox, "Smart switch", "lby_smart", []);
377
378
// Declare our references
379
const ref_inverter = menu.reference(["Anti-Aim", "Fake angles", "Inverter"]);
380
const ref_inverter_legit = menu.reference(["Anti-Aim", "Legit Anti-Aim", "Direction key"]);
381
const ref_ragebot = menu.reference(["Rage", "GENERAL", "General", "Enabled"]);
382
383
//endregion
384
385
//region functions
386
387
/**
388
 * @brief Inverts the lower body yaw to the specified value.
389
 * @param state {number} Whether or not to invert the lower body yaw.
390
 */
391
function update_anti_aim_state(state)
392
{
393
    // If our rage aimbot is enabled, than we should invert the
394
    // rage anti-aim.
395
    if (menu.get(ref_ragebot))
396
    {
397
        // Check if our inverter's state is the same as our desired one.
398
        // If not, then toggle the hotkey to invert it.
399
        if (menu.get_hotkey(ref_inverter) !== state)
400
            menu.toggle(ref_inverter);
401
402
        // Return because we don't wanna do the same to the legit anti-aim's state.
403
        return;
404
    }
405
406
    // Invert the state because the legit anti-aim's inverter is different
407
    // from the rage one.
408
    state = (state + 1) % 2;
409
410
    // Check if our inverter's state is the same as our desired one.
411
    // If not, then toggle the hotkey to invert it.
412
    if (menu.get_hotkey(ref_inverter_legit) !== state)
413
        menu.toggle(ref_inverter_legit);
414
}
415
416
/**
417
 * @brief Gets the closest (FOV-based) enemy and returns its entity id.
418
 * @returns {number}
419
 */
420
function get_closest_target( )
421
{
422
    // Get our entities.
423
    const players = entity_get_enemies( );
424
    const me = entity_get_local_player( );
425
426
    // Initialize our data array.
427
    const data = {id: null, fov: 180};
428
429
    // Loop for each player in the server.
430
    for (var i = 0; i < players.length; i++)
431
    {
432
        // Get the current player.
433
        const e = players[i];
434
435
        // Get our eye's position, the player's head position and our view angles.
436
        const destination = vector.new(entity_get_hitbox_position(e, 0)), origin = vector.new(entity_get_eye_position(me));
437
        const angles = vector.new(local_get_view_angles());
438
439
        // Calculate the FOV distance.
440
        const fov = vector.fov_to(origin, destination, angles);
441
442
        // If our FOV distance is lower than the cached one, then it means that
443
        // there's another player which is even closer to our crosshair.
444
        if (fov < data.fov)
445
        {
446
            // Cache this entity and our current FOV distance for further
447
            // calculations.
448
            data.id = e;
449
            data.fov = fov;
450
        }
451
    }
452
453
    // Return the closest entity to our crosshair.
454
    return data.id;
455
}
456
457
/**
458
 * @brief Gets which anti-aim side matches your settings the best. Or, in other words, does freestanding.
459
 */
460
function get_optimal_angle( )
461
{
462
    // Get current lower body yaw mode
463
    const _mode = menu.get(body);
464
465
    // Get some properties.
466
    const me = entity_get_local_player( );
467
468
    // And more properties..
469
    const origin = vector.new(entity_get_render_origin(me));
470
    var yaw = local_get_view_angles( )[1];
471
    var data = {left: 0, right: 0};
472
473
    // Loops for every angle from the left of your yaw to the right of your yaw
474
    // in steps of 30, resulting in 3 steps per side.
475
    for (var r = yaw - 90; r <= yaw + 90; r += 30)
476
    {
477
        // If our current angle is the center one then there's no need
478
        // to do anything with it.
479
        if (r === yaw)
480
            continue;
481
482
        // Convert our angle to radians
483
        const rad = r * Math.PI / 180;
484
485
        // Create our destination point based on current angle.
486
        const point = vector.operate(
487
            origin,
488
            vector.new([
489
                256 * Math.cos(rad),
490
                256 * Math.sin(rad),
491
                0
492
            ]),
493
            "+"
494
        );
495
496
        // Trace a line from our player's origin to the current point.
497
        // Using this to check the trace's fraction (m_flFraction) until
498
        // it hits something and then add it to our data array.
499
        //
500
        // This is how my 'environmental freestanding' logic is made.
501
        // The side with lower fractions is the side which is logically
502
        // closer to the player's head.
503
        const line = trace_line(me, vector.to_array(origin), vector.to_array(point));
504
505
        // Get which side we're iterating on.
506
        const side = r < yaw ? "left" : "right";
507
508
        // Update our data array.
509
        data[side] += line[1];
510
    }
511
512
    // Calculates an average for both sides.
513
    data.left /= 3;
514
    data.right /= 3;
515
516
    // If our left avg. fractions are greater than the right ones, then return
517
    // the number 0 which corresponds to the right side, or, in the Hide fake angle mode,
518
    // return 1 which corresponds to the left side.
519
    if (data.left > data.right)
520
        return _mode === 0 ? 0 : 1;
521
522
    // Does the same thing as above, except the right avg. fractions are greater than
523
    // the left ones.
524
    return _mode === 0 ? 1 : 0;
525
}
526
527
/**
528
 * @brief Updates our anti-aim based on the current freestanding mode and input.
529
 */
530
function update_anti_aim( )
531
{
532
    // Get our local player.
533
    const me = entity_get_local_player( );
534
535
    // Check if our player is valid and alive.
536
    if (!entity_is_valid(me) || !entity_is_alive(me))
537
        return;
538
539
    // Get if our anti-aim is on smart mode.
540
    const _smart = menu.get(smart);
541
542
    // If our anti-aim is set to 'Smart', then the entire logic is different.
543
    // The smart mode does not use freestanding as input, it uses data from
544
    // other users as input.
545
    if (_smart)
546
    {
547
        // Get our FOV-based target.
548
        const target = get_closest_target( );
549
550
        // Check if our target is valid.
551
        // Otherwise, just return our current freestanding angle.
552
        if (target == null)
553
        {
554
            update_anti_aim_state(get_optimal_angle( ));
555
            return;
556
        }
557
558
        // Check if our target has already hit us.
559
        // If not, then just return current freestanding angle.
560
        if (plugin.last_hit_lby[target] == null)
561
        {
562
            update_anti_aim_state(get_optimal_angle( ));
563
            return;
564
        }
565
566
        // Return the opposite angle to the last hit angle.
567
        // In this case if the inverter was off, now return on.
568
        if (plugin.last_hit_lby[target] === 0)
569
        {
570
            update_anti_aim_state(1);
571
            return;
572
        }
573
574
        // Or, if the inverter was on, return off.
575
        update_anti_aim_state(0);
576
        return;
577
    }
578
579
    // If our anti-aim is not on smart mode, then we're just using regular
580
    // freestanding. So, do freestanding.
581
    update_anti_aim_state(get_optimal_angle( ));
582
}
583
584
function do_indicators( )
585
{
586
    // Get our local player.
587
    const me = entity_get_local_player( );
588
589
    // Check if our player is valid and alive.
590
    if (!entity_is_valid(me) || !entity_is_alive(me))
591
        return;
592
593
    // Get our drawing properties.
594
    const y = render_get_screen_size( )[1];
595
596
    // Get our anti-aim info.
597
    const yaw = local_get_real_yaw( ), fake = local_get_fake_yaw( );
598
    var delta = Math.round(normalize_yaw(yaw - fake) / 2), abs = Math.abs(delta);
599
600
    // If we're using legit anti-aim, invert the delta.
601
    // Doing this to fix the indicators because legit
602
    // anti-aim inverter is different.
603
    if (menu.get(ref_ragebot))
604
        delta *= -1;
605
606
    // Render the 'FAKE' indicator
607
    // Totally did not copy it from gamesense.
608
    render_string(10, y - 99, 0, "FAKE", [10, 10, 10, 125], 4);
609
    render_string(10, y - 100, 0, "FAKE", [192 - (abs * 71 / 60), 32 + (abs * 146 / 60), 28, 200], 4);
610
611
    // Render the bar's background
612
    render_filled_rect(12, y - 68, 64, 4, [10, 10, 10, 125]);
613
614
    // Draw this small tile to fix a small issue that was driving me crazy.
615
    render_filled_rect(43, y - 67, 1, 2, [232, 232, 232, 200]);
616
617
    // Render the desync's length under the bar.
618
    render_string(41, y - 63, 1, abs.toString( ), [232, 232, 232, 200], 3);
619
    render_circle(48, y - 61, 1, [232, 232, 232, 200]);
620
621
    // If our delta is positive, than our desync is headed to the right.
622
    if (delta > 0)
623
    {
624
        // So, fill the bar from the center to the right, accounting for the desync's length.
625
        render_filled_rect(44, y - 67, abs * 31 / 60, 2, [232, 232, 232, 200]);
626
        return;
627
    }
628
629
    // If our delta is not positive, than our desync is headed to the left.
630
    // So, fill the bar from the center to the left.
631
    render_filled_rect(44 - abs * 31 / 60, y - 67, abs * 31 / 60, 2, [232, 232, 232, 200]);
632
}
633
634
/**
635
 * @callback create_move
636
 * @brief Handles our plugin's logic.
637
 */
638
function on_tick( )
639
{
640
    // Checks whether or not our script is enabled.
641
    if (!(menu.get(enable)))
642
        return;
643
644
    // Does the freestanding.
645
    update_anti_aim( );
646
}
647
648
function on_frame( )
649
{
650
    // Checks whether or not our script is enabled.
651
    if (!(menu.get(enable)))
652
        return;
653
654
    // Draws our indicators
655
    do_indicators( );
656
}
657
658
/**
659
 * @callback player_hurt
660
 * @brief Handles the last hit LBY logic.
661
 */
662
function on_player_hurt( )
663
{
664
    // Get the event's entities.
665
    const me = entity_get_local_player( );
666
    const attacker = entity_get_entity_from_user_i_d(event_get_int("attacker"));
667
    const userid = entity_get_entity_from_user_i_d(event_get_int("userid"));
668
669
    // Checks if our local player was the one getting hurt and not the one attacking.
670
    // Or, in other words, check if we got hurt.
671
    if (me !== attacker && me === userid)
672
    {
673
        // Update the last hit lower body global.
674
        plugin.last_hit_lby[attacker] = menu.get_hotkey(ref_inverter);
675
    }
676
}
677
678
/**
679
 * @callback round_start, player_connect_full
680
 * @brief Resets the last hit LBY list whenever the round ends or you switch servers.
681
 */
682
function reset( )
683
{
684
    // Reset the last lower body state.
685
    plugin.last_hit_lby = [];
686
}
687
688
689
//endregion
690
691
//region callbacks
692
693
// Register our 'create_move' callback.
694
cheat_register_callback(
695
    'create_move', 'on_tick'
696
);
697
698
// Register our 'paint' callback.
699
cheat_register_callback(
700
    'paint', 'on_frame'
701
);
702
703
// Register our 'player_hurt' callback.
704
cheat_register_callback(
705
    'player_hurt', 'on_player_hurt'
706
);
707
708
// Register our 'player_connect_full' callback.
709
cheat_register_callback(
710
    'player_connect_full', 'reset'
711
);
712
713
//endregion