· 6 years ago · Sep 01, 2019, 03:42 PM
1--
2-- Original script by Edward22
3-- Modified & improved by anthony
4--
5-- TODO: Decrease the amount of components by using only 2 sliders and changing the config items using callbacks
6-- on each menu item (waiting for lua api suggestions to be added!)
7--
8
9--Start references
10local engine = csgo.interface_handler:get_engine_client()
11local callbacks = fatality.callbacks
12local menu = fatality.menu
13local config = fatality.config
14local render = fatality.render
15local input = fatality.input
16--End references
17
18--Start config items
19local stand_left_add = config:add_item("ants_aa_sl_add", 0)
20local stand_left_amt = config:add_item("ants_aa_sl_amt", 0)
21local stand_right_add = config:add_item("ants_aa_sr_add", 0)
22local stand_right_amt = config:add_item("ants_aa_sr_amt", 0)
23local move_left_add = config:add_item("ants_aa_ml_add", 0)
24local move_left_amt = config:add_item("ants_aa_ml_amt", 0)
25local move_right_add = config:add_item("ants_aa_mr_add", 0)
26local move_right_amt = config:add_item("ants_aa_mr_amt", 0)
27--End config items
28
29--Start menu items
30local menu_sl_add = menu:add_slider("Stand/Left Add", "RAGE", "ANTI-AIM", "General", stand_left_add, -180, 180, 1)
31local menu_sl_amt = menu:add_slider("Stand/Left Amount", "RAGE", "ANTI-AIM", "General", stand_left_amt, -100, 100, 1)
32local menu_sr_add = menu:add_slider("Stand/Right Add", "RAGE", "ANTI-AIM", "General", stand_right_add, -180, 180, 1)
33local menu_sr_amt = menu:add_slider("Stand/Right Amount", "RAGE", "ANTI-AIM", "General", stand_right_amt, -100, 100, 1)
34local menu_ml_add = menu:add_slider("Move/Left Add", "RAGE", "ANTI-AIM", "General", move_left_add, -180, 180, 1)
35local menu_ml_amt = menu:add_slider("Move/Left Amount", "RAGE", "ANTI-AIM", "General", move_left_amt, -100, 100, 1)
36local menu_mr_add = menu:add_slider("Move/Right Add", "RAGE", "ANTI-AIM", "General", move_right_add, -180, 180, 1)
37local menu_mr_amt = menu:add_slider("Move/Right Amount", "RAGE", "ANTI-AIM", "General", move_right_amt, -100, 100, 1)
38--End menu items
39
40--Start menu references
41local ref_stand_add = menu:get_reference("RAGE", "ANTI-AIM", "Standing", "Add")
42local ref_stand_amt = menu:get_reference("RAGE", "ANTI-AIM", "Standing", "Fake amount")
43local ref_move_add = menu:get_reference("RAGE", "ANTI-AIM", "Moving", "Add")
44local ref_move_amt = menu:get_reference("RAGE", "ANTI-AIM", "Moving", "Fake amount")
45--End references
46
47--Start vars
48local side = false
49local switch_held = false
50local switch_key = 0x06 --Mouse 5 / Other common keycodes: Mouse 4/0x05, Mouse 3/0x04, X/0x58, Z/0x5A
51local font = render:create_font('Verdana', 32, 700, true)
52local color = csgo.color(207, 119, 224, 230)
53--End vars
54
55--Changes the menu values based on the users settings
56local do_logic = function()
57 if side then
58 ref_stand_add:set_float(stand_right_add:get_float())
59 ref_stand_amt:set_float(stand_right_amt:get_float())
60 ref_move_add:set_float(move_right_add:get_float())
61 ref_move_amt:set_float(move_right_amt:get_float())
62 else
63 ref_stand_add:set_float(stand_left_add:get_float())
64 ref_stand_amt:set_float(stand_left_amt:get_float())
65 ref_move_add:set_float(move_left_add:get_float())
66 ref_move_amt:set_float(move_left_amt:get_float())
67 end
68end
69
70--Switches the side based on the key state
71local handle_bind = function()
72 if input:is_key_down(switch_key) then
73 if not switch_held then
74 side = not side
75 end
76 switch_held = true
77 else
78 switch_held = false
79 end
80end
81
82--Draws the left/right arrow depending on what direction is currently active
83local draw_arrow = function()
84 local screen_size = render:screen_size()
85 local x, y = screen_size.x / 2, screen_size.y / 2
86
87 if not side then
88 render:text(font, x - 40, y - 18, '<', color)
89 else
90 render:text(font, x + 15, y - 18, '>', color)
91 end
92end
93
94callbacks:add("paint", function()
95 if(engine:is_in_game()) then
96 do_logic()
97 handle_bind()
98 draw_arrow()
99 end
100end)