· 6 years ago · Nov 03, 2019, 06:00 PM
1 -- local variables for API functions. any changes to the line below will be lost on re-generation
2local client_draw_text, client_random_int, client_screen_size, client_set_event_callback, entity_get_local_player, entity_get_prop, globals_tickcount, math_sqrt, renderer_indicator, ui_get, ui_new_checkbox, ui_new_color_picker, ui_new_combobox, ui_new_hotkey, ui_new_multiselect, ui_reference, ui_set, ui_set_visible = client.draw_text, client.random_int, client.screen_size, client.set_event_callback, entity.get_local_player, entity.get_prop, globals.tickcount, math.sqrt, renderer.indicator, ui.get, ui.new_checkbox, ui.new_color_picker, ui.new_combobox, ui.new_hotkey, ui.new_multiselect, ui.reference, ui.set, ui.set_visible
3
4--desync variables
5local ui_checkbox = ui_new_checkbox("Lua", "A", "Desync")
6local ui_keybind = ui_new_hotkey("Lua", "A", "Desync key", false)
7local ui_combobox_type = ui_new_combobox("Lua", "A", "Desync type", { "Static", "Jitter" })
8local ui_static_type = ui_new_combobox("Lua", "A", "Static type", { "Default", "Backwards", "Half-Backwards" })
9local ui_combobox = ui_new_combobox("Lua", "A", "Jitter type", { "Default", "Advanced" })
10local ui_lby_target_type = ui_new_combobox("Lua", "A", "LBY Target", {"Off", "Flip", "Random"})
11
12--default variables
13local ui_rage_enable = ui_reference("Rage", "Aimbot", "Enabled")
14local ui_jitter, ui_slider = ui_reference("AA", "Anti-aimbot angles", "Yaw jitter")
15local ui_pitch = ui_reference("AA", "Anti-aimbot angles", "Pitch")
16local ui_yaw, ui_yaw_slider = ui_reference("AA", "Anti-aimbot angles", "Yaw")
17local ui_lby, ui_lby_slider = ui_reference("AA", "Anti-aimbot angles", "Body yaw")
18local ui_lby_target = ui_reference("AA", "Anti-aimbot angles", "Lower body yaw target")
19local ui_twist = ui_reference("AA", "Anti-aimbot angles", "Twist")
20local ui_fd = ui_reference("Rage", "Other", "Duck peek assist")
21
22--indicator variables
23local ui_indicator = ui_new_checkbox("Lua", "A", "Indicator")
24local ui_indicator_type = ui_new_multiselect("Lua", "A", "Indicator type", { "Text", "Arrows" })
25local ui_indicator_text_type = ui_new_combobox("Lua", "A", "Arrow type", { "Default", "Classic", "Zeus", "Round", "Dick", "Square", "Stars" })
26local ui_indicator_color = ui_new_color_picker("Lua", "A", "Indicator color", 60, 240, 228, 255)
27local ui_arrow_indicator = ui_new_checkbox("Lua", "A", "Show second arrow")
28local ui_arrow_color = ui_new_color_picker("Lua", "A", "Second arrow color", 255, 255, 255, 100)
29
30--other variables
31local flip
32local desync_type
33
34--desync switch variables (request from Mishkat)
35local ui_switch_enable = ui_new_checkbox("Lua", "A", "Switch type on key")
36local ui_switch_key = ui_new_hotkey("Lua", "A", "Switch type on key", true)
37
38--------------------------variables end--------------------------
39
40local function contains(table, val) --pasted cuz i didnt know that multiselect cant work properly without custom checks
41 for i=1, #table do
42 if table[i] == val then
43 return true
44 end
45 end
46
47 return false
48end
49
50local function switch_desync()
51 if entity_get_local_player() == nil or entity_get_prop(entity_get_local_player(), "m_iHealth") <= 0 then
52 return
53 end
54
55 local vel_x, vel_y = entity_get_prop(entity_get_local_player(), "m_vecVelocity")
56 local vel = math_sqrt(vel_x^2 + vel_y^2)
57
58 if ui_get(ui_switch_enable) then
59 desync_type = ui_get(ui_switch_key) and 1 or 0
60 ui_set(ui_combobox_type, desync_type == 1 and "Jitter" or "Static")
61 flip = ui_get(ui_keybind) and true or false
62 else
63 desync_type = ui_get(ui_combobox_type) == "Jitter" and 1 or 0
64 flip = ui_get(ui_keybind) and true or false
65 end
66
67 local sFlip = globals_tickcount() % 100 > 1 and globals_tickcount() % 100 < 50 and true or false
68
69 if desync_type == 0 then
70 if ui_get(ui_lby_target_type) == "Flip" then
71 ui_set(ui_lby_target, sFlip and "Sway" or "Opposite")
72 end
73 if ui_get(ui_lby_target_type) == "Random" then
74 local random = client_random_int(1, 5)
75 if random == 1 then
76 ui_set(ui_lby_target, "Off")
77 end
78 if random == 2 then
79 ui_set(ui_lby_target, "Sway")
80 end
81 if random == 3 then
82 ui_set(ui_lby_target, "Opposite")
83 end
84 if random == 4 then
85 ui_set(ui_lby_target, sFlip and "Sway" or "Opposite")
86 end
87 end
88 else
89 ui_set(ui_lby_target, "Off")
90 end
91
92 if desync_type == 0 then
93 local values = vel > 10 and 0 or 25
94
95 ui_set(ui_jitter, "Off")
96 ui_set(ui_lby, "Static")
97
98 if ui_get(ui_static_type) == "Default" then
99 if ui_get(ui_keybind) then
100 if ui_get(ui_fd) then
101 ui_set(ui_yaw_slider, 0)
102 else
103 ui_set(ui_yaw_slider, values)
104 end
105 ui_set(ui_lby_slider, 180)
106 else
107 ui_set(ui_yaw_slider, -values)
108 ui_set(ui_lby_slider, -180)
109 end
110 end
111 if ui_get(ui_static_type) == "Backwards" then
112 ui_set(ui_yaw_slider, 0)
113 if ui_get(ui_keybind) then
114 ui_set(ui_lby_slider, 180)
115 else
116 ui_set(ui_lby_slider, -180)
117 end
118 end
119 if ui_get(ui_static_type) == "Half-Backwards" then
120 ui_set(ui_yaw_slider, 0)
121 if ui_get(ui_keybind) then
122 ui_set(ui_lby_slider, 35)
123 else
124 ui_set(ui_lby_slider, -10)
125 end
126 end
127 end
128 if desync_type == 1 then
129 ui_set(ui_lby, "Opposite")
130 if ui_get(ui_combobox) == "Default" then
131 ui_set(ui_jitter, "Center")
132 if ui_get(ui_keybind) then
133 ui_set(ui_slider, 122)
134 ui_set(ui_yaw_slider, 90)
135 else
136 ui_set(ui_slider, -122)
137 ui_set(ui_yaw_slider, -90)
138 end
139 end
140 if ui_get(ui_combobox) == "Advanced" then
141 ui_set(ui_jitter, "Offset")
142 if ui_get(ui_keybind) then
143 ui_set(ui_slider, 140)
144 ui_set(ui_yaw_slider, 0)
145 else
146 ui_set(ui_slider, -140)
147 ui_set(ui_yaw_slider, 0)
148 end
149 end
150 end
151end
152
153local function draw_indicators()
154 if entity_get_local_player() == nil or entity_get_prop(entity_get_local_player(), "m_iHealth") <= 0 then
155 return
156 end
157
158 local r, g, b, a = ui_get(ui_indicator_color)
159 local r1, g1, b1, a1 = ui_get(ui_arrow_color)
160 local scrsize_x, scrsize_y = client_screen_size()
161 local center_x, center_y = scrsize_x / 2, scrsize_y / 2
162
163 if ui_get(ui_indicator) then
164 if contains(ui_get(ui_indicator_type), "Text") then
165 if not flip then
166 renderer_indicator(r, g, b, a, "LEFT")
167 else
168 renderer_indicator(r, g, b, a, "RIGHT")
169 end
170 end
171
172 local arrow_left, arrow_right
173 if ui_get(ui_indicator_text_type) == "Default" then
174 arrow_left = "⮜"
175 arrow_right = "⮞"
176 end
177 if ui_get(ui_indicator_text_type) == "Classic" then
178 arrow_left = "<"
179 arrow_right = ">"
180 end
181 if ui_get(ui_indicator_text_type) == "Zeus" then
182 arrow_left = "◄"
183 arrow_right = "►"
184 end
185 if ui_get(ui_indicator_text_type) == "Round" then
186 arrow_left = "("
187 arrow_right = ")"
188 end
189 if ui_get(ui_indicator_text_type) == "Dick" then
190 arrow_left = "ꓷ==8"
191 arrow_right = "8==D"
192 end
193 if ui_get(ui_indicator_text_type) == "Square" then
194 arrow_left = "⍃"
195 arrow_right = "⍄"
196 end
197 if ui_get(ui_indicator_text_type) == "Stars" then
198 arrow_left = "★"
199 arrow_right = "★"
200 end
201
202 if contains(ui_get(ui_indicator_type), "Arrows") then --pasted cuz lazy to calc pos
203 if not flip then
204 client_draw_text(c, center_x - 45, center_y, r, g, b, a, "c+", 0, arrow_left)
205 if ui_get(ui_arrow_indicator) then
206 client_draw_text(c, center_x + 45, center_y, r1, g1, b1, a1, "c+", 0, arrow_right)
207 end
208 else
209 client_draw_text(c, center_x + 45, center_y, r, g, b, a, "c+", 0, arrow_right)
210 if ui_get(ui_arrow_indicator) then
211 client_draw_text(c, center_x - 45, center_y, r1, g1, b1, a1, "c+", 0, arrow_left)
212 end
213 end
214 end
215 end
216end
217
218local function desync()
219 if entity_get_local_player() == nil or entity_get_prop(entity_get_local_player(), "m_iHealth") <= 0 then
220 return
221 end
222
223 local show = contains(ui_get(ui_indicator_type), "Arrows") and true or false
224 local show_desync = desync_type == 0
225
226 if ui_get(ui_rage_enable) then
227 ui_set(ui_pitch, "Down")
228 ui_set(ui_keybind, "Toggle")
229
230 ui_set_visible(ui_static_type, ui_get(ui_checkbox) and show_desync)
231 ui_set_visible(ui_combobox, ui_get(ui_checkbox) and not show_desync)
232
233 ui_set_visible(ui_indicator, ui_get(ui_checkbox))
234 ui_set_visible(ui_indicator_type, ui_get(ui_indicator))
235 ui_set_visible(ui_indicator_color, ui_get(ui_indicator))
236 ui_set_visible(ui_indicator_text_type, ui_get(ui_indicator) and show)
237 ui_set_visible(ui_arrow_indicator, show)
238 ui_set_visible(ui_arrow_color, ui_get(ui_arrow_indicator) and show)
239
240 if ui_get(ui_checkbox) then
241 switch_desync()
242 draw_indicators()
243 end
244 else
245 ui_set(ui_pitch, "Off")
246 ui_set(ui_yaw, "Off")
247 ui_set(ui_lby, "Off")
248 ui_set(ui_lby_target, "Off")
249 end
250end
251
252client_set_event_callback("paint", desync)