Advertisement
Mister_Stefan

antibrute gs

Jul 25th, 2021
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.03 KB | None | 0 0
  1. local table_pack, table_sort, table_remove, table_unpack, table_concat, table_insert = table.pack, table.sort, table.remove, table.unpack, table.concat, table.insert
  2. local globals_realtime, globals_absoluteframetime, globals_tickcount, globals_lastoutgoingcommand, globals_curtime, globals_mapname, globals_tickinterval, globals_framecount, globals_frametime, globals_maxplayers = globals.realtime, globals.absoluteframetime, globals.tickcount, globals.lastoutgoingcommand, globals.curtime, globals.mapname, globals.tickinterval, globals.framecount, globals.frametime, globals.maxplayers
  3. local table_insert = table.insert
  4. local table_remove = table.remove
  5. local globals_realtime = globals.realtime
  6. local globals_tickcount = globals.tickcount
  7. local globals_tickinterval = globals.tickinterval
  8. local globals_frametime = globals.frametime
  9. local globals_absoluteframetime = globals.absoluteframetime
  10. local client_draw_text = client.draw_text
  11. local client_screen_size = client.screen_size
  12. local ui_get = ui.get
  13. local ui_set_visible = ui.set_visible
  14. local math_floor = math.floor
  15. local math_sqrt = math.sqrt
  16. local math_min = math.min
  17. local math_abs = math.abs
  18. local string_format = string.format
  19.  
  20. local label_text = ui.new_label("AA", "Other", "        [----Anti-Bruteforce----]")
  21. local combo = ui.new_combobox("AA", "Other", "\ncombo1", { "-", "Enable"})
  22. local body_yaw_default = ui.new_slider("AA", "Other", "Body Yaw Reset Value", -180, 180, 60)
  23. local fake_yaw_default = ui.new_slider("AA", "Other", "Fake Yaw Reset Value", 0, 60, 60)
  24. local logs_indic = ui.new_checkbox("AA", "Other", "Log")
  25. local color_logs = ui.new_color_picker("AA", "Other", "Log", 0, 204 , 255, 255)
  26. local label_text1 = ui.new_label("AA", "Other", "Indicator")
  27. local combo_indicator = ui.new_multiselect("AA", "Other", "\ncombo2", {"Anti-Bruteforce"})
  28.  
  29. --timer
  30. local reset_timer = ui.new_slider("AA", "Other", "Reset AA after X seconds", 0, 6, 3)
  31. local reset_time = 0
  32. local timer_indicator = 0
  33.  
  34. --reference
  35. local _, slider = ui.reference("AA", "Anti-aimbot angles", "Body yaw")
  36. local slider2 = ui.reference("AA", "Anti-aimbot angles", "Fake yaw limit")
  37. local bodyyaw, yaw = ui.reference("AA", "Anti-aimbot angles", "Body Yaw")
  38. local yawbase = ui.reference("AA", "Anti-aimbot angles", "Yaw Base")
  39. local freestanding_body_yaw = ui.reference("AA", "Anti-aimbot angles", "Freestanding body yaw")
  40.  
  41. local angle = 0
  42. client.set_event_callback("setup_command", function(c)
  43.     if c.chokedcommands == 0 then
  44.         if c.in_use == 1 then
  45.             --angle = 0
  46.             angle = math.min(57, math.abs(entity.get_prop(entity.get_local_player(), "m_flPoseParameter", 11)*120-60))
  47.         else
  48.             angle = math.min(57, math.abs(entity.get_prop(entity.get_local_player(), "m_flPoseParameter", 11)*120-60))
  49.         end
  50.     end
  51. end)
  52.  
  53. local function includes( table, key )
  54.     local state = false
  55.     for i=1, #table do
  56.         if table[i] == key then
  57.             state = true
  58.             break
  59.         end
  60.     end
  61.     return state
  62. end
  63.  
  64. local function contains(table, val)
  65.  
  66.     for i=1, #table do
  67.        
  68.         if table[i] == val then
  69.            
  70.             return true
  71.            
  72.         end
  73.        
  74.     end
  75.    
  76.     return false
  77.    
  78. end
  79.  
  80. local function hsv_to_rgb(h, s, v)
  81.     local r, g, b
  82.  
  83.     local i = math.floor(h * 6);
  84.     local f = h * 6 - i;
  85.     local p = v * (1 - s);
  86.     local q = v * (1 - f * s);
  87.     local t = v * (1 - (1 - f) * s);
  88.  
  89.     i = i % 6
  90.  
  91.     if i == 0 then r, g, b = v, t, p
  92.     elseif i == 1 then r, g, b = q, v, p
  93.     elseif i == 2 then r, g, b = p, v, t
  94.     elseif i == 3 then r, g, b = p, q, v
  95.     elseif i == 4 then r, g, b = t, p, v
  96.     elseif i == 5 then r, g, b = v, p, q
  97.     end
  98.  
  99.     return r * 255, g * 255, b * 255
  100. end
  101.  
  102. local function rgb_rainbow(frequency, rgb_split_ratio)
  103.     local r, g, b, a = hsv_to_rgb(globals.realtime() * frequency, 1, 1, 1)
  104.  
  105.     r = r * rgb_split_ratio
  106.     g = g * rgb_split_ratio
  107.     b = b * rgb_split_ratio
  108.     return r, g, b
  109. end
  110.  
  111. local function GetClosestPoint(A, B, P)
  112.     local a_to_p = { P[1] - A[1], P[2] - A[2] }
  113.     local a_to_b = { B[1] - A[1], B[2] - A[2] }
  114.  
  115.     local atb2 = a_to_b[1]^2 + a_to_b[2]^2
  116.  
  117.     local atp_dot_atb = a_to_p[1]*a_to_b[1] + a_to_p[2]*a_to_b[2]
  118.     local t = atp_dot_atb / atb2
  119.    
  120.     return { A[1] + a_to_b[1]*t, A[2] + a_to_b[2]*t }
  121. end
  122.  
  123. local should_swap = false
  124. local it = 0
  125. local angles = { 60, 20, -60 }
  126. client.set_event_callback("bullet_impact", function(c)
  127.       if ui.get(combo) == "Enable" and entity.is_alive(entity.get_local_player()) then
  128.         local ent = client.userid_to_entindex(c.userid)
  129.         if not entity.is_dormant(ent) and entity.is_enemy(ent) then
  130.             local ent_shoot = { entity.get_prop(ent, "m_vecOrigin") }
  131.             ent_shoot[3] = ent_shoot[3] + entity.get_prop(ent, "m_vecViewOffset[2]")
  132.             local player_head = { entity.hitbox_position(entity.get_local_player(), 0) }
  133.             local closest = GetClosestPoint(ent_shoot, { c.x, c.y, c.z }, player_head)
  134.             local delta = { player_head[1]-closest[1], player_head[2]-closest[2] }
  135.             local delta_2d = math.sqrt(delta[1]^2+delta[2]^2)
  136.        
  137.             if math.abs(delta_2d) < 40 then
  138.                 it = it + 1
  139.                 should_swap = true
  140.             end
  141.         end
  142.     end
  143. end)
  144.  
  145. local function on_prestart() -- reset angles when round restart
  146.  
  147.     if  ui.get(logs_indic) and ui.get(combo) == "Anti-Bruteforce" then
  148.         local r_bg, g_bg, b_bg, a_bg = ui.get(color_logs)
  149.         client.color_log(r_bg, g_bg , b_bg, "[Anti-Bruteforce] Reset angles...")
  150.     end
  151.    
  152.     reset_time = -1
  153.     timer_indicator = -1
  154.  
  155.     if ui.get(combo) == "Anti-Bruteforce" then
  156.             ui.set(slider, ui.get(body_yaw_default))
  157.             ui.set(slider2, ui.get(fake_yaw_default))
  158.     end
  159. end
  160.  
  161. local function indicator(c)
  162.     local screen = {client.screen_size()}
  163.     local center = {screen[1]/2, screen[2]/2}
  164.     local speed = 45
  165.    
  166.     if should_swap == true then
  167.         timer_indicator = globals.curtime() + ui.get(reset_timer)
  168.     end
  169.    
  170.     --Set Static bodyyaw and freestanding
  171.     if ui.get(combo) == "Enable" then
  172.         ui.set(bodyyaw, "Static")
  173.         ui.set(freestanding_body_yaw, true)
  174.     end
  175.    
  176.     --Reset angles after X seconds
  177.     if ui.get(combo) == "Enable" and globals.curtime() > timer_indicator then    
  178.             ui.set(slider, ui.get(body_yaw_default))
  179.             ui.set(slider2, ui.get(fake_yaw_default))
  180.     end
  181.    
  182.     --Anti-Bruteforce indicator
  183.     if includes(ui.get(combo_indicator), "Anti-Bruteforce") and ui.get(combo) == "Enable" and entity.is_alive(entity.get_local_player()) and globals.curtime() < timer_indicator then
  184.     local r2, g2, b2 = rgb_rainbow(speed / 100, 1)    
  185.       renderer.text(center[1], center[2] + 25, r2, g2, b2, 255, "cb", 0, "ANTI-BRUTEFORCE" )
  186.     elseif includes(ui.get(combo_indicator), "Anti-Bruteforce") and ui.get(combo) == "Enable" and entity.is_alive(entity.get_local_player()) and globals.curtime() > timer_indicator then    
  187.       renderer.text(center[1], center[2] + 25, 217, 217, 217, 255, "cb", 0, "ANTI-BRUTEFORCE" )
  188.     end
  189. end
  190.  
  191. client.set_event_callback("round_prestart", on_prestart)
  192. client.set_event_callback("paint", indicator)
  193.  
  194. client.set_event_callback("paint", function() --Indicator
  195.     if ui.get(combo) and should_swap then
  196.         local table = {"-60","60", "20","-20","30","-30"} -- random bodyyaw value
  197.         local value2 = math.random(1,#table)
  198.         local picked_value2 = table[value2]
  199.        
  200.         local table = {"17","7","58","42","35"} -- random fakeyaw value
  201.         local value3 = math.random(1,#table)
  202.         local picked_value3 = table[value3]
  203.        
  204.         local actualbodyyaw = picked_value2
  205.         local actualfakeyaw = picked_value3
  206.        
  207.         if ui.get(logs_indic) and should_swap then
  208.             local r_bg, g_bg, b_bg, a_bg = ui.get(color_logs)
  209.             client.color_log(r_bg, g_bg , b_bg, "[Anti-Bruteforce] ", 'Set body Y: ', actualbodyyaw, '° and fake Y: ', actualfakeyaw,'°')
  210.         end
  211.        
  212.         if ui.get(combo) == "Enable" then
  213.             ui.set(slider, actualbodyyaw)
  214.             ui.set(slider2, actualfakeyaw)
  215.         end
  216.         should_swap = false
  217.     end
  218. end)
  219.  
  220.  
  221.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement