· 6 years ago · Feb 12, 2020, 08:18 PM
1--local variables for API. Automatically generated by https://github.com/simpleavaster/gslua/blob/master/authors/sapphyrus/generate_api.lua
2client_latency, client_log, client_draw_rectangle, client_draw_circle_outline, client_userid_to_entindex, client_draw_indicator, client_draw_gradient, client_set_event_callback, client_screen_size, client_eye_position = client.latency, client.log, client.draw_rectangle, client.draw_circle_outline, client.userid_to_entindex, client.draw_indicator, client.draw_gradient, client.set_event_callback, client.screen_size, client.eye_position
3client_draw_circle, client_color_log, client_delay_call, client_draw_text, client_visible, client_exec, client_trace_line, client_set_cvar = client.draw_circle, client.color_log, client.delay_call, client.draw_text, client.visible, client.exec, client.trace_line, client.set_cvar
4client_world_to_screen, client_draw_hitboxes, client_get_cvar, client_draw_line, client_camera_angles, client_draw_debug_text, client_random_int, client_random_float = client.world_to_screen, client.draw_hitboxes, client.get_cvar, client.draw_line, client.camera_angles, client.draw_debug_text, client.random_int, client.random_float
5entity_get_local_player, entity_is_enemy, entity_hitbox_position, entity_get_player_name, entity_get_steam64, entity_get_bounding_box, entity_get_all, entity_set_prop = entity.get_local_player, entity.is_enemy, entity.hitbox_position, entity.get_player_name, entity.get_steam64, entity.get_bounding_box, entity.get_all, entity.set_prop
6entity_is_alive, entity_get_player_weapon, entity_get_prop, entity_get_players, entity_get_classname = entity.is_alive, entity.get_player_weapon, entity.get_prop, entity.get_players, entity.get_classname
7globals_realtime, globals_absoluteframetime, globals_tickcount, globals_curtime, globals_mapname, globals_tickinterval, globals_framecount, globals_frametime, globals_maxplayers = globals.realtime, globals.absoluteframetime, globals.tickcount, globals.curtime, globals.mapname, globals.tickinterval, globals.framecount, globals.frametime, globals.maxplayers
8ui_new_slider, ui_new_combobox, ui_reference, ui_set_visible, ui_is_menu_open, ui_new_color_picker, ui_set_callback, ui_set, ui_new_checkbox, ui_new_hotkey, ui_new_button, ui_new_multiselect, ui_get = ui.new_slider, ui.new_combobox, ui.reference, ui.set_visible, ui.is_menu_open, ui.new_color_picker, ui.set_callback, ui.set, ui.new_checkbox, ui.new_hotkey, ui.new_button, ui.new_multiselect, ui.get
9math_ceil, math_tan, math_log10, math_randomseed, math_cos, math_sinh, math_random, math_huge, math_pi, math_max, math_atan2, math_ldexp, math_floor, math_sqrt, math_deg, math_atan, math_fmod = math.ceil, math.tan, math.log10, math.randomseed, math.cos, math.sinh, math.random, math.huge, math.pi, math.max, math.atan2, math.ldexp, math.floor, math.sqrt, math.deg, math.atan, math.fmod
10math_acos, math_pow, math_abs, math_min, math_sin, math_frexp, math_log, math_tanh, math_exp, math_modf, math_cosh, math_asin, math_rad = math.acos, math.pow, math.abs, math.min, math.sin, math.frexp, math.log, math.tanh, math.exp, math.modf, math.cosh, math.asin, math.rad
11table_maxn, table_foreach, table_sort, table_remove, table_foreachi, table_move, table_getn, table_concat, table_insert = table.maxn, table.foreach, table.sort, table.remove, table.foreachi, table.move, table.getn, table.concat, table.insert
12string_find, string_format, string_rep, string_gsub, string_len, string_gmatch, string_dump, string_match, string_reverse, string_byte, string_char, string_upper, string_lower, string_sub = string.find, string.format, string.rep, string.gsub, string.len, string.gmatch, string.dump, string.match, string.reverse, string.byte, string.char, string.upper, string.lower, string.sub
13bit_band, client_delay_call, client_set_event_callback, entity_get_local_player, entity_get_player_weapon, entity_get_prop, print, func, select, table_insert, table_sort, type, ui_get, ui_name, ui_new_checkbox, ui_new_combobox, ui_new_multiselect, ui_reference, ui_set, ui_set_callback, ui_set_visible, xpcall, pairs = bit.band, client.delay_call, client.set_event_callback, entity.get_local_player, entity.get_player_weapon, entity.get_prop, print, func, select, table.insert, table.sort, type, ui.get, ui.name, ui.new_checkbox, ui.new_combobox, ui.new_multiselect, ui.reference, ui.set, ui.set_callback, ui.set_visible, xpcall, pairs
14
15--local variables for API. Automatically generated by https://github.com/simpleavaster/gslua/blob/master/authors/sapphyrus/generate_api.lua
16local client_latency, client_set_clan_tag, client_log, client_draw_rectangle, client_draw_indicator, client_draw_circle_outline, client_timestamp, client_world_to_screen, client_userid_to_entindex = client.latency, client.set_clan_tag, client.log, client.draw_rectangle, client.draw_indicator, client.draw_circle_outline, client.timestamp, client.world_to_screen, client.userid_to_entindex
17local client_draw_circle, client_draw_gradient, client_set_event_callback, client_screen_size, client_trace_line, client_draw_text, client_color_log = client.draw_circle, client.draw_gradient, client.set_event_callback, client.screen_size, client.trace_line, client.draw_text, client.color_log
18local client_system_time, client_delay_call, client_visible, client_exec, client_open_panorama_context, client_set_cvar, client_eye_position = client.system_time, client.delay_call, client.visible, client.exec, client.open_panorama_context, client.set_cvar, client.eye_position
19local client_draw_hitboxes, client_get_cvar, client_draw_line, client_camera_angles, client_draw_debug_text, client_random_int, client_random_float = client.draw_hitboxes, client.get_cvar, client.draw_line, client.camera_angles, client.draw_debug_text, client.random_int, client.random_float
20local entity_get_local_player, entity_is_enemy, entity_get_bounding_box, entity_is_dormant, entity_get_steam64, entity_get_player_name, entity_hitbox_position, entity_get_game_rules, entity_get_all = entity.get_local_player, entity.is_enemy, entity.get_bounding_box, entity.is_dormant, entity.get_steam64, entity.get_player_name, entity.hitbox_position, entity.get_game_rules, entity.get_all
21local entity_set_prop, entity_is_alive, entity_get_player_weapon, entity_get_prop, entity_get_players, entity_get_classname = entity.set_prop, entity.is_alive, entity.get_player_weapon, entity.get_prop, entity.get_players, entity.get_classname
22local globals_realtime, globals_absoluteframetime, globals_tickcount, globals_lastoutgoingcommand, globals_curtime, globals_mapname, globals_tickinterval = globals.realtime, globals.absoluteframetime, globals.tickcount, globals.lastoutgoingcommand, globals.curtime, globals.mapname, globals.tickinterval
23local globals_framecount, globals_frametime, globals_maxplayers = globals.framecount, globals.frametime, globals.maxplayers
24local ui_new_slider, ui_new_combobox, ui_reference, ui_is_menu_open, ui_set_visible, ui_new_textbox, ui_new_color_picker, ui_set_callback, ui_set = ui.new_slider, ui.new_combobox, ui.reference, ui.is_menu_open, ui.set_visible, ui.new_textbox, ui.new_color_picker, ui.set_callback, ui.set
25local ui_new_checkbox, ui_new_hotkey, ui_new_button, ui_new_multiselect, ui_get = ui.new_checkbox, ui.new_hotkey, ui.new_button, ui.new_multiselect, ui.get
26local math_ceil, math_tan, math_cos, math_sinh, math_pi, math_max, math_atan2, math_floor, math_sqrt, math_deg, math_atan, math_fmod, math_acos = math.ceil, math.tan, math.cos, math.sinh, math.pi, math.max, math.atan2, math.floor, math.sqrt, math.deg, math.atan, math.fmod, math.acos
27local math_pow, math_abs, math_min, math_sin, math_log, math_exp, math_cosh, math_asin, math_rad = math.pow, math.abs, math.min, math.sin, math.log, math.exp, math.cosh, math.asin, math.rad
28local table_sort, table_remove, table_concat, table_insert = table.sort, table.remove, table.concat, table.insert
29local string_find, string_format, string_gsub, string_len, string_gmatch, string_match, string_reverse, string_upper, string_lower, string_sub = string.find, string.format, string.gsub, string.len, string.gmatch, string.match, string.reverse, string.upper, string.lower, string.sub
30local renderer_line, renderer_indicator, renderer_world_to_screen, renderer_circle_outline, renderer_rectangle, renderer_gradient, renderer_circle, renderer_text = renderer.line, renderer.indicator, renderer.world_to_screen, renderer.circle_outline, renderer.rectangle, renderer.gradient, renderer.circle, renderer.text
31--end of local variables
32
33------------------
34----ScriptLock----
35------------------
36
37local keyvalue = database.read("key")
38local unlocked = false
39local failcount = 0
40
41--client.log(keyvalue)
42
43local keytable = {
44 598886596813, --silent
45 777911186851, --kamrote
46 270897749716, --iisakki
47 705372504608, --have
48 592766009536, --matrix
49 166360617540, --autumn
50 958443134119, --izuna
51 630749366284, --anubis
52 697801976826, --velox
53 650262218602, --edit
54 722739807487, --vro
55 366097245757, --wraith
56 314155301436, --xnx
57 415769829281, --saltbae
58 816799710968, --grens
59 204506742898, --eleven
60 973370488155, --zempron
61 256366953298, --unknown
62 955693204276, --poochy
63 424854913218, --charlie/988
64 560378941981, --raxxie
65 760998720611, --prince of hell
66 120259734642, --lchfly
67 397646923065, --liljef
68 936016440740, --wuga
69 571625577583, --7thirty
70 405400070263, --foap
71 624975307625, --celeste
72 525127386965, --pandora
73 514423659646, --sporkeh
74 661342849819, --gashly
75 728967219073, --sad
76 544475692777, --persona
77 770050642212, --nissim
78 548323686163, --xelar
79 785660752925, --kenan
80 911088041327, --night
81 695470434527, --yupiter
82 722378499086, --kayy
83 567441630802, --ants
84 364513896471, --nate
85 602603103759, --brandon/yuh
86 296440431763, --prisma
87 716949634297, --raxy
88 177571887611, --twix
89 846736365072, --snoopy
90 110965565751, --luis
91 261638341407, --mlc
92 814785663188, --hmonster101
93 869278033763, --human
94 659506886450, --isla
95 525434593627, --prezidentkidz
96 327144918417, --asx
97 620395402718, --unfair
98 147312094375, --xanaxtab
99 983643384453, --fyl
100 742437708367, --ziv
101 353234275431, --unknown (venuz)
102 327003809745, --legende
103 916334915843, --nicro
104 717048739623, --skai
105 278941760167, --nanders
106 594067001374, --tdawg
107 564455177286, --x0m
108 733791660559, --dylan
109 183712998024 --aaron
110}
111
112nameofthe_user = "convict"
113
114for i=1,#keytable do
115
116 local tablevalue = keytable[i]
117 --client.log("current tablevalue:".. tablevalue)
118
119 if 598886596813 == keyvalue then
120 nameofthe_user = "silent"
121 elseif 777911186851 == keyvalue then
122 nameofthe_user = "kamrote"
123 elseif 270897749716 == keyvalue then
124 nameofthe_user = "iisakki"
125 elseif 705372504608 == keyvalue then
126 nameofthe_user = "have"
127 elseif 166360617540 == keyvalue then
128 nameofthe_user = "autumn"
129 elseif 958443134119 == keyvalue then
130 nameofthe_user = "izuna"
131 elseif 630749366284 == keyvalue then
132 nameofthe_user = "anubis"
133 elseif 697801976826 == keyvalue then
134 nameofthe_user = "velox"
135 elseif 650262218602 == keyvalue then
136 nameofthe_user = "edit"
137 elseif 722739807487 == keyvalue then
138 nameofthe_user = "vro"
139 elseif 592766009536 == keyvalue then
140 nameofthe_user = "matrix"
141 elseif 314155301436 == keyvalue then
142 nameofthe_user = "xnx"
143 elseif 415769829281 == keyvalue then
144 nameofthe_user = "saltbae"
145 elseif 816799710968 == keyvalue then
146 nameofthe_user = "gren"
147 elseif 204506742898 == keyvalue then
148 nameofthe_user = "eleven"
149 elseif 256366953298 == keyvalue then
150 nameofthe_user = "unknown"
151 elseif 955693204276 == keyvalue then
152 nameofthe_user = "Poochy"
153 elseif 424854913218 == keyvalue then
154 nameofthe_user = "charlie"
155 elseif 560378941981 == keyvalue then
156 nameofthe_user = "raxxie"
157 elseif 760998720611 == keyvalue then
158 nameofthe_user = "prince"
159 elseif 397646923065 == keyvalue then
160 nameofthe_user = "jeff"
161 elseif 936016440740 == keyvalue then
162 nameofthe_user = "wuga"
163 elseif 571625577583 == keyvalue then
164 nameofthe_user = "7thirty"
165 elseif 405400070263 == keyvalue then
166 nameofthe_user = "foap"
167 elseif 624975307625 == keyvalue then
168 nameofthe_user = "celeste"
169 elseif 525127386965 == keyvalue then
170 nameofthe_user = "pandora"
171 elseif 514423659646 == keyvalue then
172 nameofthe_user = "sporkeh"
173 elseif 661342849819 == keyvalue then
174 nameofthe_user = "gashly"
175 elseif 728967219073 == keyvalue then
176 nameofthe_user = "sad"
177 elseif 544475692777 == keyvalue then
178 nameofthe_user = "persona"
179 elseif 770050642212 == keyvalue then
180 nameofthe_user = "nissim"
181 elseif 183712998024 == keyvalue then
182 nameofthe_user = "aa-ron"
183 elseif 911088041327 == keyvalue then
184 nameofthe_user = "night"
185 elseif 695470434527 == keyvalue then
186 nameofthe_user = "yupiter"
187 elseif 722378499086 == keyvalue then
188 nameofthe_user = "kayy"
189 elseif 366097245757 == keyvalue then
190 nameofthe_user = "wraith"
191 elseif 567441630802 == keyvalue then
192 nameofthe_user = "ants"
193 elseif 177571887611 == keyvalue then
194 nameofthe_user = "twix"
195 elseif 120259734642 == keyvalue then
196 nameofthe_user = "lchfly"
197 elseif 548323686163 == keyvalue then
198 nameofthe_user = "xelar"
199 elseif 785660752925 == keyvalue then
200 nameofthe_user = "kenan"
201 elseif 716949634297 == keyvalue then
202 nameofthe_user = "raxy"
203 elseif 364513896471 == keyvalue then
204 nameofthe_user = "nate"
205 elseif 602603103759 == keyvalue then
206 nameofthe_user = "yuh"
207 elseif 296440431763 == keyvalue then
208 nameofthe_user = "prisma"
209 elseif 973370488155 == keyvalue then
210 nameofthe_user = "zempron"
211 elseif 846736365072 == keyvalue then
212 nameofthe_user = "snoopy"
213 elseif 110965565751 == keyvalue then
214 nameofthe_user = "luis"
215 elseif 261638341407 == keyvalue then
216 nameofthe_user = "mlc"
217 elseif 814785663188 == keyvalue then
218 nameofthe_user = "monster"
219 elseif 869278033763 == keyvalue then
220 nameofthe_user = "human"
221 elseif 659506886450 == keyvalue then
222 nameofthe_user = "isla"
223 elseif 525434593627 == keyvalue then
224 nameofthe_user = "president"
225 elseif 327144918417 == keyvalue then
226 nameofthe_user = "asx"
227 elseif 620395402718 == keyvalue then
228 nameofthe_user = "unfair"
229 elseif 147312094375 == keyvalue then
230 nameofthe_user = "xanaxtabz"
231 elseif 983643384453 == keyvalue then
232 nameofthe_user = "fryl"
233 elseif 742437708367 == keyvalue then
234 nameofthe_user = "ziv"
235 elseif 353234275431 == keyvalue then
236 nameofthe_user = "unknown"
237 elseif 327003809745 == keyvalue then
238 nameofthe_user = "legende"
239 elseif 916334915843 == keyvalue then
240 nameofthe_user = "n1cr0"
241 elseif 717048739623 == keyvalue then
242 nameofthe_user = "skai"
243 elseif 278941760167 == keyvalue then
244 nameofthe_user = "nanders"
245 elseif 594067001374 == keyvalue then
246 nameofthe_user = "tdawgz"
247 elseif 564455177286 == keyvalue then
248 nameofthe_user = "x0m"
249 elseif 733791660559 == keyvalue then
250 nameofthe_user = "dylan"
251 end
252end
253----------------------------------------------------------------------------------
254client.color_log(255, 255, 255, "---------------------------------------------------------------------------")
255client.color_log(30, 144, 255, "Welcome ", nameofthe_user, ", Lua date: January 14th, 2020, 9:40 pm CST")
256client.color_log(30, 144, 255, "If you have any issues or find any bugs message me on discord. kamrote#8632")
257client.color_log(255, 255, 255, "---------------------------------------------------------------------------")
258----------------------------------------------------------------------------------
259for i=1,#keytable do
260
261 local tablevalue = keytable[i]
262 --client.log("current tablevalue:".. tablevalue)
263
264 if tablevalue == keyvalue then
265
266 unlocked = true
267
268 else
269
270 failcount = failcount + 1
271
272 if failcount >= #keytable then
273
274 client.exec("quit")
275 --client.log("canceled exit")
276
277 end
278 --client.log(unlocked)
279 end
280
281end
282
283--database.write("key", keyvalue)------------
284-----UI-----
285------------
286
287------------DYNAMIC FOV
288dynamicfov_enable = ui_new_checkbox('RAGE', 'Other', 'Dynamic FOV')
289dynamicfov_select = ui_new_combobox('RAGE', 'Other', 'Dynamic FOV', 'Default', 'Adaptive weapon dynamic FOV')
290dynamicfov_weapons = ui_new_combobox('RAGE', 'Other', 'Dynamic FOV Weapons', 'Pistols', 'Rifles', 'Awp/scout/auto', 'Smg/other')
291dynamicfov_min = ui_new_slider('RAGE', 'Other', 'Dynamic FOV Min', 1, 180, 3, true, '°', 1)
292dynamicfov_max = ui_new_slider('RAGE', 'Other', 'Dynamic FOV Max', 1, 180, 69, true, '°', 1)
293dynamicfov_auto_factor = ui_new_slider('RAGE', 'Other', 'Dynamic FOV Auto Factor', 0, 250, 100, true, 'x', 0.01)
294--pistols
295dynamicfov_minpistol = ui_new_slider('RAGE', 'Other', 'Pistol Dynamic FOV Min', 1, 180, 3, true, '°', 1)
296dynamicfov_maxpistol = ui_new_slider('RAGE', 'Other', 'Pistol Dynamic FOV Max', 1, 180, 69, true, '°', 1)
297--rifle
298dynamicfov_minrifle = ui_new_slider('RAGE', 'Other', 'Rifle Dynamic FOV Min', 1, 180, 3, true, '°', 1)
299dynamicfov_maxrifle = ui_new_slider('RAGE', 'Other', 'Rifle Dynamic FOV Max', 1, 180, 69, true, '°', 1)
300--scoped
301dynamicfov_minscope = ui_new_slider('RAGE', 'Other', 'Awp/scout/auto Dynamic FOV Min', 1, 180, 3, true, '°', 1)
302dynamicfov_maxscope = ui_new_slider('RAGE', 'Other', 'Awp/scout/auto Dynamic FOV Max', 1, 180, 69, true, '°', 1)
303--other
304dynamicfov_minother = ui_new_slider('RAGE', 'Other', 'Smg/other Dynamic FOV Min', 1, 180, 3, true, '°', 1)
305dynamicfov_maxother = ui_new_slider('RAGE', 'Other', 'Smg/other Dynamic FOV Max', 1, 180, 69, true, '°', 1)
306------------DYNAMIC LEGIT AA
307legitAA = ui_new_checkbox("AA", "Anti-aimbot angles", "Legit anti-aim")
308legitAAbase = ui_new_combobox("AA", "Anti-aimbot angles", "\n aa_legit_base", "Manual", "Dynamic")
309LegitAAHotkey = ui_new_hotkey("AA", "Anti-aimbot angles", "Anti-aim switch key", true)
310LegitAABreaker = ui_new_combobox("AA", "Anti-aimbot angles", "Anti-aim mode", "Smart", "Maximum", "Fast", "Slow", "Break bruteforce")
311brutemode2 = ui.new_combobox("aa", "anti-aimbot angles", "Break Mode", "Slow", "Fast", "Jitter")
312
313ui_indicator_combobox4 = ui.new_combobox("AA", "Anti-aimbot angles", "Anti-aim indicator", "Off", "Metro", "Point arrows", "Dashes")
314ui_indicator_color_picker4 = ui.new_color_picker("AA", "Anti-aimbot angles", "Indicator colour", "0", "115", "255", "255")
315
316enableaawm = ui.new_checkbox('AA', 'Anti-aimbot angles', 'Custom AA While moving')
317legitaamoving = ui.new_combobox("AA", "Anti-aimbot angles", "\n aa_legit_bases", 'Off', 'Slow walk', 'Moving', 'Standing')
318--slow walk
319slowmode = ui.new_combobox('AA', 'Anti-aimbot angles', "Slow walk AA", "Smart", "Maximum", "Fast", "Slow", "Break bruteforce")
320--move
321movemode = ui.new_combobox('AA', 'Anti-aimbot angles', "Moving AA", "Smart", "Maximum", "Fast", "Slow", "Break bruteforce")
322--stand
323standmode = ui.new_combobox('AA', 'Anti-aimbot angles', "Stand AA", "Smart", "Maximum", "Fast", "Slow", "Break bruteforce")
324
325------------TRIGGERMAGNET
326tm_cb = ui.new_checkbox("Rage", "Other", "Triggermagnet")
327triggermagnet = ui.new_hotkey("Rage", "Other", "Triggermagnet", true)
328typeselect = ui.new_combobox("Rage", "Other", "Select", "Default", "Advanced")
329
330triggerdmg = ui.new_slider("Rage", "Other", "Minimum damage override", 1, 100, 3, true)
331triggerhtc = ui.new_slider("Rage", "Other", "Hitchance override", 1, 100, 3, true, "%")
332------------AUTOWALL
333trans_values2 = {
334[1] = "1%", [2] = "2%", [3] = "3%", [4] = "4%", [5] = "5%", [6] = "6%", [7] = "7%", [8] = "8%", [9] = "9%", [10] = "10%", [11] = "11%", [12] = "12%", [13] = "13%", [14] = "14%", [15] = "15%", [16] = "16%", [17] = "17%", [18] = "18%", [19] = "19%", [20] = "20%", [21] = "21%", [22] = "22%", [23] = "23%", [24] = "24%", [25] = "25%", [26] = "26%", [27] = "27%", [28] = "28%", [29] = "29%", [30] = "30%", [31] = "31%", [32] = "32%", [33] = "33%", [34] = "34%", [35] = "35%", [36] = "36%", [37] = "37%", [38] = "38%", [39] = "39%", [40] = "40%", [41] = "41%", [42] = "42%", [43] = "43%", [44] = "44%", [45] = "45%", [46] = "46%", [47] = "47%", [48] = "48%", [49] = "49%", [50] = "50%", [51] = "51%", [52] = "52%", [53] = "53%", [54] = "54%", [55] = "55%", [56] = "56%", [57] = "57%", [58] = "58%", [59] = "59%", [60] = "60%", [61] = "61%", [62] = "62%", [63] = "63%", [64] = "64%", [65] = "65%", [66] = "66%", [67] = "67%", [68] = "68%", [69] = "69%", [70] = "70%", [71] = "71%", [72] = "72%", [73] = "73%", [74] = "74%", [75] = "75%", [76] = "76%", [77] = "77%", [78] = "78%", [79] = "79%", [80] = "80%", [81] = "81%", [82] = "82%", [83] = "83%", [84] = "84%", [85] = "85%", [86] = "86%", [87] = "87%", [88] = "88%", [89] = "89%", [90] = "90%", [91] = "91%", [92] = "92%", [93] = "93%", [94] = "94%", [95] = "95%", [96] = "96%", [97] = "97%", [98] = "98%", [99] = "99%", [100] = "100%",
335}
336autowallbutton = ui.new_checkbox("RAGE", "Other", "Autowall")
337autowalltoggle = ui.new_hotkey("RAGE", "Other", "Automatic Penetration Toggle", true)
338auto_autowall = ui.new_multiselect("RAGE", "Other", "Auto autowall modes", "Transparent props", "Penetration reticle", "Min dmg override", "Dynamic autowall FOV", "Autowall if shot me", "Edge autowall", "Autowall specific players", "Autowall if was visible")
339slider_trans = ui.new_slider('rage', 'other', 'Transparent props', 1, 100, 1, true, "", 1,trans_values2)
340
341dynamicfov_minaw = ui_new_slider('RAGE', 'Other', 'Dynamic FOV Min', 1, 180, 3, true, '°', 1)
342dynamicfov_maxaw = ui_new_slider('RAGE', 'Other', 'Dynamic FOV Max', 1, 180, 69, true, '°', 1)
343dynamicfov_auto_factoraw = ui_new_slider('RAGE', 'Other', 'Dynamic FOV Auto Factor', 0, 250, 100, true, 'x', 0.01)
344autowalldmg = ui.new_slider("Rage", "Other", "Autowall Minimum damage override", 1, 100, 3, true)
345edgeautowallbutton = ui.new_checkbox("Players", "Adjustments", "Edge autowall")
346edgeautowalltype = ui.new_combobox("RAGE", "Other", "Edge autowall players", "All players", "Selected players")
347legit_pen_threshold_ref = ui.new_slider("RAGE", "Other", "Visible hitbox threshold", 0, 18, 4, true)
348
349beforedelay = ui.new_slider("RAGE", "Other", "How long until autowall turns on", 1, 1000, 1, true, 's')
350autodely = ui.new_slider("RAGE", "Other", "How long autowall stays on", 1, 1000, 1, true, 's')
351autowallplayerbutton = ui.new_checkbox("PLAYERS", "Adjustments", 'Autowall this player')
352_autowall_mode_auto_trigger_delay = ui.new_slider('rage', 'other', 'How long autowall stays on after seeing player', 0, 2500, 850, true, 'ms')
353autowallvar1 = false
354autowallvar2 = false
355autowallvar3 = false
356autowallvar4 = false
357autowallvar5 = false
358autowallvar6 = false
359------------INDICATORS
360indicate_enable = ui.new_checkbox("RAGE", "Other", "Indicators")
361indicate_on = ui.new_combobox("RAGE", "Other", "Indicators (drag to move small and big)", "Off", "Small", "Big", "Default")
362indicate_color = ui.new_color_picker("RAGE", "Other", "Indicators")
363indicate_select = ui.new_multiselect("RAGE", "Other", "Indicator select", "Triggermagnet", "Silent aim", "Autowall", "Legitbot improvements", "FOV", "Bruteforce", "Force body aim", "Safe point")
364indicateposition = ui.new_slider("RAGE", "Other", "Reposition Indicators X", 0, 40, 0, true, "x")
365------------FLAGS
366flag_enable = ui.new_checkbox("RAGE", "Other", "Flags")
367flag_color = ui.new_color_picker("RAGE", "Other", "\n flags")
368flag_select = ui.new_multiselect("RAGE", "Other", "\n flags", "Override")
369------------FAKELAG
370flcheckbox = ui.new_checkbox("AA", "Fake lag", "Fake lag")
371flmulti = ui.new_multiselect("AA", "Fake lag", "Fake lag", "Fakelag presets", "Custom fake lag while moving")
372legitflmode = ui_new_combobox("AA", "Fake lag", "\n aa_legit_fl_mode", {
373 "On peek",
374 "On peek & visibility",
375 "Always on",
376 })
377------------LEGITBOT IMPROVEMENTS
378legitbotimprovements = ui.new_checkbox("RAGE", "Other", "Legitbot improvements")
379------------SILENT AIM
380silentbuttonenable = ui.new_checkbox("RAGE", "Other", "Silent settings")
381silentmulti = ui.new_multiselect("RAGE", "Other", "Silent aim settings", "Silent aim on key", "Silent aim if in fov", "Silent aim in distance", "Silent aim while slow walking")
382silentkey = ui.new_hotkey("RAGE", "Other", "Silent Aim On Toggle")
383silentvar1 = false
384silentvar2 = false
385silentvar3 = false
386silentvar4 = false
387silentvar5 = false
388------------SILENT AIM IF FOV
389silentfovslider = ui.new_slider("RAGE", "Other", "Silent aim if in fov", 1, 180, 1, true, "°")
390------------SILENT AIM IN DISTANCE
391silentdistance = ui.new_slider('RAGE', 'Other', 'Silent aim enable in distance', 1, 3000, 1)
392distancecircle = ui.new_checkbox("rage", "other", "Distance circle")
393------------RESOLVER
394--OVERRIDE
395overridebutton = ui.new_checkbox("rage", "other", "Resolver")
396resolverselect = ui.new_combobox("rage", "other", "Resolver", "Override", "Opposite resolver")
397overridekey = ui.new_hotkey("rage", "other", "Override key: Right/Left/Off")
398
399oppositeenable = ui.new_checkbox("PLAYERS", "Adjustments", "Enable resolver")
400------------CUSTOM FAKELAG TRIGGERS
401enablecfl = ui.new_checkbox('AA', 'Fake lag', 'Custom fake lag triggers')
402enablecflcombo = ui.new_combobox('AA', 'Fake lag', 'Custom fake lag triggers', 'Off', 'Slow walk', 'Moving', 'Standing', 'Jumping')
403--slow walk
404slowvariance = ui.new_slider('AA', 'Fake lag', 'Slowwalk variance', 0, 100, 0, true, '%')
405slowlimit = ui.new_slider('AA', 'Fake lag', 'Slowwalk limit', 1, 14, 1, true)
406slowamount = ui.new_combobox('AA', 'Fake lag', 'Slowwalk amount', 'Dynamic', 'Maximum', 'Fluctuate')
407--move
408movevariance = ui.new_slider('AA', 'Fake lag', 'Moving variance', 0, 100, 0, true, '%')
409movelimit = ui.new_slider('AA', 'Fake lag', 'Moving limit', 1, 14, 1, true)
410moveamount = ui.new_combobox('AA', 'Fake lag', 'Moving amount', 'Dynamic', 'Maximum', 'Fluctuate')
411--stand
412standvariance = ui.new_slider('AA', 'Fake lag', 'Standing variance', 0, 100, 0, true, '%')
413standlimit = ui.new_slider('AA', 'Fake lag', 'Standing limit', 1, 14, 1, true)
414standamount = ui.new_combobox('AA', 'Fake lag', 'Standing amount', 'Dynamic', 'Maximum', 'Fluctuate')
415--stand
416jumpvariance = ui.new_slider('AA', 'Fake lag', 'Jumping variance', 0, 100, 0, true, '%')
417jumplimit = ui.new_slider('AA', 'Fake lag', 'Jumping limit', 1, 14, 1, true)
418jumpamount = ui.new_combobox('AA', 'Fake lag', 'Jumping amount', 'Dynamic', 'Maximum', 'Fluctuate')
419------------killsay
420talkshitenable = ui.new_checkbox('RAGE', 'Other', 'Killsay')
421talkshittype = ui.new_combobox('RAGE', 'Other', "Killsay type", 'Basic kill says', 'Custom')
422talkshittext = ui.new_textbox('RAGE', 'Other', "\n text")
423------------
424--REFRENCE--
425------------
426
427ragebot_maximum_fov = ui.reference('RAGE', 'Aimbot', 'maximum fov')
428forcesafepoint = ui.reference('RAGE', 'Aimbot', 'Force safe point')
429
430aaenablers = ui.reference("AA", "Anti-aimbot angles", "Enabled")
431pitch = ui.reference("AA", "Anti-aimbot angles", "Pitch")
432yaw_base = ui.reference("AA", "Anti-aimbot angles", "Yaw base")
433yaw, yaw_num = ui.reference("AA", "Anti-aimbot angles", "Yaw")
434yaw_jitter = ui.reference("AA", "Anti-aimbot angles", "Yaw jitter")
435body, body_num = ui.reference("AA", "Anti-aimbot angles", "Body yaw")
436limit = ui.reference("AA", "Anti-aimbot angles", "Fake yaw limit")
437lby = ui.reference("AA", "Anti-aimbot angles", "Lower body yaw target")
438
439rageautofire = ui.reference("Rage", "Aimbot", "Automatic Fire")
440ragebot, ragebotmode = ui.reference("Rage", "Aimbot", "Enabled")
441autowall = ui.reference("RAGE", "Aimbot", "Automatic Penetration")
442min_dmg = ui.reference('rage', 'aimbot', 'minimum damage')
443trans = ui.reference('VISUALS', 'Effects', 'Transparent props')
444FOVS5 = ui.reference('RAGE', 'AIMBOT', 'Maximum FOV')
445preticle = ui.reference("VISUALS", "Other ESP", "Penetration reticle")
446ref_fl = ui.reference("AA", "Fake lag", "Limit")
447ref_fakeduck = ui.reference("Rage", "Other", "Duck peek assist")
448trigger = ui.reference("RAGE", "Aimbot", "Automatic fire")
449rage_enabl = ui.reference("RAGE", "Aimbot", "Enabled")
450silent = ui.reference("RAGE", "Aimbot", "Silent aim")
451force_body_aim = ui.reference("RAGE", "Other", "Force body aim")
452Max_f0v = ui.reference("RAGE", "Aimbot", "Maximum FOV")
453selectedplayer = ui.reference("players", "players", "player list")
454forcebody1, forcebodyyaw1 = ui.reference("players", "adjustments", "force body yaw")
455resetlist = ui.reference("players", "players", "reset all")
456applyall = ui.reference("players", "adjustments", "Apply to all")
457triggers = ui.reference("AA", "Fake lag", "Triggers")
458fakelag_enable, fakelag_key = ui.reference("AA", "Fake lag", "Enabled")
459triggerz = ui.reference("AA", "Fake lag", "Customize triggers")
460fl, fl_enable = ui.reference("AA", "Fake lag", "Enabled")
461ref_aimbot_enabled = ui.reference("RAGE", "Aimbot", "Enabled")
462ui_fd = ui.reference("Rage", "Other", "Duck peek assist")
463forcebody, forcebodyyaw = ui.reference("players", "adjustments", "force body yaw")
464resetlist = ui.reference("players", "players", "reset all")
465applyall = ui.reference("players", "adjustments", "Apply to all")
466autodirection, autodirection_key = ui.reference("AA", "Anti-aimbot angles", "Freestanding")
467edgeyaw = ui.reference("AA", "Anti-aimbot angles", "Edge yaw")
468bodyyaw_freestand = ui.reference("AA", "Anti-aimbot angles", "Freestanding body yaw")
469fakelag_limit = ui.reference("AA", "Fake lag", "Limit")
470checkbox_reference, hotkey_reference = ui.reference("AA", "Other", "Slow motion")
471brightness, adjustment = ui.reference("Visuals", "Effects", "Brightness adjustment")
472variance = ui.reference("AA", "Fake lag", "Variance")
473amount = ui.reference("AA", "Fake lag", "Amount")
474hitchance = ui.reference("RAGE", "Aimbot", "Minimum hit chance")
475plistoverride = ui.reference("players", "adjustments", "Override anti-aim correction")
476thirdpersonk, forcethirdpkey = ui.reference("VISUALS", "Effects", "Force third person (alive)")
477thirdpersondead = ui.reference("VISUALS", "Effects", "Force third person (dead)")
478infiniteduck = ui.reference("MISC", "Movement", "Infinite duck")
479
480getui = ui.get
481
482function table_contains(tbl, value)
483 for i=1, #tbl do
484 if tbl[i] == value then
485 return true
486 end
487 end
488 return false
489end
490
491--adaptive weapon
492
493bit_band, client_delay_call, client_set_event_callback, entity_get_local_player, entity_get_player_weapon, entity_get_prop, print, func, select, table_insert, table_sort, type, ui.get, ui_name, ui_new_checkbox, ui_new_combobox, ui_new_multiselect, ui_reference, ui.set, ui.set_callback, ui.set_visible, xpcall, pairs = bit.band, client.delay_call, client.set_event_callback, entity.get_local_player, entity.get_player_weapon, entity.get_prop, print, func, select, table.insert, table.sort, type, ui.get, ui.name, ui.new_checkbox, ui.new_combobox, ui.new_multiselect, ui.reference, ui.set, ui.set_callback, ui.set_visible, xpcall, pairs
494adaptive_weapons = {
495 ["Global"] = {},
496 ["Auto"] = {11, 38},
497 ["Awp"] = {9},
498 ["Scout"] = {40},
499 ["Desert Eagle"] = {1},
500 ["Revolver"] = {64},
501 ["Pistol"] = {2, 3, 4, 30, 32, 36, 61, 63},
502 ["Rifle"] = {7, 8, 10, 13, 16, 39, 60},
503 --["Submachine gun"] = {17, 19, 24, 26, 33, 34},
504 --["Machine gun"] = {14, 28},
505 --["Shotgun"] = {25, 27, 29, 35},
506}
507
508local adaptive = {}
509local references = {}
510local callbacks = {}
511local active_config = "Global"
512local weapon_id_lookup_table
513local run_command
514
515function collect_keys(tbl, sort)
516 local keys = {}
517 sort = sort or true
518 for k in pairs(tbl) do
519 keys[#keys + 1] = k
520 end
521 if sort then
522 table_sort(keys)
523 end
524 return keys
525end
526function table_contains(tbl, value)
527 for i=1, #tbl do
528 if tbl[i] == value then
529 return true
530 end
531 end
532 return false
533end
534function create_lookup_table(tbl)
535 local result = {}
536 for name, weapon_ids in pairs(tbl) do
537 for i=1, #weapon_ids do
538 result[weapon_ids[i] ] = name
539 end
540 end
541 return result
542end
543
544adaptive_options2 = ui_new_multiselect("RAGE", "Other", "asddd", "Log", "Visible")
545adaptive_config2 = ui_new_combobox("RAGE", "Aimbot", "addd", collect_keys(adaptive_weapons))
546
547function update_menu(visible)
548 ui.set(adaptive_config2, active_config)
549 if visible then
550 end
551end
552
553run_command = function()
554 local local_player = entity_get_local_player()
555 local weapon_entindex = entity_get_player_weapon(local_player)
556 local item_definition_index = bit_band(65535, entity_get_prop(weapon_entindex, "m_iItemDefinitionIndex"))
557 local config_name = weapon_id_lookup_table[item_definition_index] or "Global"
558 if config_name ~= active_config then
559 active_config = config_name
560 local options = ui.get(adaptive_options2)
561 if table_contains(options, "Log") then
562 print(active_config, " config loaded.")
563 end
564 update_menu(table_contains(options, "Visible"))
565 end
566end
567
568function init()
569 -- Create and reference menu items
570
571 -- Create the lookup table
572 weapon_id_lookup_table = create_lookup_table(adaptive_weapons)
573
574 -- Set custom callbacks for the default menu items
575 for name, reference in pairs(references) do
576 set_callback(reference, update_settings)
577 end
578
579 -- Set callbacks for all of the adaptive menu items
580 for config, items in pairs(adaptive) do
581 for name, reference in pairs(items) do
582 ui.set_callback(reference, handle_adaptive_config)
583 end
584 end
585 client.set_event_callback("run_command", run_command)
586end
587
588init()
589
590--dynamic fov
591hitbox_head, hitbox_neck, hitbox_pelvis, hitbox_spine_0, hitbox_spine_1, hitbox_spine_2, hitbox_spine_3, hitbox_leg_upper_L, hitbox_leg_upper_R, hitbox_leg_lower_L, hitbox_leg_lower_R, hitbox_ankle_L, hitbox_ankle_R, hitbox_hand_L, hitbox_hand_R, hitbox_arm_upper_L, hitbox_arm_lower_L, hitbox_arm_upper_R, hitbox_arm_lower_R = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18
592
593adaptiveselect = ui.reference('RAGE', 'Aimbot', 'addd')
594
595dynamicfov_new_fov = 0
596bool_in_fov = false
597closest_enemy = nil
598
599function dynamicfov_logic()
600 local local_player = entity_get_local_player()
601
602 if not local_player or not entity.is_alive(local_player) then
603 return
604 end
605if ui.get(dynamicfov_enable, true) then
606else return
607end
608if ui.get(dynamicfov_select) == "Adaptive weapon dynamic FOV" then
609return
610end
611 local old_fov = ui.get(ragebot_maximum_fov)
612 dynamicfov_new_fov = old_fov
613 local enemy_players = entity_get_players(true)
614
615 local min_fov = ui.get(dynamicfov_min)
616 local max_fov = ui.get(dynamicfov_max)
617
618 if min_fov > max_fov then
619 local store_min_fov = min_fov
620 min_fov = max_fov
621 max_fov = store_min_fov
622 end
623
624
625 if #enemy_players ~= 0 then
626 local own_x, own_y, own_z = client_eye_position()
627 local own_pitch, own_yaw = client_camera_angles()
628 closest_enemy = nil
629 local closest_distance = 999999999
630
631 for i = 1, #enemy_players do
632 local enemy = enemy_players[i]
633 local enemy_x, enemy_y, enemy_z = entity_hitbox_position(enemy, 0)
634
635 local x = enemy_x - own_x
636 local y = enemy_y - own_y
637 local z = enemy_z - own_z
638
639 local yaw = ((math_atan2(y, x) * 180 / math_pi))
640 local pitch = -(math_atan2(z, math_sqrt(math_pow(x, 2) + math_pow(y, 2))) * 180 / math_pi)
641
642 local yaw_dif = math_abs(own_yaw % 360 - yaw % 360) % 360
643 local pitch_dif = math_abs(own_pitch - pitch ) % 360
644
645 if yaw_dif > 180 then
646 yaw_dif = 360 - yaw_dif
647 end
648
649 local real_dif = math_sqrt(math_pow(yaw_dif, 2) + math_pow(pitch_dif, 2))
650
651 if closest_distance > real_dif then
652 closest_distance = real_dif
653 closest_enemy = enemy
654 end
655 end
656
657 if closest_enemy ~= nil then
658 local closest_enemy_x, closest_enemy_y, closest_enemy_z = entity_hitbox_position(closest_enemy, 0)
659 local real_distance = math_sqrt(math_pow(own_x - closest_enemy_x, 2) + math_pow(own_y - closest_enemy_y, 2) + math_pow(own_z - closest_enemy_z, 2))
660
661 dynamicfov_new_fov = (3800 / real_distance) * (ui.get(dynamicfov_auto_factor) * 0.01)
662
663
664 if (dynamicfov_new_fov > max_fov) then
665 dynamicfov_new_fov = max_fov
666 elseif dynamicfov_new_fov < min_fov then
667 dynamicfov_new_fov = min_fov
668 end
669 end
670
671 dynamicfov_new_fov = math_floor(dynamicfov_new_fov + 0.5)
672
673 if (dynamicfov_new_fov > closest_distance) then
674 bool_in_fov = true
675 else
676 bool_in_fov = false
677 end
678 else
679 dynamicfov_new_fov = min_fov
680 bool_in_fov = false
681 end
682
683
684
685 if dynamicfov_new_fov ~= old_fov then
686 ui.set(ragebot_maximum_fov, dynamicfov_new_fov)
687 end
688
689 end
690--drawing
691function on_paint(ctx)
692 dynamicfov_logic()
693end
694
695client.set_event_callback('paint', on_paint)
696
697--pistol
698
699function dynamicfov_logicpistol()
700 local local_player = entity_get_local_player()
701
702 if not local_player or not entity.is_alive(local_player) then
703 return
704 end
705if ui.get(dynamicfov_enable, true) then
706else return
707end
708if ui.get(dynamicfov_select) == "Adaptive weapon dynamic FOV" then
709else return
710end
711if ui.get(adaptiveselect) == "Desert Eagle" then
712elseif ui.get(adaptiveselect) == "Pistol" then
713elseif ui.get(adaptiveselect) == "Revolver" then
714else return
715end
716 local old_fov = ui.get(ragebot_maximum_fov)
717 dynamicfov_new_fov = old_fov
718 local enemy_players = entity_get_players(true)
719
720 local min_fov = ui.get(dynamicfov_minpistol)
721 local max_fov = ui.get(dynamicfov_maxpistol)
722
723 if min_fov > max_fov then
724 local store_min_fov = min_fov
725 min_fov = max_fov
726 max_fov = store_min_fov
727 end
728
729
730 if #enemy_players ~= 0 then
731 local own_x, own_y, own_z = client_eye_position()
732 local own_pitch, own_yaw = client_camera_angles()
733 closest_enemy = nil
734 local closest_distance = 999999999
735
736 for i = 1, #enemy_players do
737 local enemy = enemy_players[i]
738 local enemy_x, enemy_y, enemy_z = entity_hitbox_position(enemy, 0)
739
740 local x = enemy_x - own_x
741 local y = enemy_y - own_y
742 local z = enemy_z - own_z
743
744 local yaw = ((math_atan2(y, x) * 180 / math_pi))
745 local pitch = -(math_atan2(z, math_sqrt(math_pow(x, 2) + math_pow(y, 2))) * 180 / math_pi)
746
747 local yaw_dif = math_abs(own_yaw % 360 - yaw % 360) % 360
748 local pitch_dif = math_abs(own_pitch - pitch ) % 360
749
750 if yaw_dif > 180 then
751 yaw_dif = 360 - yaw_dif
752 end
753
754 local real_dif = math_sqrt(math_pow(yaw_dif, 2) + math_pow(pitch_dif, 2))
755
756 if closest_distance > real_dif then
757 closest_distance = real_dif
758 closest_enemy = enemy
759 end
760 end
761
762 if closest_enemy ~= nil then
763 local closest_enemy_x, closest_enemy_y, closest_enemy_z = entity_hitbox_position(closest_enemy, 0)
764 local real_distance = math_sqrt(math_pow(own_x - closest_enemy_x, 2) + math_pow(own_y - closest_enemy_y, 2) + math_pow(own_z - closest_enemy_z, 2))
765
766 dynamicfov_new_fov = (3800 / real_distance) * (ui.get(dynamicfov_auto_factor) * 0.01)
767
768
769 if (dynamicfov_new_fov > max_fov) then
770 dynamicfov_new_fov = max_fov
771 elseif dynamicfov_new_fov < min_fov then
772 dynamicfov_new_fov = min_fov
773 end
774 end
775
776 dynamicfov_new_fov = math_floor(dynamicfov_new_fov + 0.5)
777
778 if (dynamicfov_new_fov > closest_distance) then
779 bool_in_fov = true
780 else
781 bool_in_fov = false
782 end
783 else
784 dynamicfov_new_fov = min_fov
785 bool_in_fov = false
786 end
787
788
789
790 if dynamicfov_new_fov ~= old_fov then
791 ui.set(ragebot_maximum_fov, dynamicfov_new_fov)
792 end
793
794 end
795function on_paintpistol(ctx)
796 dynamicfov_logicpistol()
797 end
798client.set_event_callback('paint', on_paintpistol)
799
800--rifle
801
802function dynamicfov_logicrifle()
803 local local_player = entity_get_local_player()
804
805 if not local_player or not entity.is_alive(local_player) then
806 return
807 end
808if ui.get(dynamicfov_enable, true) then
809else return
810end
811if ui.get(dynamicfov_select) == "Adaptive weapon dynamic FOV" then
812else return
813end
814if ui.get(adaptiveselect) == "Rifle" then
815else return
816end
817 local old_fov = ui.get(ragebot_maximum_fov)
818 dynamicfov_new_fov = old_fov
819 local enemy_players = entity_get_players(true)
820
821 local min_fov = ui.get(dynamicfov_minrifle)
822 local max_fov = ui.get(dynamicfov_maxrifle)
823
824 if min_fov > max_fov then
825 local store_min_fov = min_fov
826 min_fov = max_fov
827 max_fov = store_min_fov
828 end
829
830
831 if #enemy_players ~= 0 then
832 local own_x, own_y, own_z = client_eye_position()
833 local own_pitch, own_yaw = client_camera_angles()
834 closest_enemy = nil
835 local closest_distance = 999999999
836
837 for i = 1, #enemy_players do
838 local enemy = enemy_players[i]
839 local enemy_x, enemy_y, enemy_z = entity_hitbox_position(enemy, 0)
840
841 local x = enemy_x - own_x
842 local y = enemy_y - own_y
843 local z = enemy_z - own_z
844
845 local yaw = ((math_atan2(y, x) * 180 / math_pi))
846 local pitch = -(math_atan2(z, math_sqrt(math_pow(x, 2) + math_pow(y, 2))) * 180 / math_pi)
847
848 local yaw_dif = math_abs(own_yaw % 360 - yaw % 360) % 360
849 local pitch_dif = math_abs(own_pitch - pitch ) % 360
850
851 if yaw_dif > 180 then
852 yaw_dif = 360 - yaw_dif
853 end
854
855 local real_dif = math_sqrt(math_pow(yaw_dif, 2) + math_pow(pitch_dif, 2))
856
857 if closest_distance > real_dif then
858 closest_distance = real_dif
859 closest_enemy = enemy
860 end
861 end
862
863 if closest_enemy ~= nil then
864 local closest_enemy_x, closest_enemy_y, closest_enemy_z = entity_hitbox_position(closest_enemy, 0)
865 local real_distance = math_sqrt(math_pow(own_x - closest_enemy_x, 2) + math_pow(own_y - closest_enemy_y, 2) + math_pow(own_z - closest_enemy_z, 2))
866
867 dynamicfov_new_fov = (3800 / real_distance) * (ui.get(dynamicfov_auto_factor) * 0.01)
868
869
870 if (dynamicfov_new_fov > max_fov) then
871 dynamicfov_new_fov = max_fov
872 elseif dynamicfov_new_fov < min_fov then
873 dynamicfov_new_fov = min_fov
874 end
875 end
876
877 dynamicfov_new_fov = math_floor(dynamicfov_new_fov + 0.5)
878
879 if (dynamicfov_new_fov > closest_distance) then
880 bool_in_fov = true
881 else
882 bool_in_fov = false
883 end
884 else
885 dynamicfov_new_fov = min_fov
886 bool_in_fov = false
887 end
888
889
890
891 if dynamicfov_new_fov ~= old_fov then
892 ui.set(ragebot_maximum_fov, dynamicfov_new_fov)
893 end
894
895 end
896--drawing
897function on_paintrifle(ctx)
898 dynamicfov_logicrifle()
899 end
900client.set_event_callback('paint', on_paintrifle)
901
902--scoped weapons
903
904function dynamicfov_logicscope()
905 local local_player = entity_get_local_player()
906
907 if not local_player or not entity.is_alive(local_player) then
908 return
909 end
910if ui.get(dynamicfov_enable, true) then
911else return
912end
913if ui.get(dynamicfov_select) == "Adaptive weapon dynamic FOV" then
914else return
915end
916if ui.get(adaptiveselect) == "Awp" then
917elseif ui.get(adaptiveselect) == "Auto" then
918elseif ui.get(adaptiveselect) == "Scout" then
919else return
920end
921 local old_fov = ui.get(ragebot_maximum_fov)
922 dynamicfov_new_fov = old_fov
923 local enemy_players = entity_get_players(true)
924
925 local min_fov = ui.get(dynamicfov_minscope)
926 local max_fov = ui.get(dynamicfov_maxscope)
927
928 if min_fov > max_fov then
929 local store_min_fov = min_fov
930 min_fov = max_fov
931 max_fov = store_min_fov
932 end
933
934
935 if #enemy_players ~= 0 then
936 local own_x, own_y, own_z = client_eye_position()
937 local own_pitch, own_yaw = client_camera_angles()
938 closest_enemy = nil
939 local closest_distance = 999999999
940
941 for i = 1, #enemy_players do
942 local enemy = enemy_players[i]
943 local enemy_x, enemy_y, enemy_z = entity_hitbox_position(enemy, 0)
944
945 local x = enemy_x - own_x
946 local y = enemy_y - own_y
947 local z = enemy_z - own_z
948
949 local yaw = ((math_atan2(y, x) * 180 / math_pi))
950 local pitch = -(math_atan2(z, math_sqrt(math_pow(x, 2) + math_pow(y, 2))) * 180 / math_pi)
951
952 local yaw_dif = math_abs(own_yaw % 360 - yaw % 360) % 360
953 local pitch_dif = math_abs(own_pitch - pitch ) % 360
954
955 if yaw_dif > 180 then
956 yaw_dif = 360 - yaw_dif
957 end
958
959 local real_dif = math_sqrt(math_pow(yaw_dif, 2) + math_pow(pitch_dif, 2))
960
961 if closest_distance > real_dif then
962 closest_distance = real_dif
963 closest_enemy = enemy
964 end
965 end
966
967 if closest_enemy ~= nil then
968 local closest_enemy_x, closest_enemy_y, closest_enemy_z = entity_hitbox_position(closest_enemy, 0)
969 local real_distance = math_sqrt(math_pow(own_x - closest_enemy_x, 2) + math_pow(own_y - closest_enemy_y, 2) + math_pow(own_z - closest_enemy_z, 2))
970
971 dynamicfov_new_fov = (3800 / real_distance) * (ui.get(dynamicfov_auto_factor) * 0.01)
972
973
974 if (dynamicfov_new_fov > max_fov) then
975 dynamicfov_new_fov = max_fov
976 elseif dynamicfov_new_fov < min_fov then
977 dynamicfov_new_fov = min_fov
978 end
979 end
980
981 dynamicfov_new_fov = math_floor(dynamicfov_new_fov + 0.5)
982
983 if (dynamicfov_new_fov > closest_distance) then
984 bool_in_fov = true
985 else
986 bool_in_fov = false
987 end
988 else
989 dynamicfov_new_fov = min_fov
990 bool_in_fov = false
991 end
992
993
994
995 if dynamicfov_new_fov ~= old_fov then
996 ui.set(ragebot_maximum_fov, dynamicfov_new_fov)
997 end
998
999 end
1000--drawing
1001function on_paintscope(ctx)
1002 dynamicfov_logicscope()
1003 end
1004client.set_event_callback('paint', on_paintscope)
1005
1006--other
1007
1008--scoped weapons
1009
1010function dynamicfov_logicother()
1011 local local_player = entity_get_local_player()
1012
1013 if not local_player or not entity.is_alive(local_player) then
1014 return
1015 end
1016if ui.get(dynamicfov_enable, true) then
1017else return
1018end
1019if ui.get(dynamicfov_select) == "Adaptive weapon dynamic FOV" then
1020else return
1021end
1022if ui.get(adaptiveselect) == "Global" then
1023else return
1024end
1025 local old_fov = ui.get(ragebot_maximum_fov)
1026 dynamicfov_new_fov = old_fov
1027 local enemy_players = entity_get_players(true)
1028
1029 local min_fov = ui.get(dynamicfov_minother)
1030 local max_fov = ui.get(dynamicfov_maxother)
1031
1032 if min_fov > max_fov then
1033 local store_min_fov = min_fov
1034 min_fov = max_fov
1035 max_fov = store_min_fov
1036 end
1037
1038
1039 if #enemy_players ~= 0 then
1040 local own_x, own_y, own_z = client_eye_position()
1041 local own_pitch, own_yaw = client_camera_angles()
1042 closest_enemy = nil
1043 local closest_distance = 999999999
1044
1045 for i = 1, #enemy_players do
1046 local enemy = enemy_players[i]
1047 local enemy_x, enemy_y, enemy_z = entity_hitbox_position(enemy, 0)
1048
1049 local x = enemy_x - own_x
1050 local y = enemy_y - own_y
1051 local z = enemy_z - own_z
1052
1053 local yaw = ((math_atan2(y, x) * 180 / math_pi))
1054 local pitch = -(math_atan2(z, math_sqrt(math_pow(x, 2) + math_pow(y, 2))) * 180 / math_pi)
1055
1056 local yaw_dif = math_abs(own_yaw % 360 - yaw % 360) % 360
1057 local pitch_dif = math_abs(own_pitch - pitch ) % 360
1058
1059 if yaw_dif > 180 then
1060 yaw_dif = 360 - yaw_dif
1061 end
1062
1063 local real_dif = math_sqrt(math_pow(yaw_dif, 2) + math_pow(pitch_dif, 2))
1064
1065 if closest_distance > real_dif then
1066 closest_distance = real_dif
1067 closest_enemy = enemy
1068 end
1069 end
1070
1071 if closest_enemy ~= nil then
1072 local closest_enemy_x, closest_enemy_y, closest_enemy_z = entity_hitbox_position(closest_enemy, 0)
1073 local real_distance = math_sqrt(math_pow(own_x - closest_enemy_x, 2) + math_pow(own_y - closest_enemy_y, 2) + math_pow(own_z - closest_enemy_z, 2))
1074
1075 dynamicfov_new_fov = (3800 / real_distance) * (ui.get(dynamicfov_auto_factor) * 0.01)
1076
1077
1078 if (dynamicfov_new_fov > max_fov) then
1079 dynamicfov_new_fov = max_fov
1080 elseif dynamicfov_new_fov < min_fov then
1081 dynamicfov_new_fov = min_fov
1082 end
1083 end
1084
1085 dynamicfov_new_fov = math_floor(dynamicfov_new_fov + 0.5)
1086
1087 if (dynamicfov_new_fov > closest_distance) then
1088 bool_in_fov = true
1089 else
1090 bool_in_fov = false
1091 end
1092 else
1093 dynamicfov_new_fov = min_fov
1094 bool_in_fov = false
1095 end
1096
1097
1098
1099 if dynamicfov_new_fov ~= old_fov then
1100 ui.set(ragebot_maximum_fov, dynamicfov_new_fov)
1101 end
1102
1103 end
1104--drawing
1105function on_paintother(ctx)
1106 dynamicfov_logicother()
1107 end
1108client.set_event_callback('paint', on_paintother)
1109
1110--dynamic legit aa
1111 --local variables for API. Automatically generated by https://github.com/simpleavaster/gslua/blob/master/authors/sapphyrus/generate_api.lua
1112 local client_latency, client_log, client_draw_rectangle, client_draw_circle_outline, client_userid_to_entindex, client_draw_indicator, client_draw_gradient, client_set_event_callback, client_screen_size, client_eye_position = client.latency, client.log, client.draw_rectangle, client.draw_circle_outline, client.userid_to_entindex, client.draw_indicator, client.draw_gradient, client.set_event_callback, client.screen_size, client.eye_position
1113 local client_draw_circle, client_color_log, client_delay_call, client_draw_text, client_visible, client_exec, client_trace_line, client_set_cvar = client.draw_circle, client.color_log, client.delay_call, client.draw_text, client.visible, client.exec, client.trace_line, client.set_cvar
1114 local client_world_to_screen, client_draw_hitboxes, client_get_cvar, client_draw_line, client_camera_angles, client_draw_debug_text, client_random_int, client_random_float = client.world_to_screen, client.draw_hitboxes, client.get_cvar, client.draw_line, client.camera_angles, client.draw_debug_text, client.random_int, client.random_float
1115 local entity_get_local_player, entity_is_enemy, entity_get_player_name, entity_get_steam64, entity_get_bounding_box, entity_get_all, entity_set_prop, entity_get_player_weapon = entity.get_local_player, entity.is_enemy, entity.get_player_name, entity.get_steam64, entity.get_bounding_box, entity.get_all, entity.set_prop, entity.get_player_weapon
1116 local entity_hitbox_position, entity_get_prop, entity_get_players, entity_get_classname = entity.hitbox_position, entity.get_prop, entity.get_players, entity.get_classname
1117 local globals_realtime, globals_absoluteframetime, globals_tickcount, globals_curtime, globals_mapname, globals_tickinterval, globals_framecount, globals_frametime, globals_maxplayers = globals.realtime, globals.absoluteframetime, globals.tickcount, globals.curtime, globals.mapname, globals.tickinterval, globals.framecount, globals.frametime, globals.maxplayers
1118 local math_ceil, math_tan, math_log10, math_randomseed, math_cos, math_sinh, math_random, math_huge, math_pi, math_max, math_atan2, math_ldexp, math_floor, math_sqrt, math_deg, math_atan, math_fmod = math.ceil, math.tan, math.log10, math.randomseed, math.cos, math.sinh, math.random, math.huge, math.pi, math.max, math.atan2, math.ldexp, math.floor, math.sqrt, math.deg, math.atan, math.fmod
1119 local math_acos, math_pow, math_abs, math_min, math_sin, math_frexp, math_log, math_tanh, math_exp, math_modf, math_cosh, math_asin, math_rad = math.acos, math.pow, math.abs, math.min, math.sin, math.frexp, math.log, math.tanh, math.exp, math.modf, math.cosh, math.asin, math.rad
1120 local table_maxn, table_foreach, table_sort, table_remove, table_foreachi, table_move, table_getn, table_concat, table_insert = table.maxn, table.foreach, table.sort, table.remove, table.foreachi, table.move, table.getn, table.concat, table.insert
1121 local string_find, string_format, string_rep, string_gsub, string_len, string_gmatch, string_dump, string_match, string_reverse, string_byte, string_char, string_upper, string_lower, string_sub = string.find, string.format, string.rep, string.gsub, string.len, string.gmatch, string.dump, string.match, string.reverse, string.byte, string.char, string.upper, string.lower, string.sub
1122 local render_text = renderer.text
1123 local GetBoundingBox = entity.get_bounding_box
1124
1125 local world_to_screen = function(x, y, z, func)
1126 local x, y = renderer.world_to_screen(x, y, z)
1127 if x ~= nil and y ~= nil then
1128 func(x, y)
1129 end
1130 end
1131 --end of local variables
1132 local leftdamage = 0
1133 local rightdamage = 0
1134 local rad2deg = function(rad) return (rad * 180 / math.pi) end
1135 local deg2rad = function(deg) return (deg * math.pi / 180) end
1136 local trace_line = function(entity, start, _end)
1137 return client.trace_line(entity, start.x, start.y, start.z, _end.x, _end.y, _end.z)
1138 end
1139
1140 local screenx, screeny = client_screen_size()
1141
1142 local vector = function(x, y, z)
1143 x = x ~= nil and x or 0
1144 y = y ~= nil and y or 0
1145 z = z ~= nil and z or 0
1146
1147 return {
1148 ["x"] = x,
1149 ["y"] = y,
1150 ["z"] = z
1151 }
1152 end
1153
1154 local vector_add = function(vector1, vector2)
1155 return {
1156 ["x"] = vector1.x + vector2.x,
1157 ["y"] = vector1.y + vector2.y,
1158 ["z"] = vector1.z + vector2.z
1159 }
1160 end
1161
1162 local vector_substract = function(vector1, vector2)
1163 return {
1164 ["x"] = vector1.x - vector2.x,
1165 ["y"] = vector1.y - vector2.y,
1166 ["z"] = vector1.z - vector2.z
1167 }
1168 end
1169 function slot136(slot0, slot1)
1170 for slot5 = 1, #slot0, 1 do
1171 if slot0[slot5] == slot1 then
1172 return true
1173 end
1174 end
1175
1176 return false
1177 end
1178
1179 function slot137(slot0, slot1)
1180 for slot5, slot6 in ipairs(slot0) do
1181 if slot6 == slot1 then
1182 return true, slot5
1183 end
1184 end
1185
1186 return false
1187 end
1188
1189 function slot138()
1190 if ui.get(otherref.tp_alive) and ui.get(otherref.tp_alive_key) then
1191 ui.set_visible(otherref.tp_dead, true)
1192 else
1193 ui.set_visible(otherref.tp_dead, false)
1194 end
1195 end
1196 local clamp_angles = function(angle)
1197 angle = angle % 360
1198 angle = (angle + 360) % 360
1199
1200 if angle > 180 then
1201 angle = angle - 360
1202 end
1203
1204 return angle
1205 end
1206
1207 function LAASetup()
1208 if ui.get(legitAA) then
1209 if ui.get(legitAAbase) == "Manual" then
1210 ui.set_visible(LegitAAHotkey, true)
1211 elseif ui.get(legitAAbase) == "Dynamic" then
1212 ui.set_visible(LegitAAHotkey, false)
1213 end
1214 else
1215 ui.set_visible(LegitAAHotkey, false)
1216 end
1217 end
1218
1219 function LAAFunc()
1220----------------------------------------------------------------------LEGITAA
1221 local legita = ui.get(legitAA)
1222 local base = ui.get(legitAAbase)
1223 local aamodes = ui.get(LegitAABreaker)
1224 local aamoving = ui.get(enableaawm)
1225 local movingbox = ui.get(legitaamoving)
1226
1227 ui.set_visible(legitAAbase, legita)
1228 ui.set_visible(LegitAABreaker, legita)
1229
1230 ui.set_visible(brutemode2, legita and aamodes == "Break bruteforce")
1231 ui.set_visible(ui_indicator_combobox4, legita)
1232 ui.set_visible(ui_indicator_color_picker4, legita)
1233 ui.set_visible(LegitAAHotkey, legita and base == "Manual")
1234----------------------------------------------------------------------LEGITAA WHILE MOVING
1235 ui.set_visible(enableaawm, legita)
1236 ui.set_visible(legitaamoving, legita and aamoving)
1237
1238 ui.set_visible(slowmode, aamoving and legita and movingbox == "Slow walk")
1239 ui.set_visible(movemode, aamoving and legita and movingbox == "Moving")
1240 ui.set_visible(standmode, aamoving and legita and movingbox == "Standing")
1241
1242
1243
1244 if not ui.get(legitAA) then
1245 LAASetup()
1246 ui.set(yaw, "Off")
1247 ui.set(body, "Off")
1248 ui.set(autodirection, "-")
1249 ui.set(autodirection_key, "On hotkey")
1250 ui.set(aaenablers, false)
1251 elseif ui.get(legitAA) then
1252 LAASetup()
1253 ui.set(yaw, "180")
1254 ui.set(yaw_num, 180)
1255 ui.set(body, "Static")
1256 ui.set(autodirection, "-")
1257 ui.set(autodirection_key, "On hotkey")
1258 ui.set(aaenablers, true)
1259 end
1260 end
1261
1262 LAAFunc()
1263 ui.set_callback(legitAA, LAAFunc)
1264 ui.set_callback(legitAAbase, LAAFunc)
1265 ui.set_callback(LegitAAHotkey, LAAFunc)
1266 ui.set_callback(LegitAABreaker, LAAFunc)
1267 ui.set_callback(enableaawm, LAAFunc)
1268 ui.set_callback(legitaamoving, LAAFunc)
1269
1270
1271 local get_atan = function(ent, eye_pos, camera)
1272 local data = { id = nil, dst = 2147483647, fov = 360 }
1273 local screenx, screeny = client_screen_size()
1274 local crosshair = screenx / 2, screeny / 2
1275 for i = 0, 19 do
1276 local hitbox = vector(entity.hitbox_position(ent, i))
1277 local ext = vector_substract(hitbox, eye_pos)
1278
1279 local yaw = rad2deg(math.atan2(ext.y, ext.x))
1280 local pitch = -rad2deg(math.atan2(ext.z, math.sqrt(ext.x^2 + ext.y^2)))
1281
1282 local yaw_dif = math.abs(camera.y % 360 - yaw % 360) % 360
1283 local pitch_dif = math.abs(camera.x - pitch) % 360
1284
1285 if yaw_dif > 180 then
1286 yaw_dif = 360 - yaw_dif
1287 end
1288
1289 local dst = math.sqrt(yaw_dif^2 + pitch_dif^2)
1290 local dstcorrect = math.sqrt(ext.x^2 + ext.y^2 + ext.z^2)
1291 if dstcorrect < data.dst then
1292 data.dst = dstcorrect
1293 data.id = i
1294 data.fov = yaw - crosshair
1295 end
1296 end
1297
1298 return data.id, data.dst, data.fov
1299 end
1300
1301 local function getdistance()
1302 local get_players = entity.get_players(true)
1303
1304 if #get_players == 0 then
1305 return
1306 end
1307 local eye_pos = vector(client.eye_position())
1308 local camera = vector(client.camera_angles())
1309 camera.z = z_pos ~= nil and 64 or camera.z
1310 local distance = math.huge
1311 local closest_enemy = nil
1312 local adv_fov = 1000
1313 local screenx, screeny = client_screen_size()
1314 local crosshair = screenx / 2, screeny / 2
1315 for i = 1, #get_players do
1316 local hitbox_id, dist, fov =
1317 get_atan(get_players[i], eye_pos, camera)
1318 if distance > dist then
1319 distance = dist
1320 hitbox = hitbox_id
1321 closest_enemy = get_players[i]
1322 adv_fov = fov
1323 end
1324 end
1325
1326
1327 return closest_enemy, hitbox, distance, adv_fov
1328 end
1329
1330 function slot158()
1331 if ui.get(yaw) == "Off" then
1332 return
1333 end
1334
1335 if entity_get_prop(entity.get_game_rules(), "m_bFreezePeriod") == 1 then
1336 return
1337 end
1338
1339 local screenx, screeny = client_screen_size()
1340 local lx, ly, lz = entity_get_prop(entity_get_local_player(), "m_angEyeAngles")
1341 local divisor = screenx / 2
1342 local divisor2 = screeny / 2
1343 local size= 15 * cvar.cl_crosshairsize:get_float() * 0.67
1344
1345 if ui.get(yaw_num) ~= 180 and ui.get(yaw_num) ~= -180 then
1346 render_text(divisor, divisor2, 255, 0, 0, 255, "c-", 0, "AA IS BROKEN, SET YAW SLIDER TO 180 OR -180")
1347 render_text(divisor, divisor2 + 10, 255, 0, 0, 255, "c-", 0, "CURRENT YAW: ", ly)
1348 end
1349 end
1350
1351 function slot159()
1352 ui.set(pitch, "Off")
1353 ui.set(yaw_base, "Local view")
1354 ui.set(yaw, "180")
1355 ui.set(yaw_jitter, "Off")
1356 ui.set(edgeyaw, "Off")
1357 ui.set(bodyyaw_freestand, false)
1358 ui.set(autodirection_key, "On hotkey")
1359 end
1360
1361 function slot160()
1362 if not ui.get(legitAA) or ui.get(ref_fakeduck) or ui.get(legitAAbase) == "Dynamic" or entity_get_local_player() == nil or entity_get_prop(entity_get_local_player(), "m_lifeState") ~= 0 then
1363 return
1364 end
1365
1366 if entity_get_prop(entity.get_game_rules(), "m_bFreezePeriod") == 1 then
1367 return
1368 end
1369
1370 local screenx, screeny = client_screen_size()
1371 local halfx = screenx / 2
1372 local halfy = screeny / 2
1373
1374 if ui.get(legitAA) then
1375 if ui.get(legitAAbase) == "Manual" then
1376 ui.set_visible(LegitAAHotkey, true)
1377 ui.set(LegitAAHotkey, "Toggle")
1378
1379 if ui.get(LegitAAHotkey) then
1380 slot159()
1381 ui.set(yaw_num, 180)
1382 ui.set(body_num, 90)
1383
1384 slot94 = "RIGHT"
1385 else
1386 slot159()
1387 ui.set(yaw_num, 180)
1388 ui.set(body_num, -90)
1389
1390 slot94 = "LEFT"
1391 end
1392 else
1393 ui.set_visible(LegitAAHotkey, false)
1394 end
1395 end
1396 end
1397 local edge_count = { [1] = 7, [2] = 12, [3] = 15, [4] = 19, [5] = 23, [6] = 28, [7] = 35, [8] = 39 }
1398
1399 local function do_legit_aa()
1400 local local_player = entity_get_local_player()
1401
1402 if not local_player or not entity.is_alive(local_player) then
1403 return
1404 end
1405
1406 local m_vecOrigin = vector(entity_get_prop(local_player, "m_vecOrigin"))
1407 local m_vecViewOffset = vector(entity_get_prop(local_player, "m_vecViewOffset"))
1408
1409 local m_vecOrigin = vector_add(m_vecOrigin, m_vecViewOffset)
1410
1411 local radius = 20 + 110 + 0.1
1412 local step = math.pi * 2.0 / edge_count[8]
1413
1414 local camera = vector(client.camera_angles())
1415 local central = deg2rad(math.floor(camera.y + 0.5))
1416
1417 local data = {
1418 fraction = 1,
1419 surpassed = false,
1420 angle = vector(0, 0, 0),
1421 var = 0,
1422 side = "LAST KNOWN"
1423 }
1424
1425 for a = central, math.pi * 3.0, step do
1426 if a == central then
1427 central = clamp_angles(rad2deg(a))
1428 local trace_line = function(entity, start, _end)
1429 return client.trace_line(entity, start.x, start.y, start.z, _end.x, _end.y, _end.z)
1430 end
1431 end
1432
1433 local clm = clamp_angles(central - rad2deg(a))
1434 local abs = math.abs(clm)
1435
1436 if abs < 90 and abs > 1 then
1437
1438 local side = "LAST KNOWN"
1439 local location = vector(
1440 radius * math.cos(a) + m_vecOrigin.x,
1441 radius * math.sin(a) + m_vecOrigin.y,
1442 m_vecOrigin.z
1443 )
1444
1445 local _fr, entindex = client.trace_line(local_player, m_vecOrigin.x, m_vecOrigin.y, m_vecOrigin.z, location.x, location.y, location.z)
1446
1447 if math.floor(clm + 0.5) < -21 then side = "LEFT" end
1448 if math.floor(clm + 0.5) > 21 then side = "RIGHT" end
1449
1450 local fr_info = {
1451 fraction = _fr,
1452 surpassed = (_fr < 1),
1453 angle = vector(0, clamp_angles(rad2deg(a)), 0),
1454 var = math.floor(clm + 0.5),
1455 side = side --[ 0 - center / 1 - left / 2 - right ]
1456 }
1457
1458 if data.fraction > _fr then data = fr_info end
1459 end
1460 end
1461
1462 return data
1463 end
1464
1465 function dodynamic()
1466 local local_player = entity_get_local_player()
1467
1468 if not local_player or not entity.is_alive(local_player) then
1469 return
1470 end
1471
1472 local local_player = entity_get_local_player()
1473 topX, topY, botX, botY, alpha = entity.get_bounding_box(client_draw_text, local_player)
1474 local origin = vector(entity_get_prop(local_player, "m_vecOrigin"))
1475 local collision = (entity_get_prop(local_player, "m_Collision"))
1476 local vecmin = vector(entity_get_prop(local_player, "m_vecMins"))
1477 local vecmax = vector(entity_get_prop(local_player, "m_vecMaxs"))
1478 local min = vector_add(vecmin, origin)
1479 local max = vector_add(vecmax, origin)
1480
1481 if not ui.get(legitAA) or ui.get(ref_fakeduck) or ui.get(legitAAbase) == "Manual" then
1482 return
1483 end
1484
1485 if ui.get(legitAA) and ui.get(legitAAbase) == "Dynamic" then
1486
1487 if entity_get_prop(entity.get_game_rules(), "m_bFreezePeriod") == 1 then
1488 return
1489 end
1490 local data = do_legit_aa()
1491
1492 if data == nil then
1493 return
1494 end
1495 if data.fraction < 1 then
1496 slot159()
1497 ui.set(body_num, data.var > 0 and 180 or -180)
1498 ui.set(yaw_num, -180)
1499 end
1500 end
1501
1502
1503
1504
1505 end
1506
1507local function fyls()
1508if ui.get(legitAA) == false then
1509return
1510else
1511 if ui.get(LegitAABreaker) == "Smart" then
1512 ui.set(limit, 60)
1513 ui.set(body, "Static")
1514 elseif ui.get(LegitAABreaker) == "Maximum" then
1515 ui.set(limit, 60)
1516 ui.set(body, "Static")
1517 elseif ui.get(LegitAABreaker) == "Slow" then
1518 ui.set(limit, 60)
1519 ui.set(body, "Static")
1520 elseif ui.get(LegitAABreaker) == "Fast" then
1521 ui.set(limit, 60)
1522 ui.set(body, "Static")
1523 elseif ui.get(LegitAABreaker) == "Break bruteforce" then
1524 ui.set(lby, "Opposite")
1525 ui.set(body, "Static")
1526 end
1527 end
1528 end
1529
1530client.set_event_callback("paint", fyls)
1531
1532
1533 function slot163()
1534 if ui.get(legitAA) then
1535 if ui.get(LegitAABreaker) == "Maximum" then
1536 ui.set(lby, "Opposite")
1537 elseif ui.get(LegitAABreaker) == "Smart" then
1538 ui.set(lby, "Eye yaw")
1539 end
1540 else
1541 ui.set(lby, "Off")
1542 end
1543 end
1544
1545 client.set_event_callback("run_command", function ()
1546 slot158()
1547 slot160()
1548 end)
1549
1550 client.set_event_callback("paint", function (c)
1551 slot163()
1552 dodynamic()
1553 end)
1554
1555 client.set_event_callback("game_newmap", function ()
1556 end)
1557
1558--aa indicator
1559function on_paint(c)
1560 local scrsize_x, scrsize_y = client.screen_size()
1561 local center_x, center_y = scrsize_x / 2, scrsize_y / 2
1562
1563 local indicator = ui.get(ui_indicator_combobox4)
1564 local indicator_r, indicator_g, indicator_b, indicator_a = ui.get(ui_indicator_color_picker4)
1565
1566 if ui.get(body_num) == 90 and indicator == "Metro" and ui.get(legitAA) == true or ui.get(body_num) == 180 and indicator == "Metro" and ui.get(legitAA) == true then
1567 client.draw_text(c, center_x + 45, center_y, indicator_r, indicator_g, indicator_b, indicator_a, "c+", 0, "â®")
1568 elseif ui.get(body_num) == -90 and indicator == "Metro" and ui.get(legitAA) == true or ui.get(body_num) == -180 and indicator == "Metro" and ui.get(legitAA) == true then
1569 client.draw_text(c, center_x - 45, center_y, indicator_r, indicator_g, indicator_b, indicator_a, "c+", 0, "â®")
1570 end
1571 if ui.get(body_num) == 90 and indicator == "Point arrows" and ui.get(legitAA) == true or ui.get(body_num) == 180 and indicator == "Point arrows" and ui.get(legitAA) == true then
1572 client.draw_text(c, center_x + 45, center_y, indicator_r, indicator_g, indicator_b, indicator_a, "c+", 0, "â")
1573 elseif ui.get(body_num) == -90 and indicator == "Point arrows" and ui.get(legitAA) == true or ui.get(body_num) == -180 and indicator == "Point arrows" and ui.get(legitAA) == true then
1574 client.draw_text(c, center_x - 45, center_y, indicator_r, indicator_g, indicator_b, indicator_a, "c+", 0, "â")
1575 end
1576 if ui.get(body_num) == 90 and indicator == "Dashes" and ui.get(legitAA) == true or ui.get(body_num) == 180 and indicator == "Dashes" and ui.get(legitAA) == true then
1577 client.draw_text(c, center_x + 45, center_y, indicator_r, indicator_g, indicator_b, indicator_a, "c-", 0, "â")
1578 elseif ui.get(body_num) == -90 and indicator == "Dashes" and ui.get(legitAA) == true or ui.get(body_num) == -180 and indicator == "Dashes" and ui.get(legitAA) == true then
1579 client.draw_text(c, center_x - 45, center_y, indicator_r, indicator_g, indicator_b, indicator_a, "c-", 0, "â")
1580 end
1581end
1582err = client.set_event_callback('paint', on_paint)
1583--trigger magnet
1584
1585--thx saph for callback shit
1586function on_paint(ctx)
1587 if ui.get(tm_cb) then
1588 local width, height = client.screen_size()
1589 if ui.get(triggermagnet) then
1590 ui.set(rageautofire, true)
1591 ui.set(ragebotmode, "Always on")
1592 else
1593 ui.set(rageautofire, false)
1594 ui.set(ragebotmode, "On hotkey")
1595 end
1596 end
1597end
1598
1599client.set_event_callback("paint", on_paint)
1600
1601reduce = false
1602
1603function reduction(c)
1604if ui.get(tm_cb, true) and ui.get(typeselect) == "Advanced" then
1605else return
1606end
1607local h_key = ui.get(triggermagnet)
1608local hc_slider_ref = ui.get(triggerhtc)
1609local dmg_slider_ref = ui.get(triggerdmg)
1610
1611 if h_key and reduce == false then
1612 stored_hc = ui.get(hitchance)
1613 stored_dmg = ui.get(min_dmg)
1614 ui.set(hitchance, hc_slider_ref)
1615 ui.set(min_dmg, dmg_slider_ref)
1616 reduce = true
1617 elseif not h_key and reduce == true then
1618 ui.set(hitchance, stored_hc)
1619 ui.set(min_dmg, stored_dmg)
1620 reduce = false
1621 end
1622
1623end
1624
1625client.set_event_callback("paint", reduction)
1626
1627-- autowall
1628function on_paint(ctx)
1629 if not ui.get(autowallbutton, true) then
1630 autowallvar1 = false
1631 end
1632 if ui.get(autowallbutton, true) then
1633 else return
1634 end
1635
1636 if ui.get(autowalltoggle) then
1637
1638 autowallvar1 = true
1639
1640 else
1641
1642 autowallvar1 = false
1643
1644 end
1645end
1646
1647client.set_event_callback("paint", on_paint)
1648 --autowall transperency
1649range = false
1650-- Trans range function
1651function changed1(c)
1652local state = table_contains(ui.get(auto_autowall), "Transparent props")
1653local dmg_slider_ref1 = ui.get(slider_trans)
1654local autowaller1 = ui.get(autowalltoggle)
1655 if state and ui.get(autowallbutton, true) then
1656 else return
1657 end
1658
1659
1660 if autowaller1 and range == false then
1661 stored_dmg2 = ui.get(trans)
1662 ui.set(trans, dmg_slider_ref1)
1663 range = true
1664 elseif not autowaller1 and range == true then
1665 ui.set(trans, stored_dmg2)
1666 range = false
1667 end
1668
1669 end
1670client.set_event_callback("paint", changed1)
1671
1672--min dmg override
1673
1674reducer = false
1675
1676function reduction(c)
1677if ui.get(autowallbutton) == true then
1678else return
1679end
1680
1681local state = table_contains(ui.get(auto_autowall), "Min dmg override")
1682 if state and ui.get(autowallbutton) == true then
1683 else return
1684 end
1685
1686local h_key = ui.get(autowalltoggle)
1687local dmg_slider_ref = ui.get(autowalldmg)
1688
1689 if h_key and reducer == false then
1690 stored_hc = ui.get(hitchance)
1691 stored_dmg = ui.get(min_dmg)
1692 ui.set(min_dmg, dmg_slider_ref)
1693 reducer = true
1694 elseif not h_key and reducer == true then
1695 ui.set(min_dmg, stored_dmg)
1696 reducer = false
1697 end
1698
1699end
1700
1701client.set_event_callback("paint", reduction)
1702
1703--penetration reticle
1704function on_paint2(ctx)
1705 local state = table_contains(ui.get(auto_autowall), "Penetration reticle")
1706 if state and ui.get(autowallbutton, true) then
1707 else return
1708 end
1709
1710
1711 if ui.get(autowalltoggle) then
1712 ui.set(preticle, true)
1713 else
1714 ui.set(preticle, false)
1715 end
1716 end
1717
1718
1719client.set_event_callback("paint", on_paint2)
1720--autowall if shot me
1721
1722function enablewhileshotme()
1723autowallvar2 = true
1724 end
1725
1726function disablewhileshotme()
1727autowallvar2 = false
1728 end
1729
1730function on_fire(e)
1731 local userID = e.userid
1732 local userEntIndex = client.userid_to_entindex(userID)
1733
1734 if userEntIndex == entity.get_local_player() then
1735 local state = table_contains(ui.get(auto_autowall), "Autowall if shot me")
1736 if not state then
1737 autowallvar2 = false
1738 return
1739 end
1740if ui.get(autowallbutton, true) then
1741else return
1742end
1743
1744 client.delay_call(globals.tickinterval() * ui.get(beforedelay), enablewhileshotme)
1745 client.delay_call(globals.tickinterval() * ui.get(autodely), disablewhileshotme)
1746 end
1747 end
1748
1749client.set_event_callback("player_hurt", on_fire)
1750
1751function dynamicfov_logicaw()
1752 local state = table_contains(ui.get(auto_autowall), "Dynamic autowall FOV")
1753 if not state then
1754 return
1755 end
1756 if ui.get(autowalltoggle) and ui.get(autowallbutton, true) then
1757 else return
1758 end
1759
1760 local old_fov = ui.get(ragebot_maximum_fov)
1761 dynamicfov_new_fov = old_fov
1762 local enemy_players = entity_get_players(true)
1763
1764 local min_fov = ui.get(dynamicfov_minaw)
1765 local max_fov = ui.get(dynamicfov_maxaw)
1766
1767 if min_fov > max_fov then
1768 local store_min_fov = min_fov
1769 min_fov = max_fov
1770 max_fov = store_min_fov
1771 end
1772
1773
1774 if #enemy_players ~= 0 then
1775 local own_x, own_y, own_z = client_eye_position()
1776 local own_pitch, own_yaw = client_camera_angles()
1777 closest_enemy = nil
1778 local closest_distance = 999999999
1779
1780 for i = 1, #enemy_players do
1781 local enemy = enemy_players[i]
1782 local enemy_x, enemy_y, enemy_z = entity_hitbox_position(enemy, 0)
1783
1784 local x = enemy_x - own_x
1785 local y = enemy_y - own_y
1786 local z = enemy_z - own_z
1787
1788 local yaw = ((math_atan2(y, x) * 180 / math_pi))
1789 local pitch = -(math_atan2(z, math_sqrt(math_pow(x, 2) + math_pow(y, 2))) * 180 / math_pi)
1790
1791 local yaw_dif = math_abs(own_yaw % 360 - yaw % 360) % 360
1792 local pitch_dif = math_abs(own_pitch - pitch ) % 360
1793
1794 if yaw_dif > 180 then
1795 yaw_dif = 360 - yaw_dif
1796 end
1797
1798 local real_dif = math_sqrt(math_pow(yaw_dif, 2) + math_pow(pitch_dif, 2))
1799
1800 if closest_distance > real_dif then
1801 closest_distance = real_dif
1802 closest_enemy = enemy
1803 end
1804 end
1805
1806 if closest_enemy ~= nil then
1807 local closest_enemy_x, closest_enemy_y, closest_enemy_z = entity_hitbox_position(closest_enemy, 0)
1808 local real_distance = math_sqrt(math_pow(own_x - closest_enemy_x, 2) + math_pow(own_y - closest_enemy_y, 2) + math_pow(own_z - closest_enemy_z, 2))
1809
1810 dynamicfov_new_fov = max_fov - ((max_fov - min_fov) * (real_distance - 250) / 1000)
1811 end
1812
1813 if (dynamicfov_new_fov > max_fov) then
1814 dynamicfov_new_fov = max_fov
1815 elseif dynamicfov_new_fov < min_fov then
1816 dynamicfov_new_fov = min_fov
1817 end
1818
1819 dynamicfov_new_fov = math_floor(dynamicfov_new_fov + 0.5)
1820
1821 if (dynamicfov_new_fov > closest_distance) then
1822 bool_in_fov = true
1823 else
1824 bool_in_fov = false
1825 end
1826 else
1827 dynamicfov_new_fov = min_fov
1828 bool_in_fov = false
1829 end
1830
1831
1832
1833 if dynamicfov_new_fov ~= old_fov then
1834 ui.set(ragebot_maximum_fov, dynamicfov_new_fov)
1835 end
1836
1837 end
1838
1839function on_paint(ctx)
1840 dynamicfov_logicaw()
1841 end
1842
1843client.set_event_callback('paint', on_paint)
1844
1845--legitbot weapons
1846
1847function legitbotimp(disab)
1848if ui.get(legitbotimprovements, true) and not ui.get(triggermagnet) then
1849else return
1850end
1851 local_entindex = entity.get_local_player()
1852 local local_weapon = entity.get_player_weapon(local_entindex)
1853 local weapon_name = entity.get_classname(local_weapon)
1854 if weapon_name == "CWeaponAWP" or weapon_name == "CDEagle" or weapon_name == "CWeaponElite" or weapon_name == "CWeaponSSG08" or weapon_name == "CWeaponGlock" or weapon_name == "CWeaponHKP2000" or weapon_name == "CWeaponCZ75" or weapon_name == "CWeaponUSP" or weapon_name == "CWeaponP250" then
1855 ui.set(ragebot, true)
1856 return
1857 end
1858if disab.in_attack == 1 then
1859ui.set(ragebot, false)
1860else
1861ui.set(ragebot, true)
1862end
1863end
1864client.set_event_callback("setup_command", legitbotimp)
1865
1866--indicators
1867
1868legit_active, legit_key = ui.reference("Legit", "Aimbot", "Enabled")
1869rage_active, active_key = ui.reference("RAGE", "Aimbot", "Enabled")
1870
1871indicator = renderer.indicator
1872text = renderer.text
1873w, h = client.screen_size()
1874draw = {
1875 box = renderer.rectangle,
1876 line = renderer.line,
1877 text = renderer.text,
1878 measure_text = renderer.measure_text,
1879 gradient = renderer.gradient
1880}
1881h2o = 5
1882mouse_position = ui.mouse_position
1883wnd = {
1884 x = database.read("speclist_x") or 250,
1885 y = database.read("speclist_y") or 25,
1886 w = database.read("speclist_w") or 150,
1887 dragging = false,
1888 resize = false,
1889 rx = 0,
1890}
1891function intersect(x, y, w, h, debug)
1892 local cx, cy = mouse_position()
1893 debug = debug or false
1894 if debug then
1895 renderer.rectangle(x, y, w, h, 255, 0, 0, 50)
1896 end
1897 return cx >= x and cx <= x + w and cy >= y and cy <= y + h
1898end
1899client.set_event_callback("paint", function(ctx, entity_index)
1900if ui.get(indicate_enable, true) then
1901else return
1902end
1903 local local_player = entity_get_local_player()
1904
1905 if not local_player or not entity.is_alive(local_player) then
1906 return
1907 end
1908 local_entindex = get_local_player()
1909 local local_weapon = entity.get_player_weapon(local_entindex)
1910 local weapon_name = entity.get_classname(local_weapon)
1911 local width, height = client.screen_size()
1912 local indiselect = ui.get(indicate_on)
1913 local triggermag = table_contains(ui.get(indicate_select), "Triggermagnet")
1914 local silentaim = table_contains(ui.get(indicate_select), "Silent aim")
1915 local autowalli = table_contains(ui.get(indicate_select), "Autowall")
1916 local fovi = table_contains(ui.get(indicate_select), "FOV")
1917 local forcebodyaims = table_contains(ui.get(indicate_select), "Force body aim")
1918 local legitboti = table_contains(ui.get(indicate_select), "Legitbot improvements")
1919 local bruteforcei = table_contains(ui.get(indicate_select), "Bruteforce")
1920 local safepointind = table_contains(ui.get(indicate_select), "Safe point")
1921
1922 local cx, cy = mouse_position()
1923
1924 local left_click = client.key_state(0x01)
1925
1926 if not wnd.resize and ui.is_menu_open() then
1927 if wnd.dragging and not left_click then
1928 wnd.dragging = false
1929 end
1930
1931 if wnd.dragging and left_click then
1932 wnd.x = cx - wnd.drag_x
1933 wnd.y = cy - wnd.drag_y
1934 end
1935
1936 if intersect(wnd.x, wnd.y, wnd.w, 180) and left_click then
1937 wnd.dragging = true
1938 wnd.drag_x = cx - wnd.x
1939 wnd.drag_y = cy - wnd.y
1940 end
1941 end
1942 if indiselect == "Default" then
1943 for iiiiiiiii = ui.get(indicateposition),1,-1
1944 do
1945 renderer.indicator(255,255,255,0,iiiiiiiii)
1946 end
1947 end
1948 local r,g,b,a = ui.get(indicate_color)
1949 if getui(rageautofire) == true and triggermag and indiselect == "Small" then
1950 text(wnd.x + 8, wnd.y + 10, r,g,b,a, "", 0, "TRIGGERBOT")
1951 elseif ui.get(rageautofire, true) and triggermag and indiselect == "Big" then
1952 client_draw_text(c, wnd.x + 8, wnd.y + 10, r,g,b,a, "+", 0, "trigger")
1953 elseif ui.get(rageautofire, true) and triggermag and indiselect == "Default" then
1954 renderer.indicator(r,g,b,a, "TM")
1955 end
1956 if getui(silent, true) and silentaim and indiselect == "Small" then
1957 text(wnd.x + 8, wnd.y + 22, r,g,b,a, "", 0, "SILENT AIM")
1958 elseif ui.get(silent, true) and silentaim and indiselect == "Big" then
1959 client_draw_text(c, wnd.x + 8, wnd.y + 30, r,g,b,a, "+", 0, "silent")
1960 elseif ui.get(silent, true) and silentaim and indiselect == "Default" then
1961 renderer.indicator(r,g,b,a, "SILENT")
1962 end
1963 if getui(autowall, true) and autowalli and indiselect == "Small" then
1964 text(wnd.x + 8, wnd.y + 34, r,g,b,a, "", 0, "AUTOWALL")
1965 elseif getui(autowall, true) and autowalli and indiselect == "Big" then
1966 client_draw_text(c, wnd.x + 8, wnd.y + 50, r,g,b,a, "+", 0, "autowall")
1967 elseif getui(autowall, true) and autowalli and indiselect == "Default" then
1968 renderer.indicator(r,g,b,a, "AW")
1969 end
1970 if getui(force_body_aim, true) and forcebodyaims and indiselect == "Small" then
1971 text(wnd.x + 8, wnd.y + 46, r,g,b,a, "", 0, "FORCE BODY AIM")
1972 elseif getui(force_body_aim, true) and forcebodyaims and indiselect == "Big" then
1973 client_draw_text(c, wnd.x + 8, wnd.y + 70, r,g,b,a, "+", 0, "baim")
1974 elseif getui(force_body_aim, true) and forcebodyaims and indiselect == "Default" then
1975 renderer.indicator(r,g,b,a, "BAIM")
1976 end
1977 if fovi and indiselect == "Small" then
1978 text(wnd.x + 8, wnd.y + 58, r,g,b,a, "", 0, "FOV:", getui(ragebot_maximum_fov))
1979 elseif fovi and indiselect == "Big" then
1980 client_draw_text(c, wnd.x + 8, wnd.y + 90, r,g,b,a, "+", 0, "fov:", getui(ragebot_maximum_fov))
1981 elseif fovi and indiselect == "Default" then
1982 renderer.indicator(r,g,b,a, "FOV:", getui(ragebot_maximum_fov))
1983 end
1984 if ui.get(forcebodyyaw) == 60 and bruteforcei and indiselect == "Small" and ui.get(overridebutton, true) and ui.get(resolverselect) == "Override" then
1985 text(wnd.x + 8, wnd.y + 70, r,g,b,a, "", 0, "BRUTE:RIGHT")
1986 elseif ui.get(forcebodyyaw) == 60 and bruteforcei and indiselect == "Big" and ui.get(overridebutton, true) and ui.get(resolverselect) == "Override" then
1987 client_draw_text(c, wnd.x + 8, wnd.y + 110, r,g,b,a, "+", 0, "brute:right")
1988 elseif ui.get(forcebodyyaw) == 60 and bruteforcei and indiselect == "Default" and ui.get(overridebutton, true) and ui.get(resolverselect) == "Override" then
1989 renderer.indicator(r,g,b,a, "B:RIGHT")
1990 end
1991 if ui.get(forcebodyyaw) == -60 and bruteforcei and indiselect == "Small" and ui.get(overridebutton, true) and ui.get(resolverselect) == "Override" then
1992 text(wnd.x + 8, wnd.y + 70, r,g,b,a, "", 0, "BRUTE:LEFT")
1993 elseif ui.get(forcebodyyaw) == -60 and bruteforcei and indiselect == "Big" and ui.get(overridebutton, true) and ui.get(resolverselect) == "Override" then
1994 client_draw_text(c, wnd.x + 8, wnd.y + 110, r,g,b,a, "+", 0, "brute:left")
1995 elseif ui.get(forcebodyyaw) == -60 and bruteforcei and indiselect == "Default" and ui.get(overridebutton, true) and ui.get(resolverselect) == "Override" then
1996 renderer.indicator(r,g,b,a, "B:LEFT")
1997 end
1998 if ui.get(forcebody) == false and bruteforcei and indiselect == "Small" and ui.get(overridebutton, true) and ui.get(resolverselect) == "Override" then
1999 text(wnd.x + 8, wnd.y + 70, r,g,b,a, "", 0, "BRUTE:OFF")
2000 elseif ui.get(forcebody) == false and bruteforcei and indiselect == "Big" and ui.get(overridebutton, true) and ui.get(resolverselect) == "Override" then
2001 client_draw_text(c, wnd.x + 8, wnd.y + 110, r,g,b,a, "+", 0, "brute:off")
2002 elseif ui.get(forcebody) == false and bruteforcei and indiselect == "Default" and ui.get(overridebutton, true) and ui.get(resolverselect) == "Override" then
2003 renderer.indicator(r,g,b,a, "B:OFF")
2004 end
2005 if ui.get(forcesafepoint) and safepointind and indiselect == "Small" then
2006 text(wnd.x + 8, wnd.y + 94, r,g,b,a, "", 0, "SAFE POINT")
2007 elseif ui.get(forcesafepoint) and safepointind and indiselect == "Big" then
2008 client_draw_text(c, wnd.x + 8, wnd.y + 150, r,g,b,a, "+", 0, "safe")
2009 elseif ui.get(forcesafepoint) and safepointind and indiselect == "Default" then
2010 renderer.indicator(r,g,b,a, "SAFE")
2011 end
2012 if weapon_name == "CWeaponAWP" and legitboti and indiselect == "Small" or weapon_name == "CDEagle" and legitboti and indiselect == "Small" or weapon_name == "CWeaponElite" and legitboti and indiselect == "Small" or weapon_name == "CWeaponSSG08" and legitboti and indiselect == "Small" or weapon_name == "CWeaponGlock" and legitboti and indiselect == "Small" or weapon_name == "CWeaponHKP2000" and legitboti and indiselect == "Small" or weapon_name == "CWeaponCZ75" and legitboti and indiselect == "Small" or weapon_name == "CWeaponUSP" and legitboti and indiselect == "Small" or weapon_name == "CWeaponP250" and legitboti and indiselect == "Small" then
2013 text(wnd.x + 8, wnd.y + 82, r,g,b,a, "", 0, "RAGEBOT")
2014 elseif weapon_name == "CWeaponAWP" and legitboti and indiselect == "Big" or weapon_name == "CDEagle" and legitboti and indiselect == "Big" or weapon_name == "CWeaponElite" and legitboti and indiselect == "Big" or weapon_name == "CWeaponSSG08" and legitboti and indiselect == "Big" or weapon_name == "CWeaponGlock" and legitboti and indiselect == "Big" or weapon_name == "CWeaponHKP2000" and legitboti and indiselect == "Big" or weapon_name == "CWeaponCZ75" and legitboti and indiselect == "Big" or weapon_name == "CWeaponUSP" and legitboti and indiselect == "Big" or weapon_name == "CWeaponP250" and legitboti and indiselect == "Big" then
2015 client_draw_text(c, wnd.x + 8, wnd.y + 130, r,g,b,a, "+", 0, "ragebot")
2016 elseif weapon_name == "CWeaponAWP" and legitboti and indiselect == "Default" or weapon_name == "CDEagle" and legitboti and indiselect == "Default" or weapon_name == "CWeaponElite" and legitboti and indiselect == "Default" or weapon_name == "CWeaponSSG08" and legitboti and indiselect == "Default" or weapon_name == "CWeaponGlock" and legitboti and indiselect == "Default" or weapon_name == "CWeaponHKP2000" and legitboti and indiselect == "Default" or weapon_name == "CWeaponCZ75" and legitboti and indiselect == "Default" or weapon_name == "CWeaponUSP" and legitboti and indiselect == "Default" or weapon_name == "CWeaponP250" and legitboti and indiselect == "Default" then
2017 renderer.indicator(r,g,b,a, "RAGE")
2018 else
2019 if legitboti and indiselect == "Small" then
2020 text(wnd.x + 8, wnd.y + 82, r,g,b,a, "", 0, "LEGITBOT")
2021 elseif legitboti and indiselect == "Big" then
2022 client_draw_text(c, wnd.x + 8, wnd.y + 130, r,g,b,a, "+", 0, "legitbot")
2023 elseif legitboti and indiselect == "Default" then
2024 renderer.indicator(r,g,b,a, "LEGIT")
2025 end
2026 end
2027end)
2028
2029function on_paint(ctx)
2030text(0, 0, 255, 0, 0, 255, "b", 0, "User: ", nameofthe_user)
2031end
2032client.set_event_callback('paint', on_paint)
2033
2034local function on_paint(ctx)
2035if nameofthe_user == "nil" then
2036 renderer.rectangle(0, 0, 3000, 3000, 255, 255, 255, 255)
2037 client.exec("play weapons/c4/c4_explode1")
2038 client.exec("say faggot")
2039 client.log("fuck u retard")
2040 ui.set(dynamicfov_enable, false)
2041 ui.set(legitAA, false)
2042 ui.set(tm_cb, false)
2043 ui.set(autowallbutton, false)
2044 ui.set(indicate_enable, false)
2045 ui.set(flag_enable, false)
2046 ui.set(flcheckbox, false)
2047 ui.set(legitbotimprovements, false)
2048 ui.set(silentbuttonenable, false)
2049 ui.set(overridebutton, false)
2050 ui.set(talkshitenable, false)
2051 end
2052end
2053client.set_event_callback("paint", on_paint)
2054
2055-- Tempest AA fix by Kessie and Whæliin
2056
2057local player_is_alive
2058local spamtime = 0
2059local antiresolve
2060local delay_time = 0
2061local inverse_time = 0
2062local anti_resolve_timer = 0
2063
2064function contains(table, val)
2065 for i = 1, #table do
2066 if table[i] == val then
2067 return true
2068 end
2069 end
2070
2071 return false
2072end
2073
2074function anti_resolver2()
2075 if ui.get(legitAA, true) then
2076 else return
2077 end
2078 if ui.get(LegitAABreaker) == "Break bruteforce" then
2079 if ui.get(brutemode2) == "Slow" then
2080 if globals.realtime() >= anti_resolve_timer then
2081 client.delay_call(0.1, ui.set, limit, 60)
2082 client.delay_call(1.1, ui.set, limit, 2)
2083
2084 anti_resolve_timer = globals.realtime() + 1.1
2085 end
2086 end
2087
2088 if ui.get(brutemode2) == "Fast" then
2089 if globals.realtime() >= anti_resolve_timer then
2090 client.delay_call(0.1, ui.set, limit, 60)
2091 client.delay_call(0.5, ui.set, limit, 2)
2092
2093 anti_resolve_timer = globals.realtime() + 0.5
2094 end
2095 end
2096
2097 if ui.get(brutemode2) == "Jitter" then
2098 if globals.realtime() >= anti_resolve_timer then
2099 client.delay_call(0.08, ui.set, limit, 60)
2100 client.delay_call(0.06, ui.set, limit, 0)
2101
2102 anti_resolve_timer = globals.realtime() + 0.2
2103 end
2104 end
2105 end
2106 end
2107client.set_event_callback("run_command", anti_resolver2)
2108
2109--niggahook tag
2110ngahooktag_enabled = ui.new_checkbox("MISC", "Miscellaneous", "nigahook tag")
2111
2112function time_to_ticks(time)
2113 return math_floor(time / globals.tickinterval() + .5)
2114end
2115
2116clan_tag_prev = ""
2117enabled_prev = "Off"
2118
2119function gamesense_anim(text, indices)
2120 local text_anim = " " .. text .. " "
2121 local tickinterval = globals.tickinterval()
2122 local tickcount = globals.tickcount() + time_to_ticks(client_latency())
2123 local i = tickcount / time_to_ticks(0.3)
2124 i = math_floor(i % #indices)
2125 i = indices[i+1]+1
2126
2127 return string_sub(text_anim, i, i+15)
2128end
2129
2130function run_tag_animation()
2131 if ui.get(ngahooktag_enabled, true) then
2132 local clan_tag = gamesense_anim("nigahook", {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 11, 11, 11, 11, 11, 11, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22})
2133 if clan_tag ~= clan_tag_prev then
2134 local fixed = string.sub(clan_tag, 1, 15)
2135 local spaces = string.gsub(fixed, "\x20\x20\x20", "\xE2\xA0\x80")
2136 client.set_clan_tag(spaces)
2137 end
2138 clan_tag_prev = clan_tag
2139 end
2140end
2141
2142function on_paint(ctx)
2143 if ui.get(ngahooktag_enabled, true) then
2144 local local_player = entity.get_local_player()
2145 if local_player ~= nil and (not entity.is_alive(local_player)) and globals.tickcount() % 2 == 0 then
2146 run_tag_animation()
2147 end
2148 end
2149end
2150client.set_event_callback("paint", on_paint)
2151
2152function on_run_command(e)
2153 if ui.get(ngahooktag_enabled, true) then
2154 if e.chokedcommands == 0 then
2155 run_tag_animation()
2156 end
2157 end
2158end
2159client.set_event_callback("run_command", on_run_command)
2160
2161--namespam
2162
2163namecombo = ui.new_combobox("MISC", "Miscellaneous", "Spam type", "nigahook spam", "NA>EU", "Custom")
2164
2165firstlabel = ui.new_label("MISC", "Miscellaneous", "First spam")
2166firstspam = ui.new_textbox("MISC", "Miscellaneous", "First spam")
2167secondlabel = ui.new_label("MISC", "Miscellaneous", "Second spam")
2168secondspam = ui.new_textbox("MISC", "Miscellaneous", "Second spam")
2169thirdlabel = ui.new_label("MISC", "Miscellaneous", "Third spam")
2170thirdspam = ui.new_textbox("MISC", "Miscellaneous", "Third spam")
2171fourthlabel = ui.new_label("MISC", "Miscellaneous", "Fourth spam")
2172fourthspam = ui.new_textbox("MISC", "Miscellaneous", "Fourth spam")
2173
2174function AIDS(name)
2175 client.set_cvar("name", name)
2176end
2177
2178ui.new_button("MISC", "Miscellaneous", "nigahook spam", function ()
2179 oldName = client.get_cvar("name")
2180 if ui.get(namecombo) == "nigahook spam" then
2181 client.delay_call(0.3, AIDS, "Oh")
2182 client.delay_call(0.6, AIDS, "Oh shit")
2183 client.delay_call(0.9, AIDS, "Oh shit its")
2184 client.delay_call(1.2, AIDS, "Oh shit its nigahook")
2185 client.delay_call(1.5, AIDS, oldName)
2186 elseif ui.get(namecombo) == "NA>EU" then
2187 client.delay_call(0.3, AIDS, "$$")
2188 client.delay_call(0.6, AIDS, "$$NA")
2189 client.delay_call(0.9, AIDS, "$$NA>EU")
2190 client.delay_call(1.2, AIDS, "$$NA>EU$$")
2191 client.delay_call(1.5, AIDS, oldName)
2192 elseif ui.get(namecombo) == "Custom" then
2193 client.delay_call(0.3, AIDS, ui.get(firstspam))
2194 client.delay_call(0.6, AIDS, ui.get(secondspam))
2195 client.delay_call(0.9, AIDS, ui.get(thirdspam))
2196 client.delay_call(1.2, AIDS, ui.get(fourthspam))
2197 client.delay_call(1.5, AIDS, oldName)
2198 end
2199end)
2200----silent aim on key
2201function on_paint(ctx)
2202 local state = table_contains(ui.get(silentmulti), "Silent aim on key")
2203 if not state and not ui.get(silentbuttonenable, true) then
2204 silentvar1 = false
2205 return
2206 end
2207
2208 if ui.get(silentkey) then
2209
2210 silentvar1 = true
2211
2212 else
2213
2214 silentvar1 = false
2215
2216 end
2217end
2218
2219client.set_event_callback("paint", on_paint)
2220
2221
2222--silent aim in distance
2223
2224event_handler_functions = {
2225 [true] = client.set_event_callback,
2226 [false] = client.unset_event_callback,
2227}
2228
2229function get_distance(x1, y1, z1, x2, y2, z2)
2230 return math.sqrt((x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2)
2231end
2232
2233function on_run_command()
2234 local state = table_contains(ui.get(silentmulti), "Silent aim in distance")
2235 if not state and not ui.get(silentbuttonenable, true) then
2236 silentvar3 = false
2237 return
2238 end
2239 local players = entity.get_players(true)
2240 local lx, ly, lz = entity.get_prop(entity.get_local_player(), "m_vecOrigin")
2241 for i=1, #players do
2242 local x, y, z = entity.get_prop(players[i], "m_vecOrigin")
2243 local distance = get_distance(lx, ly, lz, x, y, z)
2244 local weapon = entity.get_player_weapon(players[i])
2245 if distance <= ui.get(silentdistance) then
2246 silentvar3 = true
2247 return
2248 else
2249 silentvar3 = false
2250 end
2251 end
2252end
2253
2254client.set_event_callback("run_command", on_run_command)
2255
2256
2257outline = true
2258function rotate_point(x, y, x_center, y_center, rotation)
2259 if rotation == 0 then
2260 return x, y
2261 end
2262
2263 local rotation = math_rad(rotation)
2264 local sin, cos = math_sin(rotation), math_cos(rotation)
2265
2266 local x_new = cos * (x - x_center) - sin * (y - y_center) + x_center
2267 local y_new = sin * (x - x_center) + cos * (y - y_center) + y_center
2268
2269 return x_new, y_new
2270end
2271function draw_circle_3d(ctx, x, y, z, radius, r, g, b, a, accuracy, width, outline, start_degrees, percentage)
2272 local accuracy = accuracy or 3
2273 local width = width or 1
2274 local outline = outline or false
2275 local start_degrees = start_degrees ~= nil and start_degrees or 0
2276 local percentage = percentage ~= nil and percentage or 1
2277
2278 local screen_x_line_old, screen_y_line_old
2279 for rot=start_degrees, start_degrees+percentage*360, accuracy do
2280 local rot_temp = math_rad(rot)
2281 local lineX, lineY, lineZ = radius * math_cos(rot_temp) + x, radius * math_sin(rot_temp) + y, z
2282 local screen_x_line, screen_y_line = client_world_to_screen(ctx, lineX, lineY, lineZ)
2283 if rot == start_degrees then
2284 screen_x_line_old, screen_y_line_old = screen_x_line, screen_y_line
2285 end
2286 if screen_x_line ~=nil and screen_x_line_old ~= nil then
2287 for i=1, width do
2288 local i=i-1
2289 client_draw_line(ctx, screen_x_line, screen_y_line-i, screen_x_line_old, screen_y_line_old-i, r, g, b, a)
2290 end
2291 if outline then
2292 local outline_a = a/255*160
2293 client_draw_line(ctx, screen_x_line, screen_y_line-width, screen_x_line_old, screen_y_line_old-width, 16, 16, 16, outline_a)
2294 client_draw_line(ctx, screen_x_line, screen_y_line+1, screen_x_line_old, screen_y_line_old+1, 16, 16, 16, outline_a)
2295 end
2296 end
2297 screen_x_line_old, screen_y_line_old = screen_x_line, screen_y_line
2298 end
2299end
2300function on_paint(ctx)
2301 local state = table_contains(ui.get(silentmulti), "Silent aim in distance")
2302 if state and ui.get(silentbuttonenable, true) and ui.get(distancecircle, true) then
2303 else return
2304 end
2305
2306 local local_player = entity_get_local_player()
2307 if local_player == nil or not entity_is_alive(local_player) then
2308 return
2309 end
2310
2311 local location_x, location_y, location_z = entity_get_prop(local_player, "m_vecAbsOrigin")
2312 location_z = location_z + 1
2313
2314 local _, base_yaw = client_camera_angles()
2315
2316 local screen_width, screen_height = client_screen_size()
2317 local screen_center_x, screen_center_y = screen_width/2, screen_height/2
2318
2319 if location_x ~= nil then
2320 local world_x, world_y = client_world_to_screen(ctx, location_x, location_y, location_z)
2321
2322
2323 draw_circle_3d(ctx, location_x, location_y, location_z, ui.get(silentdistance), 17, 17, 17, 200, 2.5, 2)
2324
2325 end
2326 end
2327
2328client.set_event_callback("paint", on_paint)
2329
2330--silent aim while slow walking
2331
2332function slowwalksilent(ctx)
2333 local state = table_contains(ui.get(silentmulti), "Silent aim while slow walking")
2334 if not state then
2335 silentvar4 = false
2336 return
2337 end
2338
2339 if ui.get(hotkey_reference) then
2340
2341 silentvar4 = true
2342
2343 else
2344
2345 silentvar4 = false
2346
2347 end
2348end
2349
2350client.set_event_callback("paint", slowwalksilent)
2351
2352
2353--slowwalk
2354
2355slowwalkcheck = ui.new_checkbox("AA", "Other", "Slow motion limit")
2356limit_reference = ui.new_slider("AA", "Other", "Slow motion limit", 10, 57, 50, 57, "", 1, {[57] = "Max"})
2357function modify_velocity(cmd, goalspeed)
2358if ui.get(slowwalkcheck, true) then
2359else return
2360end
2361 if goalspeed <= 0 then
2362 return
2363 end
2364
2365 local minimalspeed = math.sqrt((cmd.forwardmove * cmd.forwardmove) + (cmd.sidemove * cmd.sidemove))
2366
2367 if minimalspeed <= 0 then
2368 return
2369 end
2370
2371 if cmd.in_duck == 1 then
2372 goalspeed = goalspeed * 2.94117647 -- wooo cool magic number
2373 end
2374
2375 if minimalspeed <= goalspeed then
2376 return
2377 end
2378
2379 local speedfactor = goalspeed / minimalspeed
2380 cmd.forwardmove = cmd.forwardmove * speedfactor
2381 cmd.sidemove = cmd.sidemove * speedfactor
2382end
2383
2384function on_setup_cmd(cmd)
2385if ui.get(slowwalkcheck, true) then
2386else return
2387end
2388 local checkbox = ui.get(checkbox_reference)
2389 local hotkey = ui.get(hotkey_reference)
2390 local limit = ui.get(limit_reference)
2391
2392 if limit >= 57 then
2393 return
2394 end
2395
2396 if checkbox and hotkey then
2397 modify_velocity(cmd, limit)
2398 end
2399end
2400
2401client.set_event_callback('setup_command', on_setup_cmd)
2402
2403--experimental dynamic legit aa
2404
2405local flips
2406local desync_types
2407
2408function contains(table, val) --pasted cuz i didnt know that multiselect cant work properly without custom checks
2409 for i=1, #table do
2410 if table[i] == val then
2411 return true
2412 end
2413 end
2414
2415 return false
2416end
2417
2418function switch_desyncs()
2419 if ui.get(legitAAbase, "Dynamic") and ui.get(legitAA, true) then
2420 else return
2421 end
2422
2423 if entity_get_local_player() == nil or entity_get_prop(entity_get_local_player(), "m_iHealth") <= 0 then
2424 return
2425 end
2426
2427 local vel_x, vel_y = entity_get_prop(entity_get_local_player(), "m_vecVelocity")
2428 local vel = math_sqrt(vel_x^2 + vel_y^2)
2429
2430
2431
2432 desync_types = ui.get(LegitAABreaker) == "Smart" and 1 or 0
2433
2434
2435 local sFlips = globals_tickcount() % 100 > 1 and globals_tickcount() % 100 < 50 and true or false
2436
2437 if desync_types == 0 then
2438 if ui.get(LegitAABreaker) == "Slow" then
2439 ui.set(lby, sFlips and "Sway" or "Opposite")
2440 end
2441 if ui.get(LegitAABreaker) == "Fast" then
2442 local random = client_random_int(1, 5)
2443 if random == 1 then
2444 ui.set(lby, "Off")
2445 end
2446 if random == 2 then
2447 ui.set(lby, "Sway")
2448 end
2449 if random == 3 then
2450 ui.set(lby, "Opposite")
2451 end
2452 if random == 4 then
2453 ui.set(lby, sFlips and "Sway" or "Opposite")
2454 end
2455 end
2456 end
2457
2458 end
2459function desync()
2460 if entity_get_local_player() == nil or entity_get_prop(entity_get_local_player(), "m_iHealth") <= 0 then
2461 return
2462 end
2463
2464 local show_desync = desync_types == 0
2465
2466
2467
2468
2469
2470
2471 if ui.get(LegitAABreaker, "Slow" or "Fast") then
2472 switch_desyncs()
2473 end
2474end
2475
2476client.set_event_callback("paint", desync)
2477
2478--aw selected player
2479
2480selectedplayer = ui.reference("players", "players", "player list")
2481player_list = ui.reference("PLAYERS", "Players", "Player list")
2482edgeawplayer = { }
2483
2484ui.set_callback(player_list, function()
2485 ui.set(edgeautowallbutton, edgeawplayer[ui.get(player_list)] or false)
2486end)
2487
2488ui.set_callback(edgeautowallbutton, function()
2489 local plist = ui.get(player_list)
2490 if plist then
2491 edgeawplayer[plist] = ui.get(edgeautowallbutton)
2492 end
2493end)
2494
2495client.set_event_callback("player_connect_full", function(c)
2496 if client.userid_to_entindex(c) == entity.get_local_player() then
2497 edgeawplayer = { }
2498 end
2499end)
2500
2501local client_camera_angles, client_trace_line, entity_get_local_player, entity_get_players, entity_get_prop, entity_hitbox_position, math_acos, math_cos, math_sin, math_sqrt = client.camera_angles, client.trace_line, entity.get_local_player, entity.get_players, entity.get_prop, entity.hitbox_position, math.acos, math.cos, math.sin, math.sqrt
2502
2503maximum_fov_ref = ui_reference("RAGE", "Aimbot", "Maximum FOV")
2504
2505PI = 3.14159265358979323846
2506DEG_TO_RAD = PI / 180.0
2507RAD_TO_DEG = 180.0 / PI
2508
2509--------------------------------------------------------------------------------
2510-- Utility functions
2511--------------------------------------------------------------------------------
2512function vec3_normalize(x, y, z)
2513 local len = math_sqrt(x*x + y*y + z*z)
2514 if len == 0 then
2515 return 0, 0, 0
2516 end
2517 local r = 1 / len
2518 return x*r, y*r, z*r
2519end
2520
2521function vec3_dot(ax, ay, az, bx, by, bz)
2522 return ax*bx + ay*by + az*bz
2523end
2524
2525function angle_to_vec(pitch, yaw)
2526 local pitch_rad, yaw_rad = DEG_TO_RAD*pitch, DEG_TO_RAD*yaw
2527 local sp, cp, sy, cy = math_sin(pitch_rad), math_cos(pitch_rad), math_sin(yaw_rad), math_cos(yaw_rad)
2528 return cp*cy, cp*sy, -sp
2529end
2530
2531function calculate_fov_to_player(ent, lx, ly, lz, fx, fy, fz)
2532 local px, py, pz = entity_get_prop(ent, "m_vecOrigin")
2533 local dx, dy, dz = vec3_normalize(px-lx, py-ly, lz-lz)
2534 local dot_product = vec3_dot(dx, dy, dz, fx, fy, fz)
2535 local cos_inverse = math_acos(dot_product)
2536 return RAD_TO_DEG*cos_inverse
2537end
2538
2539function get_closest_player_to_crosshair(lx, ly, lz, pitch, yaw)
2540 -- Calculate our forward vector once instead of doing it for each player
2541 local fx, fy, fz = angle_to_vec(pitch, yaw)
2542 local enemy_players = entity_get_players(true)
2543
2544 local nearest_player = nil
2545 local nearest_player_fov = math.huge
2546
2547 for i=1, #enemy_players do
2548 local enemy_ent = enemy_players[i]
2549
2550 -- Calculate the FOV to the player so we can determine if they are closer than the stored player
2551 local fov_to_player = calculate_fov_to_player(enemy_ent, lx, ly, lz, fx, fy, fz)
2552
2553 if fov_to_player <= nearest_player_fov then
2554 nearest_player = enemy_ent
2555 nearest_player_fov = fov_to_player
2556 end
2557 end
2558
2559 return nearest_player, nearest_player_fov
2560end
2561
2562function is_player_visible(local_player, lx, ly, lz, ent)
2563 local visible_hitboxes = 0
2564 local visible_hitbox_threshold = ui.get(legit_pen_threshold_ref)
2565
2566 for i=0, 18 do
2567 -- Get the current hitbox position so that we can run a trace to it and see if it is hit
2568 local ex, ey, ez = entity_hitbox_position(ent, i)
2569 -- Run the trace from our eye position to the hitbox if the trace hits the enemy then we know the player is visible
2570 local _, entindex = client_trace_line(local_player, lx, ly, lz, ex, ey, ez)
2571
2572 if entindex == ent then
2573 -- Increment the visible hitbox counter so that we can determine if the player meets the threshold
2574 visible_hitboxes = visible_hitboxes + 1
2575 end
2576 end
2577
2578 return visible_hitboxes >= visible_hitbox_threshold
2579end
2580
2581--------------------------------------------------------------------------------
2582-- Callback functions
2583--------------------------------------------------------------------------------
2584function on_run_command()
2585 local state = table_contains(ui.get(auto_autowall), "Edge autowall")
2586
2587 local maximum_fov = ui.get(maximum_fov_ref)
2588 local local_player = entity_get_local_player()
2589
2590 local pitch, yaw = client_camera_angles()
2591 local lx, ly, lz = entity_get_prop(local_player, "m_vecOrigin")
2592
2593 local nearest_player, nearest_player_fov = get_closest_player_to_crosshair(lx, ly, lz, pitch, yaw)
2594
2595 local view_offset = entity_get_prop(local_player, "m_vecViewOffset[2]")
2596 local lz = lz + view_offset
2597
2598 if nearest_player ~= nil and nearest_player_fov <= maximum_fov and ui.get(autowallbutton, true) and state and ui.get(edgeautowalltype) == "All players" or nearest_player ~= nil and nearest_player_fov <= maximum_fov and ui.get(autowallbutton, true) and state and ui.get(edgeautowalltype) == "Selected players" and ui.get(edgeautowallbutton, true) then
2599 autowallvar3 = is_player_visible(local_player, lx, ly, lz, nearest_player)
2600 else
2601 autowallvar3 = false
2602 end
2603 end
2604
2605
2606client.set_event_callback("run_command", on_run_command)
2607
2608--silent aim if under fov
2609
2610function run_cmd()
2611 local state = table_contains(ui.get(silentmulti), "Silent aim if in fov")
2612 if not state and not ui.get(silentbuttonenable, true) then
2613 silentvar2 = false
2614 return
2615 end
2616 local local_player = entity_get_local_player()
2617
2618 local pitch, yaw = client_camera_angles()
2619 local lx, ly, lz = entity_get_prop(local_player, "m_vecOrigin")
2620
2621 local nearest_player, nearest_player_fov = get_closest_player_to_crosshair(lx, ly, lz, pitch, yaw)
2622
2623 if nearest_player ~= nil and nearest_player_fov <= ui.get(silentfovslider) then
2624 silentvar2 = true
2625 else
2626 silentvar2 = false
2627 end
2628 end
2629
2630client.set_event_callback("run_command", run_cmd)
2631
2632--aw selected player
2633
2634selectedplayer = ui.reference("players", "players", "player list")
2635player_list = ui.reference("PLAYERS", "Players", "Player list")
2636autowallplayer = { }
2637
2638ui.set_callback(player_list, function()
2639 ui.set(autowallplayerbutton, autowallplayer[ui.get(player_list)] or false)
2640end)
2641
2642ui.set_callback(autowallplayerbutton, function()
2643 local plist = ui.get(player_list)
2644 if plist then
2645 autowallplayer[plist] = ui.get(autowallplayerbutton)
2646 end
2647end)
2648
2649client.set_event_callback("paint", function()
2650local autowallplayer = table_contains(ui.get(auto_autowall), "Autowall specific players")
2651 -- Get the aimbots maximum fov so we can determine if a player is within that range
2652 local maximum_fov = ui.get(maximum_fov_ref)
2653 local local_player = entity_get_local_player()
2654
2655 -- Get the local players origin, pitch, and yaw so that we can calculate our FOV to enemies
2656 local pitch, yaw = client_camera_angles()
2657 local lx, ly, lz = entity_get_prop(local_player, "m_vecOrigin")
2658
2659 -- Get the nearest player to our crosshair, and the fov to that player so we can determine if they are in the aimbots range
2660 local nearest_player, nearest_player_fov = get_closest_player_to_crosshair(lx, ly, lz, pitch, yaw)
2661
2662 -- Get our view offset and add it to our origin so that we can trace from our eye position
2663 local view_offset = entity_get_prop(local_player, "m_vecViewOffset[2]")
2664 local lz = lz + view_offset
2665
2666if ui.get(autowallplayerbutton, true) and autowallplayer and ui.get(autowallbutton, true) and nearest_player_fov <= maximum_fov then
2667autowallvar5 = true
2668else
2669autowallvar5 = false
2670end
2671end)
2672
2673client.set_event_callback("player_connect_full", function(c)
2674 if client.userid_to_entindex(c) == entity.get_local_player() then
2675 autowallplayer = { }
2676 end
2677end)
2678
2679--autowall if was visible
2680
2681local function ifvisableaw()
2682local wasvisible = table_contains(ui.get(auto_autowall), "Autowall if was visible")
2683if wasvisible and ui.get(autowallbutton, true) then
2684else return
2685end
2686 local enemy_players = entity_get_players(true)
2687 --check if are found, else sets fov to min
2688 if #enemy_players ~= 0 then
2689 f_var_int_old_closest_enemy = f_var_int_new_closest_enemy
2690
2691 local own_x, own_y, own_z = client_eye_position()
2692 local own_pitch, own_yaw = client_camera_angles()
2693 f_var_int_new_closest_enemy = nil
2694 f_var_float_closest_mouse_distance_to_enemy = 720
2695
2696 for i = 1, #enemy_players do
2697 local enemy = enemy_players[i]
2698 local enemy_x, enemy_y, enemy_z = entity_hitbox_position(enemy, 0)
2699
2700 local x = enemy_x - own_x
2701 local y = enemy_y - own_y
2702 local z = enemy_z - own_z
2703 --needed yaw/pitch to face the enemy
2704 local yaw = ((math_atan2(y, x) * 180 / math_pi))
2705 local pitch = -(math_atan2(z, math_sqrt(math_pow(x, 2) + math_pow(y, 2))) * 180 / math_pi)
2706
2707 local yaw_dif = math_abs(own_yaw % 360 - yaw % 360) % 360
2708 local pitch_dif = math_abs(own_pitch - pitch ) % 360
2709
2710 if yaw_dif > 180 then yaw_dif = 360 - yaw_dif end
2711
2712 local real_dif = math_sqrt(math_pow(yaw_dif, 2) + math_pow(pitch_dif, 2))
2713
2714 if (f_var_float_closest_mouse_distance_to_enemy > real_dif) and (not var_dynamicfov_bool_ignore_out_of_of or (real_dif < var_dynamicfov_int_max)) then
2715 f_var_float_closest_mouse_distance_to_enemy = real_dif
2716 f_var_int_new_closest_enemy = enemy
2717 end
2718
2719 end
2720 end
2721end
2722
2723local f_var_autowall_last_time_spotted = 0
2724
2725local function awifwasvisible()
2726local wasvisible = table_contains(ui.get(auto_autowall), "Autowall if was visible")
2727if wasvisible and ui.get(autowallbutton, true) then
2728else return
2729end
2730 local aw_result = false
2731 local vis_check = 0
2732
2733 if not aw_result and f_var_bool_new_in_fov then
2734 vis_check = -1
2735 --client_log('-1')
2736 if var_autowall_bool_vischeck_beta then
2737 --client_log('0')
2738 if var_autowall_bool_vischeck_closest then
2739 --client_log('1')
2740 local health = entity_get_prop(f_var_int_new_closest_enemy, "m_iHealth")
2741 if health ~= nil and health > 0 then
2742 --client_log('2')
2743 i = f_var_int_new_closest_enemy
2744 if level_0_table[i] ~= nil and not aw_result then
2745 --client_log('3')
2746 for j = 1, #level_0_table[i] do
2747 if level_0_table[i][j] ~= nil and not aw_result then
2748 --client_log('4')
2749 --k starts as 2 to skip the time thing
2750 for k = 2, #level_0_table[i][j] do
2751 if not aw_result then
2752 --client_log('5')
2753 local x, y, z = level_0_table[i][j][k][1], level_0_table[i][j][k][2], level_0_table[i][j][k][3]
2754 if client_visible(x, y, z) then
2755 --client_log('6')
2756 aw_result = true
2757 vis_check = 1
2758 end
2759 end
2760 end
2761 end
2762 end
2763 end
2764 end
2765 else
2766 end
2767 end
2768 end
2769
2770 if not aw_result then
2771 if var_autowall_bool_vischeck_beta then
2772 --client_log('0')
2773 if var_autowall_bool_vischeck_closest then
2774 --client_log('1')
2775 local health = entity_get_prop(f_var_int_new_closest_enemy, "m_iHealth")
2776 if health ~= nil and health > 0 then
2777 --client_log('2')
2778 i = f_var_int_new_closest_enemy
2779 if level_0_table[i] ~= nil and not aw_result then
2780 --client_log('3')
2781 for j = 1, #level_0_table[i] do
2782 if level_0_table[i][j] ~= nil and not aw_result then
2783 --client_log('4')
2784 --k starts as 2 to skip the time thing
2785 for k = 2, #level_0_table[i][j] do
2786 if not aw_result then
2787 --client_log('5')
2788 local x, y, z = level_0_table[i][j][k][1], level_0_table[i][j][k][2], level_0_table[i][j][k][3]
2789 if client_visible(x, y, z) then
2790 --client_log('6')
2791 vis_check = 1
2792 end
2793 end
2794 end
2795 end
2796 end
2797 end
2798 end
2799 else
2800 for i = 1, #level_0_table do
2801 --client_log(' a', i)
2802 if level_0_table[i] ~= nil and not aw_result then
2803 --client_log(' a', false)
2804 local health = entity_get_prop(i, "m_iHealth")
2805 if health ~= nil and health > 0 then
2806 --client_log(' a', true)
2807 for j = 1, #level_0_table[i] do
2808 if level_0_table[i][j] ~= nil and not aw_result then
2809 --client_log(' a', false)
2810 --k starts as 2 to skip the time thing
2811 for k = 2, #level_0_table[i][j] do
2812 if not aw_result then
2813 --client_log(' a', true)
2814 local x, y, z = level_0_table[i][j][k][1], level_0_table[i][j][k][2], level_0_table[i][j][k][3]
2815 if client_visible(x, y, z) then
2816 --client_log(' a', false)
2817 vis_check = 1
2818 end
2819 end
2820 end
2821 end
2822 end
2823 end
2824 end
2825 end
2826 end
2827 else
2828 if vis_check == 0 then
2829 if (f_var_int_new_closest_enemy ~= nil) then
2830 local health = entity_get_prop(f_var_int_new_closest_enemy, "m_iHealth")
2831 if health ~= nil and health > 0 then
2832 for i = 1, 18 do
2833 local x, y, z = entity_hitbox_position(f_var_int_new_closest_enemy , i)
2834 if client_visible(x, y, z) then
2835 vis_check = 1
2836 end
2837 end
2838 end
2839 end
2840 end
2841 end
2842 if vis_check == 1 then
2843 f_var_autowall_last_time_spotted = globals_realtime()
2844 end
2845 if (vis_check ~= 1) and (globals_realtime() - f_var_autowall_last_time_spotted < ui.get(_autowall_mode_auto_trigger_delay) / 1000) then
2846 aw_result = true
2847 end
2848 end
2849
2850 autowallvar6 = aw_result
2851 end
2852local function on_paint()
2853 ifvisableaw()
2854 awifwasvisible()
2855 end
2856client.set_event_callback('paint', on_paint)
2857
2858
2859----------------------- Autowall Handler
2860function AWHandler()
2861 if ui.get(autowallbutton, true) then
2862 else return
2863 end
2864 if autowallvar1 or autowallvar2 or autowallvar3 or autowallvar4 or autowallvar5 or autowallvar6 then
2865
2866 ui.set(autowall, true)
2867
2868 else
2869
2870 ui.set(autowall, false)
2871
2872 end
2873
2874end
2875client.set_event_callback("paint", AWHandler)
2876-----------------------
2877
2878----------------------- Silent aim handler
2879function SilentHandler()
2880if ui.get(silentbuttonenable, true) then
2881else return
2882end
2883 if silentvar1 or silentvar2 or silentvar3 or silentvar4 or silentvar5 then
2884
2885 ui.set(silent, true)
2886
2887 else
2888
2889 ui.set(silent, false)
2890
2891 end
2892
2893end
2894client.set_event_callback("paint", SilentHandler)
2895
2896-----------------------
2897--menu call
2898function set_visible()
2899 local tagenable = ui.get(ngahooktag_enabled)
2900
2901-----------------------------SILENT REF
2902 local silentenable = ui.get(silentbuttonenable)
2903 local under = table_contains(ui.get(silentmulti), "Silent aim if in fov")
2904 local key = table_contains(ui.get(silentmulti), "Silent aim on key")
2905 local distance = table_contains(ui.get(silentmulti), "Silent aim in distance")
2906-----------------------------AUTOWALL REF
2907 local autowallenable = ui.get(autowallbutton)
2908 local transparent = table_contains(ui.get(auto_autowall), "Transparent props")
2909 local reticle = table_contains(ui.get(auto_autowall), "Penetration reticle")
2910 local dynamic = table_contains(ui.get(auto_autowall), "Dynamic autowall FOV")
2911 local shotme = table_contains(ui.get(auto_autowall), "Autowall if shot me")
2912 local edge = table_contains(ui.get(auto_autowall), "Edge autowall")
2913 local dmg = table_contains(ui.get(auto_autowall), "Min dmg override")
2914 local autowallplayer = table_contains(ui.get(auto_autowall), "Autowall specific players")
2915 local edgeawtype = ui.get(edgeautowalltype)
2916 local wasvisible = table_contains(ui.get(auto_autowall), "Autowall if was visible")
2917-----------------------------INDICATORS REF
2918 local indicate = ui.get(indicate_enable)
2919 local indicateselet = ui.get(indicate_on)
2920-----------------------------TRIGGERMAG REF
2921 local triggerenable = ui.get(tm_cb)
2922 local triggerselect = ui.get(typeselect)
2923-----------------------------DYNAMIC FOV REF
2924 local fovenable = ui.get(dynamicfov_enable)
2925 local fovselect = ui.get(dynamicfov_select)
2926 local weaponselect = ui.get(dynamicfov_weapons)
2927-----------------------------RESOLVER REF
2928 local resolverenable = ui.get(overridebutton)
2929 local solverselect = ui.get(resolverselect)
2930-----------------------------FAKELAG REF
2931 local flenable = ui.get(flcheckbox)
2932 local legitfl = table_contains(ui.get(flmulti), "Fakelag presets")
2933 local flwmenable = table_contains(ui.get(flmulti), "Custom fake lag while moving")
2934 local flenabler = ui.get(enablecfl)
2935 local flcomb = ui.get(enablecflcombo)
2936 local legitflm = ui.get(legitflmode)
2937-----------------------------FLAGS REF
2938 local flagenable = ui.get(flag_enable)
2939-----------------------------KILLSAY REF
2940 local killenable = ui.get(talkshitenable)
2941 local killtype = ui.get(talkshittype)
2942-----------------------------NAMESPAM REF
2943 local namespamc = ui.get(namecombo)
2944----------------------------------------------------------------------
2945----------------------------------------------------------------------
2946----------------------------------------------------------------------SILENT AIM
2947----------------------------------------------------------------------
2948----------------------------------------------------------------------
2949 ui.set_visible(silentmulti, silentenable)
2950 ui.set_visible(silentfovslider, silentenable and under)
2951 ui.set_visible(silentkey, silentenable and key)
2952 ui.set_visible(silentdistance, silentenable and distance)
2953 ui.set_visible(distancecircle, silentenable and distance)
2954----------------------------------------------------------------------AUTOWALL
2955 ui.set_visible(auto_autowall, autowallenable)
2956 ui.set_visible(autowalltoggle, autowallenable)
2957 ui.set_visible(slider_trans, autowallenable and transparent)
2958 ui.set_visible(dynamicfov_minaw, autowallenable and dynamic)
2959 ui.set_visible(dynamicfov_maxaw, autowallenable and dynamic)
2960 ui.set_visible(dynamicfov_auto_factoraw, autowallenable and dynamic)
2961 ui.set_visible(autodely, autowallenable and shotme)
2962 ui.set_visible(beforedelay, autowallenable and shotme)
2963 ui.set_visible(autowalldmg, autowallenable and dmg)
2964 ui.set_visible(legit_pen_threshold_ref, autowallenable and edge)
2965 ui.set_visible(edgeautowalltype, autowallenable and edge)
2966 ui.set_visible(edgeautowallbutton, autowallenable and edge and edgeawtype == "Selected players")
2967 ui.set_visible(autowallplayerbutton, autowallenable and autowallplayer)
2968 ui.set_visible(_autowall_mode_auto_trigger_delay, autowallenable and wasvisible)
2969----------------------------------------------------------------------INDICATORS
2970 ui.set_visible(indicate_on, indicate)
2971 ui.set_visible(indicate_select, indicate)
2972 ui.set_visible(indicate_color, indicate)
2973 ui.set_visible(dynamicfov_minaw, autowallenable and dynamic)
2974 ui.set_visible(dynamicfov_maxaw, autowallenable and dynamic)
2975 ui.set_visible(dynamicfov_auto_factoraw, autowallenable and dynamic)
2976 ui.set_visible(autodely, autowallenable and shotme)
2977 ui.set_visible(autowalldmg, autowallenable and dmg)
2978 ui.set_visible(indicateposition, indicateselet == "Default" and indicate)
2979----------------------------------------------------------------------TRIGGERMAG
2980 ui.set_visible(typeselect, triggerenable)
2981 ui.set_visible(triggermagnet, triggerenable)
2982 ui.set_visible(triggerdmg, triggerenable and triggerselect == "Advanced")
2983 ui.set_visible(triggerhtc, triggerenable and triggerselect == "Advanced")
2984----------------------------------------------------------------------DYNAMIC FOV
2985 ui.set_visible(dynamicfov_select, fovenable)
2986 ui.set_visible(dynamicfov_min, fovenable and fovselect == "Default")
2987 ui.set_visible(dynamicfov_max, fovenable and fovselect == "Default")
2988 ui.set_visible(dynamicfov_auto_factor, fovenable)
2989 ui.set_visible(dynamicfov_weapons, fovenable and fovselect == "Adaptive weapon dynamic FOV")
2990 ui.set_visible(dynamicfov_minpistol, fovenable and fovselect == "Adaptive weapon dynamic FOV" and weaponselect == "Pistols")
2991 ui.set_visible(dynamicfov_maxpistol, fovenable and fovselect == "Adaptive weapon dynamic FOV" and weaponselect == "Pistols")
2992 ui.set_visible(dynamicfov_minrifle, fovenable and fovselect == "Adaptive weapon dynamic FOV" and weaponselect == "Rifles")
2993 ui.set_visible(dynamicfov_maxrifle, fovenable and fovselect == "Adaptive weapon dynamic FOV" and weaponselect == "Rifles")
2994 ui.set_visible(dynamicfov_minscope, fovenable and fovselect == "Adaptive weapon dynamic FOV" and weaponselect == "Awp/scout/auto")
2995 ui.set_visible(dynamicfov_maxscope, fovenable and fovselect == "Adaptive weapon dynamic FOV" and weaponselect == "Awp/scout/auto")
2996 ui.set_visible(dynamicfov_minother, fovenable and fovselect == "Adaptive weapon dynamic FOV" and weaponselect == "Smg/other")
2997 ui.set_visible(dynamicfov_maxother, fovenable and fovselect == "Adaptive weapon dynamic FOV" and weaponselect == "Smg/other")
2998----------------------------------------------------------------------RESOLVER
2999 ui.set_visible(resolverselect, resolverenable)
3000 ui.set_visible(overridekey, resolverenable and solverselect == "Override")
3001 ui.set_visible(oppositeenable, resolverenable and solverselect == "Opposite resolver")
3002----------------------------------------------------------------------FLAGS
3003 ui.set_visible(flag_select, flagenable)
3004 ui.set_visible(flag_color, flagenable)
3005----------------------------------------------------------------------KILLSAY
3006 ui.set_visible(talkshittype, killenable)
3007 ui.set_visible(talkshittext, killenable and killtype == "Custom")
3008----------------------------------------------------------------------FAKELAG
3009 ui.set_visible(flmulti, flenable)
3010 ui.set_visible(legitflmode, legitfl and flenable)
3011 ui.set_visible(enablecfl, flenable and flwmenable)
3012 ui.set_visible(enablecflcombo, flenabler and flenable and flwmenable)
3013 ui.set_visible(slowvariance, flenabler and flcomb == "Slow walk" and flenable and flwmenable)
3014 ui.set_visible(slowlimit, flenabler and flcomb == "Slow walk" and flenable and flwmenable)
3015 ui.set_visible(slowamount, flenabler and flcomb == "Slow walk" and flenable and flwmenable)
3016 ui.set_visible(movevariance, flenabler and flcomb == "Moving" and flenable and flwmenable)
3017 ui.set_visible(movelimit, flenabler and flcomb == "Moving" and flenable and flwmenable)
3018 ui.set_visible(moveamount, flenabler and flcomb == "Moving" and flenable and flwmenable)
3019 ui.set_visible(standvariance, flenabler and flcomb == "Standing" and flenable and flwmenable)
3020 ui.set_visible(standlimit, flenabler and flcomb == "Standing" and flenable and flwmenable)
3021 ui.set_visible(standamount, flenabler and flcomb == "Standing" and flenable and flwmenable)
3022 ui.set_visible(jumpvariance, flenabler and flcomb == "Jumping" and flenable and flwmenable)
3023 ui.set_visible(jumplimit, flenabler and flcomb == "Jumping" and flenable and flwmenable)
3024 ui.set_visible(jumpamount, flenabler and flcomb == "Jumping" and flenable and flwmenable)
3025----------------------------------------------------------------------NAMESPAM
3026 ui.set_visible(firstlabel, namespamc == "Custom")
3027 ui.set_visible(secondlabel, namespamc == "Custom")
3028 ui.set_visible(thirdlabel, namespamc == "Custom")
3029 ui.set_visible(fourthlabel, namespamc == "Custom")
3030 ui.set_visible(firstspam, namespamc == "Custom")
3031 ui.set_visible(secondspam, namespamc == "Custom")
3032 ui.set_visible(thirdspam, namespamc == "Custom")
3033 ui.set_visible(fourthspam, namespamc == "Custom")
3034 if not tagenable then
3035 client.set_clan_tag("\0")
3036 end
3037 if legitflm == "On peek" and flenable and legitfl then
3038 ui.set(fakelag_enable, true)
3039 ui.set(fakelag_key, "Always on")
3040 ui.set(triggerz, true)
3041 ui.set(triggers, "On enemy visible")
3042 elseif legitflm == "On peek & visibility" and flenable and legitfl then
3043 ui.set(fakelag_enable, true)
3044 ui.set(fakelag_key, "Always on")
3045 ui.set(triggerz, true)
3046 ui.set(triggers, {
3047 "On enemy visible",
3048 "While enemy visible"
3049 })
3050 elseif legitflm == "Always on" and flenable and legitfl then
3051 ui.set(fakelag_enable, true)
3052 ui.set(fakelag_key, "Always on")
3053 ui.set(triggerz, true)
3054 ui.set(triggers, {
3055 "On enemy visible",
3056 "While enemy visible",
3057 "While moving"
3058 })
3059 elseif legitflm == "While targeted" and flenable and legitfl then
3060 ui.set(fakelag_enable, false)
3061 ui.set(fakelag_key, "Always on")
3062 ui.set(triggerz, false)
3063 elseif not legitfl then
3064 ui.set(fakelag_enable, false)
3065 ui.set(fakelag_key, "On hotkey")
3066 ui.set(triggerz, false)
3067 elseif not flenable then
3068 ui.set(fakelag_enable, false)
3069 ui.set(fakelag_key, "On hotkey")
3070 ui.set(triggerz, false)
3071 end
3072
3073end
3074set_visible()
3075ui.set_callback(flcheckbox, set_visible)
3076ui.set_callback(flmulti, set_visible)
3077ui.set_callback(legitflmode, set_visible)
3078ui.set_callback(enablecflcombo, set_visible)
3079ui.set_callback(enablecfl, set_visible)
3080ui.set_callback(overridebutton, set_visible)
3081ui.set_callback(resolverselect, set_visible)
3082ui.set_callback(dynamicfov_enable, set_visible)
3083ui.set_callback(dynamicfov_select, set_visible)
3084ui.set_callback(dynamicfov_weapons, set_visible)
3085ui.set_callback(tm_cb, set_visible)
3086ui.set_callback(typeselect, set_visible)
3087ui.set_callback(indicate_enable, set_visible)
3088ui.set_callback(indicate_on, set_visible)
3089ui.set_callback(auto_autowall, set_visible)
3090ui.set_callback(autowallbutton, set_visible)
3091ui.set_callback(silentbuttonenable, set_visible)
3092ui.set_callback(silentmulti, set_visible)
3093ui.set_callback(flag_enable, set_visible)
3094ui.set_callback(talkshitenable, set_visible)
3095ui.set_callback(talkshittype, set_visible)
3096ui.set_callback(edgeautowalltype, set_visible)
3097ui.set_callback(ngahooktag_enabled, set_visible)
3098ui.set_callback(namecombo, set_visible)
3099
3100--override key
3101local canManual
3102local target
3103local targetx
3104local targety
3105local targetz
3106local screenposx
3107local screenposy
3108
3109function reset_target(r) --not working for some reason, useless atm
3110if ui.get(overridebutton, true) and ui.get(resolverselect) == "Override" then
3111else return
3112end
3113 client.log(r)
3114 ui.set(selectedplayer, r)
3115 ui.set(forcebody, false)
3116 ui.set(forcebodyyaw, 0)
3117 ui.set(applyall, true)
3118
3119end
3120function setbodyyaw()
3121if ui.get(overridebutton, true) and ui.get(resolverselect) == "Override" then
3122else return
3123end
3124 --client.delay_call(3, reset_target(selectedplayer))
3125 --client.delay_call(5, reset_all) works?
3126
3127 if ui.get(forcebodyyaw) == 0 and canManual == true then
3128 ui.set(forcebody, true)
3129 ui.set(forcebodyyaw, 60)
3130 ui.set(applyall, true)
3131 canManual = false
3132 end
3133
3134 if ui.get(forcebodyyaw) == 60 and canManual == true then
3135 ui.set(forcebody, true)
3136 ui.set(forcebodyyaw, -60)
3137 ui.set(applyall, true)
3138 canManual = false
3139 end
3140
3141 if ui.get(forcebodyyaw) == -60 and canManual == true then
3142 ui.set(forcebody, false)
3143 ui.set(forcebodyyaw, 0)
3144 ui.set(applyall, true)
3145 canManual = false
3146 end
3147
3148
3149end
3150function on_paint()
3151if ui.get(overridebutton, true) and ui.get(resolverselect) == "Override" then
3152else return
3153end
3154 if ui.get(overridekey) then
3155
3156 if canManual == true then
3157
3158 setbodyyaw()
3159 canManual = false
3160
3161 end
3162
3163
3164 else
3165
3166 canManual = true
3167
3168 end
3169
3170end
3171
3172client.set_event_callback("paint", on_paint)
3173
3174--bruteforce indicator/resolver indicator
3175aacorrect = ui.reference("RAGE", "OTHER", "Anti-aim correction")
3176playerlistplayers = ui.reference("PLAYERS", "Players", "Player list")
3177bruteforce_ents = { }
3178
3179client.set_event_callback("run_command", function(c)
3180local overrideselect = table_contains(ui.get(flag_select), "Override")
3181if ui.get(overridebutton, true) and ui.get(resolverselect) == "Override" and ui.get(flag_enable, true) and overrideselect then
3182else return
3183end
3184 if not ui.is_menu_open() then
3185 bruteforce_ents = { }
3186 client.update_player_list()
3187 for _, v in pairs(entity.get_players(true)) do
3188 if ui.get(forcebodyyaw) == -60 or ui.get(forcebodyyaw) == 60 then
3189 table.insert(bruteforce_ents, v)
3190 entity.set_prop(v, "m_flDetectedByEnemySensorTime")
3191 else
3192 entity.set_prop(v, "m_flDetectedByEnemySensorTime", 0)
3193 end
3194 end
3195 end
3196end)
3197
3198client.set_event_callback("paint", function()
3199local overrideselect = table_contains(ui.get(flag_select), "Override")
3200if ui.get(overridebutton, true) and ui.get(resolverselect) == "Override" and ui.get(flag_enable, true) and overrideselect then
3201else return
3202end
3203local r,g,b,a = ui.get(flag_color)
3204 for _, v in pairs(bruteforce_ents) do
3205 local bounding_box = {entity.get_bounding_box(v)}
3206 if #bounding_box == 5 and bounding_box[5] ~= 0 then
3207 local center = bounding_box[1]+(bounding_box[3]-bounding_box[1])/2
3208 if ui.get(forcebodyyaw) == 60 then
3209 renderer.text(center, bounding_box[2]-18, r,g,b,a*bounding_box[5], "bc", 0, "RIGHT")
3210 elseif ui.get(forcebodyyaw) == -60 then
3211 renderer.text(center, bounding_box[2]-18, r,g,b,a*bounding_box[5], "bc", 0, "LEFT")
3212 end
3213 end
3214 end
3215end)
3216
3217--legitaa resolverenable
3218selectedplayer = ui.reference("players", "players", "player list")
3219forcebody, forcebodyyaw = ui.reference("players", "adjustments", "force body yaw")
3220resetlist = ui.reference("players", "players", "reset all")
3221
3222player_list = ui.reference("PLAYERS", "Players", "Player list")
3223force_body, body_slider = ui.reference("PLAYERS", "Adjustments", "Force body yaw")
3224saved_enable = { }
3225
3226ui.set_callback(player_list, function()
3227 ui.set(oppositeenable, saved_enable[ui.get(player_list)] or false)
3228end)
3229
3230ui.set_callback(oppositeenable, function()
3231 local plist = ui.get(player_list)
3232 if plist then
3233 saved_enable[plist] = ui.get(oppositeenable)
3234 end
3235end)
3236
3237function normalize(angle)
3238 while angle > 180 do
3239 angle = angle - 360
3240 end
3241 while angle < -180 do
3242 angle = angle + 360
3243 end
3244
3245 return angle
3246end
3247
3248client.set_event_callback("run_command", function()
3249if ui.get(overridebutton, true) and ui.get(resolverselect) == "Opposite resolver" then
3250else return
3251end
3252 if not ui.is_menu_open() then
3253 client.update_player_list()
3254 for k, v in pairs(saved_enable) do
3255 if entity.is_enemy(k) then
3256 ui.set(player_list, k)
3257 if v then
3258 local velocity = { entity.get_prop(k, "m_vecVelocity") }
3259 if 1 > math.abs(math.sqrt(velocity[1]^2+velocity[2]^2)) then
3260 ui.set(force_body, true)
3261 ui.set(body_slider, -math.min(60, math.max(-60, normalize(entity.get_prop(k, "m_angEyeAngles[1]")-entity.get_prop(k, "m_flLowerBodyYawTarget")))))
3262 end
3263 else
3264 ui.set(force_body, false)
3265 ui.set(body_slider, 0)
3266 end
3267 end
3268 end
3269 end
3270end)
3271
3272client.set_event_callback("player_connect_full", function(c)
3273 if client.userid_to_entindex(c) == entity.get_local_player() then
3274 saved_enable = { }
3275 end
3276end)
3277
3278function getNearestEnemy()
3279if not ui.is_menu_open() then
3280else return
3281end
3282if ui.get(overridebutton, true) and ui.get(resolverselect) == "Opposite resolver" or autowallplayer and ui.get(autowallbutton, true) or ui.get(autowallbutton, true) and ui.get(edgeautowalltype) == "Selected players" and edgeautowall then
3283else return
3284end
3285 local enemy_players = entity.get_players(true)
3286 if #enemy_players ~= 0 then
3287 local own_x, own_y, own_z = client.eye_position()
3288 local own_pitch, own_yaw = client.camera_angles()
3289 local closest_enemy = nil
3290 local closest_distance = 999999999
3291
3292 for i = 1, #enemy_players do
3293 local enemy = enemy_players[i]
3294 local enemy_x, enemy_y, enemy_z = entity.hitbox_position(enemy, 0)
3295
3296 local x = enemy_x - own_x
3297 local y = enemy_y - own_y
3298 local z = enemy_z - own_z
3299
3300 local yaw = ((math.atan2(y, x) * 180 / math.pi))
3301 local pitch = -(math.atan2(z, math.sqrt(math.pow(x, 2) + math.pow(y, 2))) * 180 / math.pi)
3302
3303 local yaw_dif = math.abs(own_yaw % 360 - yaw % 360) % 360
3304 local pitch_dif = math.abs(own_pitch - pitch ) % 360
3305
3306 if yaw_dif > 180 then yaw_dif = 360 - yaw_dif end
3307 local real_dif = math.sqrt(math.pow(yaw_dif, 2) + math.pow(pitch_dif, 2))
3308
3309 if closest_distance > real_dif then
3310 closest_distance = real_dif
3311 closest_enemy = enemy
3312 end
3313 end
3314
3315 if closest_enemy ~= nil then
3316 return closest_enemy, closest_distance
3317 end
3318 end
3319
3320 return nil, nil
3321end
3322
3323function setplist()
3324local autowallplayer = table_contains(ui.get(auto_autowall), "Autowall specific players")
3325local edgeautowall = table_contains(ui.get(auto_autowall), "Edge autowall")
3326if ui.get(overridebutton, true) and ui.get(resolverselect) == "Opposite resolver" or autowallplayer and ui.get(autowallbutton, true) or ui.get(autowallbutton, true) and ui.get(edgeautowalltype) == "Selected players" and edgeautowall then
3327else return
3328end
3329 -- Get the aimbots maximum fov so we can determine if a player is within that range
3330 local maximum_fov = ui.get(maximum_fov_ref)
3331 local local_player = entity_get_local_player()
3332
3333 -- Get the local players origin, pitch, and yaw so that we can calculate our FOV to enemies
3334 local pitch, yaw = client_camera_angles()
3335 local lx, ly, lz = entity_get_prop(local_player, "m_vecOrigin")
3336
3337 -- Get the nearest player to our crosshair, and the fov to that player so we can determine if they are in the aimbots range
3338 local nearest_player, nearest_player_fov = get_closest_player_to_crosshair(lx, ly, lz, pitch, yaw)
3339
3340 -- Get our view offset and add it to our origin so that we can trace from our eye position
3341 local view_offset = entity_get_prop(local_player, "m_vecViewOffset[2]")
3342 local lz = lz + view_offset
3343
3344 if nearest_player_fov <= 170 then
3345 ui.set(selectedplayer, getNearestEnemy())
3346 return
3347 end
3348end
3349
3350client.set_event_callback("paint", setplist)
3351
3352function setaa()
3353if ui.get(overridebutton, true) and ui.get(resolverselect) == "Opposite resolver" then
3354else return
3355end
3356 if ui.get(oppositeenable, true) then
3357 ui.set(aacorrect, false)
3358 else
3359 ui.set(aacorrect, true)
3360 end
3361end
3362
3363client.set_event_callback("paint", setaa)
3364
3365ui.set_visible(adaptive_options2, false)
3366ui.set_visible(adaptive_config2, false)
3367
3368
3369--fakelag triggers
3370
3371client.set_event_callback("setup_command", function (cms)
3372if ui.get(flcheckbox, true) then
3373else return
3374end
3375 local flwmenable = table_contains(ui.get(flmulti), "Custom fake lag while moving")
3376 if flwmenable and ui.get(enablecfl, true) and ui.get(flcheckbox, true) then
3377 else return
3378 end
3379 ui.set(variance, cms.sidemove == 0 and cms.forwardmove == 0 and ui.get(standvariance) or ui.get(movevariance))
3380 ui.set(fakelag_limit, cms.sidemove == 0 and cms.forwardmove == 0 and ui.get(standlimit) or ui.get(movelimit))
3381 ui.set(amount, cms.sidemove == 0 and cms.forwardmove == 0 and ui.get(standamount) or ui.get(moveamount))
3382end)
3383local function get_velocity(ent)
3384local flwmenable = table_contains(ui.get(flmulti), "Custom fake lag while moving")
3385if ui.get(flcheckbox, true) and flwmenable then
3386else return
3387end
3388
3389 local vecVelx, vecVely, vecVelz = entity.get_prop(ent, "m_vecVelocity")
3390
3391 if vecVelx == nil and vecVely == nil and vecVelz == nil then
3392 return 0
3393 end
3394
3395 return math.sqrt(vecVelx*vecVelx + vecVely*vecVely + vecVelz*vecVelz);
3396end
3397
3398local function eventhandler_paint(ctx)
3399 local flwmenable = table_contains(ui.get(flmulti), "Custom fake lag while moving")
3400 local localplayer = entity.get_local_player()
3401 if flwmenable and ui.get(enablecfl, true) and ui.get(flcheckbox, true) and not localplayer == nil then
3402 else return
3403 end
3404 local flags = get_prop(localplayer, "m_fFlags");
3405 local onground = bit.band(flags, 1);
3406 if onground == 0 then
3407 ui.set(variance, ui.get(jumpvariance))
3408 ui.set(fakelag_limit, ui.get(jumplimit))
3409 ui.set(amount, ui.get(jumpamount))
3410 end
3411end
3412
3413client.set_event_callback("paint", eventhandler_paint)
3414
3415--custom aa while moving
3416
3417function aaslowwalk_menu()
3418 if ui.get(enableaawm, true) and ui.get(hotkey_reference) then
3419 else return
3420 end
3421 ui.set(LegitAABreaker, ui.get(slowmode))
3422 end
3423client.set_event_callback("paint", aaslowwalk_menu)
3424client.set_event_callback("setup_command", function (cme)
3425 if ui.get(hotkey_reference) or ui.get(ref_fakeduck) then
3426 return
3427 end
3428 if ui.get(enableaawm, true) then
3429 ui.set(LegitAABreaker, cme.sidemove == 0 and cme.forwardmove == 0 and ui.get(standmode) or ui.get(movemode))
3430 end
3431end)
3432
3433--killsay
3434
3435userid_to_entindex = client.userid_to_entindex
3436get_player_name = entity.get_player_name
3437get_local_player = entity.get_local_player
3438is_enemy = entity.is_enemy
3439
3440function on_player_death(e)
3441if ui.get(talkshitenable, true) then
3442else return
3443end
3444 local random = client_random_int(1, 4)
3445 local victim_userid, attacker_userid = e.userid, e.attacker
3446 if victim_userid == nil or attacker_userid == nil then
3447 return
3448 end
3449
3450 local victim_entindex = userid_to_entindex(victim_userid)
3451 local attacker_entindex = userid_to_entindex(attacker_userid)
3452
3453 if attacker_entindex == get_local_player() and is_enemy(victim_entindex) then
3454 else return
3455 end
3456
3457 if random == 1 and ui.get(talkshittype) == "Basic kill says" then
3458 client.exec("say cya retard")
3459 elseif random == 2 and ui.get(talkshittype) == "Basic kill says" then
3460 client.exec("say you pay?")
3461 elseif random == 3 and ui.get(talkshittype) == "Basic kill says" then
3462 client.exec("say refund")
3463 elseif random == 4 and ui.get(talkshittype) == "Basic kill says" then
3464 client.exec("say effortless")
3465 end
3466 if ui.get(talkshittype) == "Custom" then
3467 client.exec("say ", ui.get(talkshittext))
3468 end
3469end
3470
3471client.set_event_callback('player_death', on_player_death)
3472
3473function thirdp()
3474if ui.get(forcethirdpkey) then
3475ui.set(thirdpersondead, true)
3476else
3477ui.set(thirdpersondead, false)
3478end
3479end
3480
3481client.set_event_callback('paint', thirdp)
3482
3483 client.set_event_callback("round_start", function ()
3484 autowallvar1 = false
3485 autowallvar2 = false
3486 autowallvar3 = false
3487 autowallvar4 = false
3488 autowallvar5 = false
3489 autowallvar6 = false
3490 ui.set(body_slider, 0)
3491 ui.set(forcebody1, false)
3492 ui.set(applyall, true)
3493silentvar1 = false
3494silentvar2 = false
3495silentvar3 = false
3496silentvar4 = false
3497silentvar5 = false
3498 end)
3499
3500client.set_event_callback("player_death", function(e)
3501 if client.userid_to_entindex(e.attacker) == entity.get_local_player() and client.userid_to_entindex(e.userid) ~= entity.get_local_player() and not entity.is_enemy(client.userid_to_entindex(e.userid)) then
3502
3503 client.exec("say 1 retard")
3504 end
3505end)
3506
3507-- Advanced Aimbot Logs
3508local aimbotlog_enable = ui.new_checkbox("Rage", "Other", "Advanced aimbot logging")
3509local on_fire_enable = ui.new_checkbox("Rage", "Other", "Fire log")
3510local on_fire_colour = ui.new_color_picker("Rage", "Other", "Fire log", 147, 112, 219, 255)
3511local on_miss_enable = ui.new_checkbox("Rage", "Other", "Miss log")
3512local on_miss_colour = ui.new_color_picker("Rage", "Other", "Miss log", 255, 253, 166, 255)
3513local on_damage_enable = ui.new_checkbox("Rage", "Other", "Damage log")
3514local on_damage_colour = ui.new_color_picker("Rage", "Other", "Damage log", 100, 149, 237, 255)
3515local str_fmt = string.format
3516
3517local function handle_menu()
3518 if ui.get(aimbotlog_enable) then
3519 ui.set_visible(on_fire_enable, true)
3520 ui.set_visible(on_fire_colour, true)
3521 ui.set_visible(on_miss_enable, true)
3522 ui.set_visible(on_miss_colour, true)
3523 ui.set_visible(on_damage_enable, true)
3524 ui.set_visible(on_damage_colour, true)
3525 else
3526 ui.set_visible(on_fire_enable, false)
3527 ui.set_visible(on_fire_colour, false)
3528 ui.set_visible(on_miss_enable, false)
3529 ui.set_visible(on_miss_colour, false)
3530 ui.set_visible(on_damage_enable, false)
3531 ui.set_visible(on_damage_colour, false)
3532 end
3533end
3534handle_menu()
3535ui.set_callback(aimbotlog_enable, handle_menu)
3536
3537local function on_aim_fire(e)
3538 if ui.get(aimbotlog_enable) and ui.get(on_fire_enable) and e ~= nil then
3539 local r, g, b = ui.get(on_fire_colour)
3540 local hitgroup_names = { "body", "head", "chest", "stomach", "left arm", "right arm", "left leg", "right leg", "neck", "?", "gear" }
3541 local group = hitgroup_names[e.hitgroup + 1] or "?"
3542 local tickrate = client.get_cvar("cl_cmdrate") or 64
3543 local target_name = entity.get_player_name(e.target)
3544 local ticks = math.floor((e.backtrack * tickrate) + 0.5)
3545 local flags = {
3546 e.teleported and 't' or '',
3547 e.interpolated and 'i' or '',
3548 e.extrapolated and 'e' or '',
3549 e.boosted and 'b' or '',
3550 e.high_priority and 'h' or ''
3551 }
3552
3553 client.color_log(r, g, b,
3554 "fired at " ..
3555 string.lower(target_name) ..
3556 "'s " ..
3557 group ..
3558 " for " ..
3559 e.damage ..
3560 " damage (hc: " ..
3561 str_fmt("%d", e.hit_chance) ..
3562 "% bt: " ..
3563 e.backtrack ..
3564 " (", ticks, " tks) " ..
3565 " flgs: " ..
3566 table.concat(flags) ..
3567 ")")
3568 end
3569end
3570
3571local function on_player_hurt(e)
3572 if ui.get(aimbotlog_enable) and ui.get(on_damage_enable) then
3573 local attacker_id = client.userid_to_entindex(e.attacker)
3574 if attacker_id == nil then
3575 return
3576 end
3577
3578 if attacker_id ~= entity.get_local_player() then
3579 return
3580 end
3581
3582 local hitgroup_names = { "body", "head", "chest", "stomach", "left arm", "right arm", "left leg", "right leg", "neck", "?", "gear" }
3583 local group = hitgroup_names[e.hitgroup + 1] or "?"
3584 local target_id = client.userid_to_entindex(e.userid)
3585 local target_name = entity.get_player_name(target_id)
3586
3587 local message = "hit " .. string.lower(target_name) .. "'s " .. group .. " for " .. e.dmg_health .. " damage (" .. e.health .. " remaining)"
3588 if e.health <= 0 then
3589 message = message .. " *dead*"
3590 end
3591
3592-- WASD Strafer
3593
3594local aimbotlog_enable = ui.new_checkbox("Rage", "Other", "Advanced aimbot logging")
3595local on_fire_enable = ui.new_checkbox("Rage", "Other", "Fire log")
3596local on_fire_colour = ui.new_color_picker("Rage", "Other", "Fire log", 147, 112, 219, 255)
3597local on_miss_enable = ui.new_checkbox("Rage", "Other", "Miss log")
3598local on_miss_colour = ui.new_color_picker("Rage", "Other", "Miss log", 255, 253, 166, 255)
3599local on_damage_enable = ui.new_checkbox("Rage", "Other", "Damage log")
3600local on_damage_colour = ui.new_color_picker("Rage", "Other", "Damage log", 100, 149, 237, 255)
3601local str_fmt = string.format
3602
3603local function handle_menu()
3604 if ui.get(aimbotlog_enable) then
3605 ui.set_visible(on_fire_enable, true)
3606 ui.set_visible(on_fire_colour, true)
3607 ui.set_visible(on_miss_enable, true)
3608 ui.set_visible(on_miss_colour, true)
3609 ui.set_visible(on_damage_enable, true)
3610 ui.set_visible(on_damage_colour, true)
3611 else
3612 ui.set_visible(on_fire_enable, false)
3613 ui.set_visible(on_fire_colour, false)
3614 ui.set_visible(on_miss_enable, false)
3615 ui.set_visible(on_miss_colour, false)
3616 ui.set_visible(on_damage_enable, false)
3617 ui.set_visible(on_damage_colour, false)
3618 end
3619end
3620handle_menu()
3621ui.set_callback(aimbotlog_enable, handle_menu)
3622
3623local function on_aim_fire(e)
3624 if ui.get(aimbotlog_enable) and ui.get(on_fire_enable) and e ~= nil then
3625 local r, g, b = ui.get(on_fire_colour)
3626 local hitgroup_names = { "body", "head", "chest", "stomach", "left arm", "right arm", "left leg", "right leg", "neck", "?", "gear" }
3627 local group = hitgroup_names[e.hitgroup + 1] or "?"
3628 local tickrate = client.get_cvar("cl_cmdrate") or 64
3629 local target_name = entity.get_player_name(e.target)
3630 local ticks = math.floor((e.backtrack * tickrate) + 0.5)
3631 local flags = {
3632 e.teleported and 't' or '',
3633 e.interpolated and 'i' or '',
3634 e.extrapolated and 'e' or '',
3635 e.boosted and 'b' or '',
3636 e.high_priority and 'h' or ''
3637 }
3638
3639 client.color_log(r, g, b,
3640 "fired at " ..
3641 string.lower(target_name) ..
3642 "'s " ..
3643 group ..
3644 " for " ..
3645 e.damage ..
3646 " damage (hc: " ..
3647 str_fmt("%d", e.hit_chance) ..
3648 "% bt: " ..
3649 e.backtrack ..
3650 " (", ticks, " tks) " ..
3651 " flgs: " ..
3652 table.concat(flags) ..
3653 ")")
3654 end
3655end
3656
3657local function on_player_hurt(e)
3658 if ui.get(aimbotlog_enable) and ui.get(on_damage_enable) then
3659 local attacker_id = client.userid_to_entindex(e.attacker)
3660 if attacker_id == nil then
3661 return
3662 end
3663
3664 if attacker_id ~= entity.get_local_player() then
3665 return
3666 end
3667
3668 local hitgroup_names = { "body", "head", "chest", "stomach", "left arm", "right arm", "left leg", "right leg", "neck", "?", "gear" }
3669 local group = hitgroup_names[e.hitgroup + 1] or "?"
3670 local target_id = client.userid_to_entindex(e.userid)
3671 local target_name = entity.get_player_name(target_id)
3672
3673 local message = "hit " .. string.lower(target_name) .. "'s " .. group .. " for " .. e.dmg_health .. " damage (" .. e.health .. " remaining)"
3674 if e.health <= 0 then
3675 message = message .. " *dead*"
3676 end
3677
3678-- Advanced Grenade ESP
3679
3680local grenade_timer_reference = ui.new_multiselect("VISUALS", "Other ESP", "Grenades: Timer ", "Text", "Bar")
3681local smoke_radius_reference = ui.new_checkbox("VISUALS", "Other ESP", "Grenades: Smoke radius")
3682local smoke_radius_color_reference = ui.new_color_picker("VISUALS", "Other ESP", "Grenades: Smoke radius", 61, 147, 250, 180)
3683local molotov_radius_reference = ui.new_checkbox("VISUALS", "Other ESP", "Grenades: Molotov radius")
3684local molotov_radius_color_reference = ui.new_color_picker("VISUALS", "Other ESP", "Grenades: Molotov radius", 255, 63, 63, 190)
3685local molotov_team_reference = ui.new_checkbox("VISUALS", "Other ESP", "Grenades: Molotov team")
3686
3687local legacy_timer_reference = ui.new_checkbox("VISUALS", "Other ESP", "Grenades: Timer")
3688local function on_legacy_timer_changed()
3689 if ui_get(legacy_timer_reference) and #ui_get(grenade_timer_reference) == 0 then
3690 ui_set(grenade_timer_reference, {"Text"})
3691 ui_set(legacy_timer_reference, false)
3692 end
3693end
3694ui.set_callback(legacy_timer_reference, on_legacy_timer_changed)
3695ui.set_visible(legacy_timer_reference, false)
3696
3697--I hate having to do this
3698local smoke_radius_units = 125
3699local smoke_duration = 17.55
3700local molotov_duration = 7
3701
3702local molotovs = {}
3703local molotovs_temp = {}
3704local molotovs_created_at = {}
3705local molotovs_cells = {}
3706
3707local bar_enabled = true
3708local bar_width = 26
3709
3710local MOVETYPE_NOCLIP = 8
3711
3712local function distance(x1, y1, x2, y2)
3713 return math_sqrt((x2-x1)^2 + (y2-y1)^2)
3714end
3715
3716local function contains(tbl, val)
3717 for i=1,#tbl do
3718 if tbl[i] == val then
3719 return true
3720 end
3721 end
3722 return false
3723end
3724
3725local function draw_bar(x, y, w, r, g, b, a, percentage, ltr, rev, outline)
3726 local ltr = ltr == nil and true or ltr
3727 local rev = rev == nil and false or rev
3728 local outline = outline == nil and true or outline
3729
3730 local h = 4
3731
3732 if not (outline and (w > 2 and h > 2) or (w > 0 or h > 0)) then
3733 error("Invalid arguments. Width and/or height too small")
3734 end
3735
3736 local percentage = math_max(0, math_min(1, percentage))
3737
3738 local x_inner, y_inner = x, y
3739 local w_inner, h_inner = w, h
3740 local x_inner_add, y_inner_add = 0, 0
3741
3742 --outline makes inner rectangle smaller
3743 if outline then
3744 w_inner, h_inner = w_inner-2, h_inner-2
3745 x_inner, y_inner = x_inner+1, y_inner+1
3746 end
3747
3748 local w_inner_prev = w_inner
3749 w_inner, h_inner = math_ceil(w_inner * percentage), h_inner
3750
3751 --handle reverse bar
3752 if rev then
3753 x_inner_add = (w_inner_prev - w_inner)
3754 end
3755
3756 --flip width and height if we're dealing with a vertical bar
3757 if not ltr then
3758 w, h = h, w
3759 w_inner, h_inner = h_inner, w_inner
3760 x_inner_add, y_inner_add = y_inner_add, x_inner_add
3761 end
3762
3763 local outline_r, outline_b, outline_g, outline_a = 16, 16, 16, 170
3764 if outline then
3765 renderer_rectangle(x, y, w, h, outline_r, outline_b, outline_g, outline_a)
3766 end
3767
3768 renderer_rectangle(x_inner+x_inner_add, y_inner+y_inner_add, w_inner, h_inner, r, g, b, a)
3769
3770 return x_inner+x_inner_add, y_inner+y_inner_add, w_inner, h_inner
3771end
3772
3773local function is_player(entindex)
3774 return entity_get_classname(entindex) == "CCSPlayer"
3775end
3776
3777local function lerp_pos(x1, y1, z1, x2, y2, z2, percentage)
3778 local x = (x2 - x1) * percentage + x1
3779 local y = (y2 - y1) * percentage + y1
3780 local z = (z2 - z1) * percentage + z1
3781 return x, y, z
3782end
3783
3784local function distance3d(x1, y1, z1, x2, y2, z2)
3785 return math_sqrt((x2-x1)^2 + (y2-y1)^2 + (z2-z1)^2)
3786end
3787
3788local function trace_line_skip(skip_function, x1, y1, z1, x2, y2, z2, max_traces)
3789 local max_traces = max_traces or 10
3790 local fraction, entindex_hit = 0, -1
3791 local x_hit, y_hit, z_hit = x1, y1, z1
3792 local skip_entindex = -1
3793
3794 local i=1
3795 while (entindex_hit == -1 or (entindex_hit ~= 0 and skip_function(entindex_hit))) and 1 > fraction and max_traces >= i do
3796 fraction, entindex_hit = client_trace_line(entindex_hit, x_hit, y_hit, z_hit, x2, y2, z2)
3797 x_hit, y_hit, z_hit = lerp_pos(x_hit, y_hit, z_hit, x2, y2, z2, fraction)
3798
3799 i = i + 1
3800 end
3801
3802 local traveled_total = distance3d(x1, y1, z1, x_hit, y_hit, z_hit)
3803 local total_distance = distance3d(x1, y1, z1, x2, y2, z2)
3804
3805 return traveled_total/total_distance, entindex_hit
3806end
3807
3808local function draw_ground_circle_3d(x, y, z, radius, r, g, b, a, accuracy, width, outline, start_degrees, percentage)
3809 local accuracy = accuracy ~= nil and accuracy or 3
3810 local width = width ~= nil and width or 1
3811 local outline = outline ~= nil and outline or false
3812 local start_degrees = start_degrees ~= nil and start_degrees or 0
3813 local percentage = percentage ~= nil and percentage or 1
3814
3815 local screen_x_line_old, screen_y_line_old
3816 for rot=start_degrees, percentage*360, accuracy do
3817 local rot_temp = math_rad(rot)
3818 local lineX, lineY, lineZ = radius * math_cos(rot_temp) + x, radius * math_sin(rot_temp) + y, z
3819
3820 local distance = 256
3821
3822 --local screen_x_line, screen_y_line = renderer_world_to_screen(lineX, lineY, lineZ+distance/2)
3823 --renderer.text(screen_x_line, screen_y_line-5, 255, 255, 255, 255, "c-", 0, "START")
3824 --local screen_x_line, screen_y_line = renderer_world_to_screen(lineX, lineY, lineZ-distance/2)
3825 --renderer.text(screen_x_line, screen_y_line-5, 255, 255, 255, 255, "c-", 0, "END")
3826
3827 local fraction, entindex_hit = client_trace_line(-1, lineX, lineY, lineZ+distance/2, lineX, lineY, lineZ-distance/2)
3828 if fraction > 0 and 1 > fraction then
3829 lineZ = lineZ+distance/2-(distance * fraction)
3830 end
3831
3832 local screen_x_line, screen_y_line = renderer_world_to_screen(lineX, lineY, lineZ)
3833 --renderer.text(screen_x_line, screen_y_line-5, 255, 255, 255, 255, "c-", 0, fraction)
3834 if screen_x_line ~=nil and screen_x_line_old ~= nil then
3835 for i=1, width do
3836 local i=i-1
3837 renderer_line(screen_x_line, screen_y_line-i, screen_x_line_old, screen_y_line_old-i, r, g, b, a)
3838 end
3839 if outline then
3840 local outline_a = a/255*160
3841 renderer_line(screen_x_line, screen_y_line-width, screen_x_line_old, screen_y_line_old-width, 16, 16, 16, outline_a)
3842 renderer_line(screen_x_line, screen_y_line+1, screen_x_line_old, screen_y_line_old+1, 16, 16, 16, outline_a)
3843 end
3844 end
3845 screen_x_line_old, screen_y_line_old = screen_x_line, screen_y_line
3846 end
3847end
3848
3849local function draw_circle_3d(x, y, z, radius, r, g, b, a, accuracy, width, outline, start_degrees, percentage)
3850 local accuracy = accuracy ~= nil and accuracy or 3
3851 local width = width ~= nil and width or 1
3852 local outline = outline ~= nil and outline or false
3853 local start_degrees = start_degrees ~= nil and start_degrees or 0
3854 local percentage = percentage ~= nil and percentage or 1
3855
3856 local screen_x_line_old, screen_y_line_old
3857 for rot=start_degrees, percentage*360, accuracy do
3858 local rot_temp = math_rad(rot)
3859 local lineX, lineY, lineZ = radius * math_cos(rot_temp) + x, radius * math_sin(rot_temp) + y, z
3860 local screen_x_line, screen_y_line = renderer_world_to_screen(lineX, lineY, lineZ)
3861 if screen_x_line ~=nil and screen_x_line_old ~= nil then
3862 for i=1, width do
3863 local i=i-1
3864 renderer_line(screen_x_line, screen_y_line-i, screen_x_line_old, screen_y_line_old-i, r, g, b, a)
3865 end
3866 if outline then
3867 local outline_a = a/255*160
3868 renderer_line(screen_x_line, screen_y_line-width, screen_x_line_old, screen_y_line_old-width, 16, 16, 16, outline_a)
3869 renderer_line(screen_x_line, screen_y_line+1, screen_x_line_old, screen_y_line_old+1, 16, 16, 16, outline_a)
3870 end
3871 end
3872 screen_x_line_old, screen_y_line_old = screen_x_line, screen_y_line
3873 end
3874end
3875
3876local function lerp(a, b, percentage)
3877 return b + (b - a) * percentage
3878end
3879
3880local function lerp_pos(x1, y1, z1, x2, y2, z2, percentage)
3881 local x = (x2 - x1) * percentage + x1
3882 local y = (y2 - y1) * percentage + y1
3883 local z = (z2 - z1) * percentage + z1
3884 return x, y, z
3885end
3886
3887local function is_molotov_burning(molotov)
3888 local fire_count = entity_get_prop(molotov, "m_fireCount")
3889 return fire_count ~= nil and fire_count > 0
3890
3891 --for i=1, 64 do
3892 -- if entity_get_prop(molotov, "m_bFireIsBurning", i) == 1 then
3893 -- return true
3894 -- end
3895 --end
3896 --return false
3897end
3898
3899local function on_player_connect_full(e)
3900 if client_userid_to_entindex(e.userid) == entity_get_local_player() then
3901 molotovs = {}
3902 molotovs_temp = {}
3903 end
3904end
3905client.set_event_callback("player_connect_full", on_player_connect_full)
3906
3907local function on_run_command(e)
3908 if not ui_get(molotov_radius_reference) then
3909 return
3910 end
3911
3912 --reset everything, get molotovs
3913 molotovs_temp = {}
3914 molotovs_cells = {}
3915 molotovs = entity_get_all("CInferno")
3916
3917 if #molotovs == 0 then
3918 return
3919 end
3920
3921 local curtime = globals_curtime()
3922
3923 for i=1, #molotovs do
3924 local molotov = molotovs[i]
3925 if is_molotov_burning(molotov) then
3926 local origin_x, origin_y, origin_z = entity_get_prop(molotov, "m_vecOrigin")
3927
3928 local cell_radius = 40
3929 local molotov_radius = 0
3930 local center_x, center_y, center_z
3931
3932 local cells = {}
3933 local cells_checked = {}
3934 local highest_distance = 0
3935 local cell_max_1, cell_max_2
3936
3937 --accumulate burning cells
3938 for i=1, 64 do
3939 if entity_get_prop(molotov, "m_bFireIsBurning", i) == 1 then
3940 local x_delta = entity_get_prop(molotov, "m_fireXDelta", i)
3941 local y_delta = entity_get_prop(molotov, "m_fireYDelta", i)
3942 local z_delta = entity_get_prop(molotov, "m_fireZDelta", i)
3943 table_insert(cells, {x_delta, y_delta, z_delta})
3944 end
3945 end
3946
3947 for i=1, #cells do
3948 local cell = cells[i]
3949 local x_delta, y_delta, z_delta = unpack(cell)
3950
3951 for i2=1, #cells do
3952 local cell2 = cells[i2]
3953 local distance = distance(x_delta, y_delta, cell2[1], cell2[2])
3954 if distance > highest_distance then
3955 highest_distance = distance
3956 cell_max_1 = cell
3957 cell_max_2 = cell2
3958 end
3959 end
3960 end
3961
3962 if cell_max_1 ~= nil and cell_max_2 ~= nil then
3963 local x1, y1, z1 = origin_x+cell_max_1[1], origin_y+cell_max_1[2], origin_z+cell_max_1[3]
3964 local x2, y2, z2 = origin_x+cell_max_2[1], origin_y+cell_max_2[2], origin_z+cell_max_2[3]
3965
3966 local center_x_delta, center_y_delta, center_z_delta = lerp_pos(cell_max_1[1], cell_max_1[2], cell_max_1[3], cell_max_2[1], cell_max_2[2], cell_max_2[3], 0.5)
3967 local center_x, center_y, center_z = origin_x+center_x_delta, origin_y+center_y_delta, origin_z+center_z_delta
3968
3969 local radius = highest_distance/2+cell_radius
3970
3971 molotovs_temp[molotov] = {center_x, center_y, center_z, radius}
3972 molotovs_cells[molotov] = cells
3973 end
3974 end
3975 end
3976end
3977client.set_event_callback("run_command", on_run_command)
3978
3979
3980local function on_paint()
3981 local smoke_radius = ui_get(smoke_radius_reference)
3982 local grenade_timer_value = ui_get(grenade_timer_reference)
3983 local grenade_timer = #grenade_timer_value > 0
3984 local molotov_team = ui_get(molotov_team_reference)
3985 local molotov_radius = ui_get(molotov_radius_reference)
3986
3987 local local_player = entity_get_local_player()
3988
3989 --make everything work while we're dead, dont really need to care about performance
3990 if local_player == nil or not entity_is_alive(local_player) or entity_get_prop(local_player, "m_MoveType") == MOVETYPE_NOCLIP then
3991 on_run_command()
3992 end
3993
3994 if molotov_radius then
3995 local r, g, b, a = ui_get(molotov_radius_color_reference)
3996
3997 for i=1, #molotovs do
3998 local molotov = molotovs[i]
3999 if molotovs_temp[molotov] ~= nil then
4000 local center_x, center_y, center_z, radius = unpack(molotovs_temp[molotov])
4001 local a_multiplier = 1
4002
4003 if molotovs_created_at[grenade] ~= nil then
4004 local time_since_created = curtime - molotovs_created_at[grenade]
4005 a_multiplier = math_max(0, 1 - time_since_created / molotov_duration)
4006 end
4007 draw_circle_3d(center_x, center_y, center_z, radius, r, g, b, a*a_multiplier, 9, 1, true)
4008 end
4009 end
4010 end
4011
4012 if smoke_radius or grenade_timer or molotov_team then
4013 local grenades = entity_get_all("CSmokeGrenadeProjectile")
4014 local tickcount = globals_tickcount()
4015 local tickinterval = globals_tickinterval()
4016 local curtime = globals_curtime()
4017
4018 if grenade_timer or molotov_team then
4019 local molotovs_created_at_prev = molotovs_created_at
4020 molotovs_created_at = {}
4021 for i=1, #molotovs do
4022 local molotov = molotovs[i]
4023 if is_molotov_burning(molotov) then
4024 molotovs_created_at[molotov] = molotovs_created_at_prev[molotov] ~= nil and molotovs_created_at_prev[molotov] or curtime
4025 table_insert(grenades, molotov)
4026 end
4027 end
4028 end
4029
4030 for i=1, #grenades do
4031 local grenade = grenades[i]
4032 local class_name = entity_get_classname(grenade)
4033
4034 local text, wx, wy
4035 local percentage = 1
4036 if class_name == "CSmokeGrenadeProjectile" then
4037 local x, y, z = entity_get_prop(grenade, "m_vecOrigin")
4038 wx, wy = renderer_world_to_screen(x, y, z)
4039 local did_smoke_effect = entity_get_prop(grenade, "m_bDidSmokeEffect") == 1
4040 if wx ~= nil then
4041
4042 if did_smoke_effect then
4043 local ticks_created = entity_get_prop(grenade, "m_nSmokeEffectTickBegin")
4044 if ticks_created ~= nil then
4045 local time_since_explosion = tickinterval * (tickcount - ticks_created)
4046 if time_since_explosion > 0 and smoke_duration-time_since_explosion > 0 then
4047 if grenade_timer then
4048 percentage = 1 - time_since_explosion / smoke_duration
4049 text = string_format("%.1f", smoke_duration-time_since_explosion)
4050 end
4051 if smoke_radius then
4052 local r, g, b, a = ui_get(smoke_radius_color_reference)
4053 local radius = smoke_radius_units
4054 if 0.3 > time_since_explosion then
4055 radius = radius * 0.6 + (radius * (time_since_explosion / 0.3))*0.4
4056 a = a * (time_since_explosion / 0.3)
4057 end
4058 if 1.0 > smoke_duration-time_since_explosion then
4059 radius = radius * (((smoke_duration-time_since_explosion) / 1.0)*0.3 + 0.7)
4060 end
4061 draw_circle_3d(x, y, z, radius, r, g, b, a*math_min(1, percentage*1.3), 9, 1, true)
4062 end
4063 end
4064 end
4065 end
4066 end
4067 elseif class_name == "CInferno" then
4068 if grenade_timer or molotov_team then
4069 local x, y, z = entity_get_prop(grenade, "m_vecOrigin")
4070 wx, wy = renderer_world_to_screen(x, y, z)
4071 if wx ~= nil then
4072 if grenade_timer then
4073 if molotovs_created_at[grenade] ~= nil then
4074
4075 local time_since_created = curtime - molotovs_created_at[grenade]
4076 percentage = math_max(0, 1 - time_since_created / molotov_duration)
4077 text = string_format("%.1f", math_max(0, molotov_duration - time_since_created))
4078 end
4079 end
4080 if molotov_team then
4081 local thrower = entity_get_prop(grenade, "m_hOwnerEntity")
4082 local is_safe = false
4083 if thrower ~= nil and tonumber(client_get_cvar("mp_friendlyfire")) == 0 and thrower ~= local_player and not entity_is_enemy(thrower) then
4084 is_safe = true
4085 end
4086 if is_safe then
4087 renderer_text(wx-19, wy+5, 149, 184, 6, 255*percentage, nil, 0, "✔")
4088 else
4089 renderer_text(wx-19, wy+4, 230, 21, 21, 255*percentage, nil, 0, "❌")
4090 end
4091 end
4092 end
4093 end
4094 end
4095 if wx ~= nil and text ~= nil then
4096 --(x, y, w, r, g, b, a, percentage, ltr, rev, outline)
4097 local a = 255
4098 if 0.08 > percentage then
4099 a = a * percentage/0.08
4100 end
4101 if contains(grenade_timer_value, "Bar") then
4102 local y_additional = (contains(grenade_timer_value, "Bar") and contains(grenade_timer_value, "Text")) and 1 or 0
4103 local x_text, _, w_text, _ = draw_bar(wx-bar_width/2+1, wy+16+y_additional, bar_width, 255, 255, 255, a, percentage, true)
4104 if contains(grenade_timer_value, "Text") and 0.56 > percentage then
4105 renderer_text(x_text+w_text+5, wy+18+y_additional, 255, 255, 255, a*0.7, "c-", 150, text)
4106 end
4107 elseif contains(grenade_timer_value, "Text") then
4108 renderer_text(wx, wy+20, 255, 255, 255, math_max(30, percentage * 255), "c-", 150, text, " S")
4109 end
4110 end
4111 end
4112 end
4113end
4114client.set_event_callback("paint", on_paint)
4115
4116-- Extra Indicators
4117
4118---
4119--- Title: Indicators
4120--- Author: april#0001
4121--- Description: Better indicators
4122---
4123
4124--region main
4125
4126local color_indexes = {"r", "g", "b", "a"};
4127
4128--endregion
4129
4130--region menu
4131
4132local enable = ui.new_checkbox("LUA", "B", "Enable indicators")
4133
4134local dormant_text = ui.new_label("LUA", "B", "Dormant color");
4135local dormant = ui.new_color_picker("LUA", "B", "Dormant color", 235, 185, 255, 200);
4136local active_text = ui.new_label("LUA", "B", "Active color");
4137local active = ui.new_color_picker("LUA", "B", "Active color", 65,229,137, 200);
4138
4139--endregion
4140
4141--region dependencies
4142
4143function clamp(v, min, max)
4144 return math.max(math.min(v, max), min)
4145end
4146
4147--region depencendy: noble_color
4148
4149---@class col_t
4150local col_t = {};
4151local col_t_mt = {
4152 __index = col_t,
4153 __eq = function(col1, col2)
4154 return (col1.r == col2.r) and (col1.g == col2.g) and (col1.b == col2.b) and (col1.a == col2.a);
4155 end
4156}
4157
4158--- Creates a new color instance
4159--- @param r number
4160--- @param g number
4161--- @param b number
4162--- @param a number
4163--- @return table
4164function col_t.new(r, g, b, a)
4165
4166 r = r or 255;
4167 g = g or 255;
4168 b = b or 255;
4169 a = a or 255;
4170
4171 local props = {
4172 r = r,
4173 g = g,
4174 b = b,
4175 a = a,
4176
4177 anim = {
4178 status = false,
4179 time = 0
4180 }
4181 };
4182
4183 local meta = setmetatable(props, col_t_mt);
4184
4185 return meta;
4186end
4187
4188--- Unpacks our color into an table
4189--- @return table
4190function col_t:unpack()
4191 return {self.r, self.g, self.b, self.a};
4192end
4193
4194--- Updates the color values of a color instance
4195--- @param color string
4196--- @param value number
4197function col_t:update(color, value)
4198 self[color] = value;
4199end
4200
4201--- Setups a color to be animated
4202--- @param status boolean
4203--- @param duration number
4204function col_t:setup_animation(status, duration)
4205 self.anim.time = duration;
4206 self.anim.status = status;
4207end
4208
4209function col_t:breathe()
4210
4211 -- Gets our increments based on the animation time
4212 local increment = ((1 / self.anim.time) * globals.frametime()) * 255
4213
4214 if (self.a ~= 0 and not self.anim.status) then
4215 self:update("a", clamp(self.a - increment, 0, 255))
4216 end
4217
4218 if (self.a ~= 255 and self.anim.status) then
4219 self:update("a", clamp(self.a + increment, 0, 255))
4220 end
4221
4222 if (self.a == 0) then
4223 self.anim.status = true
4224 end
4225
4226 if (self.a == 255) then
4227 self.anim.status = false
4228 end
4229
4230end
4231
4232function col_t:shift(initial, final)
4233 -- Gets our increments based on the animation time
4234 local increment = ((1 / self.anim.time) * globals.frametime()) * 255;
4235
4236 local desired = self.anim.status and final or initial;
4237
4238 if (self == desired) then
4239 return
4240 end
4241
4242 for i=1, #color_indexes do
4243 local current = color_indexes[i];
4244
4245 if (self[current] > desired[current]) then
4246 self[current] = clamp(self[current] - increment, desired[current], 255);
4247 end
4248
4249 if (self[current] < desired[current]) then
4250 self[current] = clamp(self[current] + increment, 0, desired[current]);
4251 end
4252 end
4253
4254end
4255
4256--endregion
4257
4258--region functions
4259
4260local indicators = {};
4261
4262local colors = {
4263 doubletap = col_t.new(169,200,246, 200),
4264 onshot = col_t.new(ui.get(dormant)),
4265 safe = col_t.new(ui.get(dormant)),
4266 duck = col_t.new(169,200,246, 200),
4267 fb = col_t.new(169,200,246, 200),
4268 fs = col_t.new(169,200,246, 200)
4269};
4270
4271local dt, dt_key = ui.reference("RAGE", "Other", "Double tap");
4272local sp = ui.reference("RAGE", "Aimbot", "Force safe point");
4273local os, os_key = ui.reference("AA", "Other", "On shot anti-aim");
4274local duck = ui.reference("RAGE", "Other", "Duck peek assist");
4275local fb = ui.reference("RAGE", "Other", "Force body aim");
4276local fs, fs_key = ui.reference("AA", "Anti-aimbot angles", "Freestanding");
4277
4278function indicators.update_colors()
4279 -- Get our main colors
4280 local dormant = col_t.new(ui.get(dormant));
4281 local active = col_t.new(ui.get(active));
4282
4283 -- Double tap color
4284 colors.fb:setup_animation(
4285 ui.get(fb),
4286 0.35
4287 )
4288
4289 -- On shot anti-aim color
4290 colors.onshot:setup_animation(
4291 ui.get(os_key),
4292 1
4293 )
4294
4295 --freestanding color
4296 colors.fs:setup_animation(
4297 ui.get(fs_key),
4298 1
4299 )
4300
4301 -- Safe point color
4302 colors.safe:setup_animation(
4303 ui.get(sp),
4304 1
4305 )
4306
4307 colors.duck:setup_animation(
4308 colors.duck.anim.status,
4309 2
4310 )
4311
4312
4313 -- Animate on shot anti-aim
4314 colors.onshot:breathe();
4315
4316 -- Animate safe point
4317 colors.safe:breathe();
4318
4319 -- Animate fake duck
4320 colors.duck:breathe();
4321end
4322
4323function indicators.draw()
4324
4325 local x, y = client.screen_size();
4326
4327 if (ui.get(os_key)) then
4328 renderer.text(
4329 x / 2,
4330 y - 500,
4331 colors.fb.r,
4332 colors.fb.g,
4333 colors.fb.b,
4334 colors.fb.a,
4335 "cb",
4336 0,
4337 "HIDE SHOTS (ONSHOT AA) ON"
4338 );
4339 end
4340
4341 if (ui.get(fb)) then
4342 renderer.text(
4343 x / 2,
4344 y - 490,
4345 colors.fb.r,
4346 colors.fb.g,
4347 colors.fb.b,
4348 colors.fb.a,
4349 "cb",
4350 0,
4351 "FORCE BAIM ON"
4352 );
4353end
4354 if (ui.get(sp)) then
4355 renderer.text(
4356 x / 2,
4357 y - 480,
4358 colors.safe.r,
4359 colors.safe.g,
4360 colors.safe.b,
4361 colors.safe.a,
4362 "cb",
4363 0,
4364 "FORCE SAFEPOINT ON"
4365 );
4366end
4367
4368 if (ui.get(duck)) then
4369 renderer.text(
4370 x / 2,
4371 y - 470,
4372 colors.duck.r,
4373 colors.duck.g,
4374 colors.duck.b,
4375 colors.duck.a,
4376 "cb",
4377 0,
4378 "FAKEDUCK"
4379 );
4380 end
4381
4382 if (ui.get(fs_key)) then
4383 renderer.text(
4384 x / 2,
4385 y - 460,
4386 colors.fs.r,
4387 colors.fs.g,
4388 colors.fs.b,
4389 colors.fs.a,
4390 "cb",
4391 0,
4392 "FREESTANDING ON"
4393 );
4394 end
4395
4396end
4397
4398
4399local function handle_visibility()
4400 local enabled = ui.get(enable);
4401
4402 ui.set_visible(dormant_text, enabled)
4403 ui.set_visible(dormant, enabled)
4404 ui.set_visible(active_text, enabled)
4405 ui.set_visible(active, enabled)
4406end
4407
4408handle_visibility();
4409--endregion
4410
4411client.set_event_callback("paint", function()
4412
4413 handle_visibility();
4414
4415 if (not ui.get(enable)) then
4416 return
4417 end
4418
4419 indicators.update_colors();
4420 indicators.draw();
4421
4422end
4423)
4424
4425--endregion
4426
4427-- Quick Nade
4428local globals_tickcount = globals.tickcount
4429local globals_tickinterval = globals.tickinterval
4430local entity_get_prop = entity.get_prop
4431local client_exec = client.exec
4432local client_userid_to_entindex = client.userid_to_entindex
4433local entity_get_local_player = entity.get_local_player
4434local ui_get = ui.get
4435
4436local switch_to_flash_at = nil
4437local next_command_at = nil
4438local grenade_enable_reference = ui.new_checkbox("MISC", "Miscellaneous", "Fast Grenade")
4439
4440local function on_paint(ctx)
4441 local tickcount = globals_tickcount()
4442 if switch_to_flash_at ~= nil then
4443 if tickcount > next_command_at then
4444 next_command_at = tickcount+1
4445 client_exec("use weapon_flashbang")
4446 if switch_to_flash_at < tickcount then
4447 switch_to_flash_at = nil
4448 end
4449 end
4450 end
4451end
4452
4453local function on_item_equip(e)
4454 local userid, item = e.userid, e.item
4455 if userid == nil then
4456 return
4457 end
4458 local entindex = client_userid_to_entindex(userid)
4459 if entindex == entity_get_local_player() then
4460 if item == "flashbang" then
4461 switch_to_flash_at = nil
4462 next_command_at = nil
4463 end
4464 end
4465end
4466
4467local function on_grenade_thrown(e)
4468 if not ui_get(grenade_enable_reference) then
4469 return
4470 end
4471
4472 userid, grenade = e.userid, e.weapon
4473 if client_userid_to_entindex(userid) == entity_get_local_player() then
4474 if grenade == "flashbang" then
4475 client_exec("slot3;")
4476 switch_to_flash_at = globals_tickcount() + 15
4477 next_command_at = globals_tickcount()
4478 else
4479 client_exec("slot3; slot2; slot1")
4480 end
4481 end
4482end
4483
4484client.set_event_callback("paint", on_paint)
4485client.set_event_callback("grenade_thrown", on_grenade_thrown)
4486client.set_event_callback("item_equip", on_item_equip)
4487
4488-- 3D Hitmarkers
4489
4490local log = client.log
4491local floor = math.floor
4492local table_insert = table.insert
4493local uid_to_entindex = client.userid_to_entindex
4494local entity_get_prop = entity.get_prop
4495local get_all_players = entity.get_players
4496local get_localplayer = entity.get_local_player
4497
4498local bullet_impact = { }
4499local hitmarker_queue = { }
4500local getUI = ui.get
4501local setUI = ui.set
4502
4503local customhitmarker = ui.new_checkbox("VISUALS", "Player ESP", "3D Hitmarker")
4504local color = ui.new_color_picker("VISUALS", "Player ESP", "Hitmarker Color",255,255,255)
4505local hitmarkersize = ui.new_slider("VISUALS", "Player ESP", "3D Hitmarker Size", 1, 15)
4506local fadeout = ui.new_checkbox("VISUALS", "Player ESP", "Fade Out")
4507local hitmarkerduration = ui.new_slider("VISUALS", "Player ESP", "Duration", 1, 5)
4508
4509setUI(hitmarkersize, 4)
4510setUI(fadeout, true)
4511setUI(hitmarkerduration, 3)
4512
4513local function on_bullet_impact(e)
4514 local attacker_uid = e.userid
4515 local attacker_entid = uid_to_entindex(attacker_uid)
4516
4517 if attacker_entid == get_localplayer() then
4518 local originX = e.x
4519 local originY = e.y
4520 local originZ = e.z
4521
4522 table_insert(bullet_impact, {originX, originY, originZ , globals.realtime()})
4523 end
4524end
4525
4526local function vectordistance(x1,y1,z1,x2,y2,z2)
4527 return math.sqrt(math.pow(x1 - x2, 2) + math.pow( y1 - y2, 2) + math.pow( z1 - z2 , 2) )
4528end
4529
4530local function on_player_hurt(e)
4531 local attacker_uid = e.attacker
4532 local attacker_entid = uid_to_entindex(attacker_uid)
4533 local victim_uid = e.userid
4534 local victim_entid = uid_to_entindex(victim_uid)
4535 local bestdistance = 100
4536 local bestX,bestY,bestZ = 0,0,0
4537 local duration = getUI(hitmarkerduration)
4538 if attacker_entid == get_localplayer() then
4539 local realtime = floor(globals.realtime())
4540 local victimX, victimY, victimZ = entity_get_prop(victim_entid, "m_vecOrigin")
4541
4542 for i = 1,#bullet_impact,1 do
4543 if bullet_impact[i][4] + duration >= floor(realtime) then
4544 local originX = bullet_impact[i][1]
4545 local originY = bullet_impact[i][2]
4546 local originZ = bullet_impact[i][3]
4547
4548 local distance = vectordistance(victimX,victimY,victimZ,originX,originY,originZ)
4549 if distance < bestdistance then
4550 bestdistance = distance
4551 bestX = originX
4552 bestY = originY
4553 bestZ = originZ
4554 end
4555 end
4556 end
4557 if bestX == 0 and bestY == 0 and bestZ == 0 then
4558 victimZ = victimZ + 50
4559 bestX = victimX
4560 bestY = victimY
4561 bestZ = victimZ
4562 end
4563 for i = 1,#bullet_impact,1 do
4564 bullet_impact[i] = { 0 , 0 , 0 , 0 }
4565 end
4566 table_insert(hitmarker_queue, {bestX, bestY, bestZ , globals.realtime()})
4567 end
4568end
4569
4570local function on_paint(context)
4571 if getUI(customhitmarker) then
4572 local realtime = globals.realtime()
4573 local duration = getUI(hitmarkerduration)
4574 local max_time_delta = getUI(hitmarkerduration) / 2
4575 local maxtime = realtime - max_time_delta / 2
4576 for i = 1,#hitmarker_queue,1 do
4577 if hitmarker_queue[i][4] + duration > maxtime then
4578 if hitmarker_queue[i][1] ~= nil then
4579 local x, y = client.world_to_screen(context, hitmarker_queue[i][1], hitmarker_queue[i][2], hitmarker_queue[i][3])
4580
4581 if x ~= nil and y ~= nil then
4582 local size = getUI(hitmarkersize)
4583 r, g, b, a = getUI(color)
4584 a = 255
4585 if getUI(fadeout) then
4586 if (hitmarker_queue[i][4] - (realtime - duration)) < (duration / 2) then
4587 a = (hitmarker_queue[i][4] - (realtime - duration)) / (duration / 2) * 255
4588 if a < 5 then
4589 hitmarker_queue[i] = { 0 , 0 , 0 , 0 }
4590 end
4591 end
4592 end
4593 client.draw_line(context, x - size * 2, y - size * 2, x - ( size ), y - ( size ), r, g, b, a)
4594 client.draw_line(context, x - size * 2, y + size * 2, x - ( size ), y + ( size ), r, g, b, a)
4595 client.draw_line(context, x + size * 2, y + size * 2, x + ( size ), y + ( size ), r, g, b, a)
4596 client.draw_line(context, x + size * 2, y - size * 2, x + ( size ), y - ( size ), r, g, b, a)
4597 end
4598 end
4599 end
4600 end
4601 end
4602end
4603
4604local function on_round_prestart(e)
4605 for i = 1,#bullet_impact,1 do
4606 bullet_impact[i] = { 0 , 0 , 0 , 0 }
4607 end
4608 for i = 1,#hitmarker_queue,1 do
4609 hitmarker_queue[i] = { 0 , 0 , 0 , 0 }
4610 end
4611end
4612
4613local function on_round_start(e)
4614 for i = 1,#bullet_impact,1 do
4615 bullet_impact[i] = { 0 , 0 , 0 , 0 }
4616 end
4617 for i = 1,#hitmarker_queue,1 do
4618 hitmarker_queue[i] = { 0 , 0 , 0 , 0 }
4619 end
4620end
4621
4622local function on_player_spawned(e)
4623 local userid = e.userid
4624 local entid = uid_to_entindex(userid)
4625 if entid == get_localplayer() then
4626 for i = 1,#bullet_impact,1 do
4627 bullet_impact[i] = { 0 , 0 , 0 , 0 }
4628 end
4629 for i = 1,#hitmarker_queue,1 do
4630 hitmarker_queue[i] = { 0 , 0 , 0 , 0 }
4631 end
4632 end
4633end
4634
4635local err = client.set_event_callback("bullet_impact", on_bullet_impact) or client.set_event_callback("round_start", on_round_start) or client.set_event_callback("player_spawned", on_player_spawned) or client.set_event_callback("round_prestart", on_round_prestart) or client.set_event_callback('player_hurt', on_player_hurt) or client.set_event_callback('paint', on_paint)
4636
4637if err then
4638 client.log("set_event_callback failed: ", err)
4639end
4640
4641-- Havoc Announcer
4642
4643--- Havoc Announcer v1.5.1
4644---
4645--- Copyright (c) 2018 Kessie Heldieheren
4646---
4647--- Permission is hereby granted, free of charge, to any person obtaining a copy of this software
4648--- and associated documentation files (the "Software"), to deal in the Software without restriction,
4649--- including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
4650--- and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
4651--- subject to the following conditions:
4652---
4653--- The above copyright notice and this permission notice shall be included
4654--- in all copies or substantial portions of the Software.
4655---
4656--- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
4657--- INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4658--- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
4659--- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
4660--- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
4661--- ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4662---
4663--- @author Kessie
4664--- @credits Aviarita
4665--- @credits Sapphyrus
4666--- @version 1.5.1
4667--- @requires havoc-color v1.2.0
4668--- @requires havoc-timer v2.0.0
4669
4670--region setup/config
4671local config_load_success, config = pcall(require, "havoc_announcer_config")
4672
4673if (config_load_success ~= true) then
4674 config = {}
4675end
4676
4677-- Location of sound files.
4678local sounds_path = config.sounds_path or "havoc_announcer/"
4679
4680-- Sound played when the player is killed.
4681local sound_player_death = config.sound_player_death or "player_death.wav"
4682
4683-- Sound played when the player kills an enemy.
4684local sound_enemy_death = config.sound_enemy_death or "enemy_death.wav"
4685
4686-- Sound played upon hitting an enemy.
4687local sound_body_hit = config.sound_body_hit or "enemy_body_hit.wav"
4688
4689-- Sound played when the player gets the first kill of the round.
4690local sound_first_blood = config.sound_first_blood or "first_blood.wav"
4691
4692-- Text to display for first blood kills.
4693local text_first_blood = config.text_first_blood or "FIRST BLOOD!"
4694
4695-- Sound played when the player's kill streak expires.
4696local sound_timed_killstreak_expires = config.sound_timed_killstreak_expires or "killstreak_expired.wav"
4697
4698-- Sounds played and text shown for kill streaks.
4699-- Table index "[number]" denotes what kill an announcement should be made on. The value of the index is the sound file.
4700local announcer_round_kills = config.announcer_round_kills or {
4701 [2] = {"double_kill.wav", "DOUBLE KILL!"},
4702 [4] = {"multi_kill.wav", "MULTI KILL!"},
4703 [6] = {"mega_kill.wav", "MEGA KILL!"},
4704 [8] = {"ultra_kill.wav", "ULTRA KILL!"},
4705 [10] = {"monster_kill.wav", "MONSTER KILL!"},
4706 [12] = {"ludicrous_kill.wav", "LUDICROUS KILL!"},
4707 [14] = {"holy_shit.wav", "HOLY SHIT!"},
4708}
4709
4710-- Sounds played for total game kills.
4711-- Table index "[number]" denotes what kill an announcement should be made on. The value of the index is the sound file.
4712local sound_announcer_game_kills = config.sound_announcer_game_kills or {
4713 [6] = {"killing_spree.wav", "KILLING SPREE!"},
4714 [12] = {"dominating.wav", "DOMINATING!"},
4715 [18] = {"unstoppable.wav", "UNSTOPPABLE!"},
4716 [24] = {"rampage.wav", "RAMPAGE!"},
4717 [30] = {"berzerk.wav", "BERZERK!"},
4718 [36] = {"whicked_sick.wav", "WHICKED SICK!"},
4719 [42] = {"god_like.wav", "GOD-LIKE!"},
4720}
4721
4722-- Location in the Lua tab of the Announcer menu.
4723local script_menu_location = config.script_menu_location or "a"
4724
4725-- Fail check to prevent users setting an invalid UI location.
4726if (script_menu_location ~= "a" and script_menu_location ~= "b") then
4727 script_menu_location = "a"
4728end
4729
4730-- todo
4731local kill_streak_text_format = config.kill_streak_text_format or "%s streak"
4732--endregion
4733
4734--region api
4735-- GameSense Lua API functions.
4736-- https://github.com/simpleavaster/gslua/blob/master/authors/sapphyrus/generate_api.lua
4737local client_latency, client_log, client_draw_rectangle, client_draw_circle_outline, client_userid_to_entindex, client_draw_indicator, client_draw_gradient, client_set_event_callback, client_screen_size, client_eye_position = client.latency, client.log, client.draw_rectangle, client.draw_circle_outline, client.userid_to_entindex, client.draw_indicator, client.draw_gradient, client.set_event_callback, client.screen_size, client.eye_position
4738local client_draw_circle, client_color_log, client_delay_call, client_draw_text, client_visible, client_exec, client_trace_line, client_set_cvar = client.draw_circle, client.color_log, client.delay_call, client.draw_text, client.visible, client.exec, client.trace_line, client.set_cvar
4739local client_world_to_screen, client_draw_hitboxes, client_get_cvar, client_draw_line, client_camera_angles, client_draw_debug_text, client_random_int, client_random_float = client.world_to_screen, client.draw_hitboxes, client.get_cvar, client.draw_line, client.camera_angles, client.draw_debug_text, client.random_int, client.random_float
4740local entity_get_local_player, entity_is_enemy, entity_hitbox_position, entity_get_player_name, entity_get_steam64, entity_get_bounding_box, entity_get_all, entity_set_prop = entity.get_local_player, entity.is_enemy, entity.hitbox_position, entity.get_player_name, entity.get_steam64, entity.get_bounding_box, entity.get_all, entity.set_prop
4741local entity_is_alive, entity_get_player_weapon, entity_get_prop, entity_get_players, entity_get_classname = entity.is_alive, entity.get_player_weapon, entity.get_prop, entity.get_players, entity.get_classname
4742local globals_realtime, globals_absoluteframetime, globals_tickcount, globals_curtime, globals_mapname, globals_tickinterval, globals_framecount, globals_frametime, globals_maxplayers = globals.realtime, globals.absoluteframetime, globals.tickcount, globals.curtime, globals.mapname, globals.tickinterval, globals.framecount, globals.frametime, globals.maxplayers
4743local ui_new_slider, ui_new_combobox, ui_reference, ui_set_visible, ui_is_menu_open, ui_new_color_picker, ui_set_callback, ui_set, ui_new_checkbox, ui_new_hotkey, ui_new_button, ui_new_multiselect, ui_get = ui.new_slider, ui.new_combobox, ui.reference, ui.set_visible, ui.is_menu_open, ui.new_color_picker, ui.set_callback, ui.set, ui.new_checkbox, ui.new_hotkey, ui.new_button, ui.new_multiselect, ui.get
4744local math_ceil, math_tan, math_log10, math_randomseed, math_cos, math_sinh, math_random, math_huge, math_pi, math_max, math_atan2, math_ldexp, math_floor, math_sqrt, math_deg, math_atan, math_fmod = math.ceil, math.tan, math.log10, math.randomseed, math.cos, math.sinh, math.random, math.huge, math.pi, math.max, math.atan2, math.ldexp, math.floor, math.sqrt, math.deg, math.atan, math.fmod
4745local math_acos, math_pow, math_abs, math_min, math_sin, math_frexp, math_log, math_tanh, math_exp, math_modf, math_cosh, math_asin, math_rad = math.acos, math.pow, math.abs, math.min, math.sin, math.frexp, math.log, math.tanh, math.exp, math.modf, math.cosh, math.asin, math.rad
4746local table_maxn, table_foreach, table_sort, table_remove, table_foreachi, table_move, table_getn, table_concat, table_insert = table.maxn, table.foreach, table.sort, table.remove, table.foreachi, table.move, table.getn, table.concat, table.insert
4747--endregion
4748
4749--region dependency: havoc_color
4750-- version 1.2.0
4751
4752--region helpers
4753--- Convert HSL to RGB.
4754---
4755--- Original function by EmmanuelOga:
4756--- https://github.com/EmmanuelOga/columns/blob/master/utils/color.lua
4757---
4758--- @param color Color
4759local function update_rgb_space(color)
4760 local r, g, b
4761
4762 if (color.s == 0) then
4763 r, g, b = color.l, color.l, color.l
4764 else
4765 function hue_to_rgb(p, q, t)
4766 if t < 0 then t = t + 1 end
4767 if t > 1 then t = t - 1 end
4768 if t < 1/6 then return p + (q - p) * 6 * t end
4769 if t < 1/2 then return q end
4770 if t < 2/3 then return p + (q - p) * (2/3 - t) * 6 end
4771
4772 return p
4773 end
4774
4775 local q = 0
4776
4777 if (color.l < 0.5) then
4778 q = color.l * (1 + color.s)
4779 else
4780 q = color.l + color.s - color.l * color.s
4781 end
4782
4783 local p = 2 * color.l - q
4784
4785 r = hue_to_rgb(p, q, color.h + 1/3)
4786 g = hue_to_rgb(p, q, color.h)
4787 b = hue_to_rgb(p, q, color.h - 1/3)
4788 end
4789
4790 color.r = r * 255
4791 color.g = g * 255
4792 color.b = b * 255
4793end
4794
4795--- Convert RGB to HSL.
4796---
4797--- Original function by EmmanuelOga:
4798--- https://github.com/EmmanuelOga/columns/blob/master/utils/color.lua
4799---
4800--- @param color Color
4801local function update_hsl_space(color)
4802 local r, g, b = color.r / 255, color.g / 255, color.b / 255
4803 local max, min = math_max(r, g, b), math_min(r, g, b)
4804 local h, s, l
4805
4806 l = (max + min) / 2
4807
4808 if (max == min) then
4809 h, s = 0, 0
4810 else
4811 local d = max - min
4812
4813 if (l > 0.5) then
4814 s = d / (2 - max - min)
4815 else
4816 s = d / (max + min)
4817 end
4818
4819 if (max == r) then
4820 h = (g - b) / d
4821
4822 if (g < b) then
4823 h = h + 6
4824 end
4825 elseif (max == g) then
4826 h = (b - r) / d + 2
4827 elseif (max == b) then
4828 h = (r - g) / d + 4
4829 end
4830
4831 h = h / 6
4832 end
4833
4834 color.h, color.s, color.l = h, s, l or 255
4835end
4836
4837--- Validate the RGB+A space and clamp errors.
4838---
4839--- @param color Color
4840local function validate_rgba(color)
4841 color.r = math_min(255, math_max(0, color.r))
4842 color.g = math_min(255, math_max(0, color.g))
4843 color.b = math_min(255, math_max(0, color.b))
4844 color.a = math_min(255, math_max(0, color.a))
4845end
4846
4847--- Validate the HSL+A space and clamp errors.
4848---
4849--- @param color Color
4850local function validate_hsla(color)
4851 color.h = math_min(1, math_max(0, color.h))
4852 color.s = math_min(1, math_max(0, color.s))
4853 color.l = math_min(1, math_max(0, color.l))
4854
4855 color.a = math_min(1, math_max(0, color.a))
4856end
4857--endregion
4858
4859--region class.color
4860local Color = {}
4861
4862--- Color metatable.
4863local color_mt = {
4864 __index = Color,
4865 __call = function(tbl, ...) return Color.new_rgba(...) end
4866}
4867
4868--- Create new color object in using the RGB+A space.
4869---
4870--- @param r int
4871--- @param g int
4872--- @param b int
4873--- @param a int
4874--- @return Color
4875function Color.new_rgba(r, g, b, a)
4876 if (a == nil) then
4877 a = 255
4878 end
4879
4880 local object = setmetatable({r = r, g = g, b = b, a = a, h = 0, s = 0, l = 0}, color_mt)
4881
4882 validate_rgba(object)
4883 update_hsl_space(object)
4884
4885 return object
4886end
4887
4888--- Create new color object in using the HSL+A space.
4889---
4890--- @param self Color
4891--- @param h int
4892--- @param s int
4893--- @param l int
4894--- @param a int
4895--- @return Color
4896function Color.new_hsla(h, s, l, a)
4897 if (a == nil) then
4898 a = 255
4899 end
4900
4901 h = h % 1
4902
4903 local object = setmetatable({r = 0, g = 0, b = 0, a = a, h = h, s = s, l = l}, color_mt)
4904
4905 validate_hsla(object)
4906 update_rgb_space(object)
4907
4908 return object
4909end
4910
4911--- Create a color from a UI reference.
4912---
4913--- @param ui_reference ui_reference
4914--- @return Color
4915--- @since 1.1.0-release
4916function Color.new_from_ui_color_picker(ui_reference)
4917 local r, g, b, a = ui_get(ui_reference)
4918
4919 return Color.new_rgba(r, g, b, a)
4920end
4921
4922--- Create a color from another color.
4923---
4924--- @param color Color
4925--- @return Color
4926--- @since 1.2.0-release
4927function Color.new_from_other_color(color)
4928 local r, g, b, a = color:unpack_rgba()
4929
4930 return Color.new_rgba(r, g, b, a)
4931end
4932
4933--- Overwrite current color using RGB+A space.
4934---
4935--- @param self Color
4936--- @param r int
4937--- @param g int
4938--- @param b int
4939--- @param a int
4940function Color.set_rgba(self, r, g, b, a)
4941 if (a == nil) then
4942 a = 255
4943 end
4944
4945 self.r, self.g, self.b, self.a = r, g, b, a
4946
4947 validate_rgba(self)
4948 update_hsl_space(self)
4949end
4950
4951--- Overwrite current color using HSL+A space.
4952---
4953--- @param self Color
4954--- @param h int
4955--- @param s int
4956--- @param l int
4957--- @param a int
4958function Color.set_hsla(self, h, s, l, a)
4959 if (a == nil) then
4960 a = 255
4961 end
4962
4963 h = h % 1
4964
4965 self.h, self.s, self.l, self.a = h, s, l, a
4966
4967 validate_hsla(self)
4968 update_rgb_space(self)
4969end
4970
4971--- Overwrite current color using a UI reference.
4972---
4973--- @param self Color
4974--- @param ui_reference ui_reference
4975--- @since 1.1.0-release
4976function Color.set_from_ui_color_picker(self, ui_reference)
4977 local r, g, b, a = ui_get(ui_reference)
4978
4979 self:set_rgba(r, g, b, a)
4980end
4981
4982--- Overwrite current color using another color.
4983---
4984--- @param self Color
4985--- @param color Color
4986--- @since 1.2.0-release
4987function Color.set_from_other_color(self, color)
4988 local r, g, b, a = color:unpack_rgba()
4989
4990 self:set_rgba(r, g, b, a)
4991end
4992
4993--- Unpack RGB+A space.
4994---
4995--- @param self Color
4996function Color.unpack_rgba(self)
4997 return self.r, self.g, self.b, self.a
4998end
4999
5000--- Unpack HSL+A space.
5001---
5002--- @param self Color
5003function Color.unpack_hsla(self)
5004 return self.h, self.s, self.l, self.a
5005end
5006
5007--- Unpack RGB, HSL, and A space.
5008---
5009--- @param self Color
5010--- @since 1.1.0-release
5011function Color.unpack_all(self)
5012 return self.r, self.g, self.b, self.h, self.s, self.l, self.a
5013end
5014
5015--- Selects a color contrast.
5016---
5017--- Determines whether a colour is most visible against white or black, and returns white for 0, and 1 for black.
5018---
5019--- @param self Color
5020--- @return int
5021function Color.select_contrast(self, tolerance)
5022 tolerance = tolerance or 150
5023
5024 local contrast = self.r * 0.213 + self.g * 0.715 + self.b * 0.072
5025
5026 if (contrast < tolerance) then
5027 return 0
5028 end
5029
5030 return 1
5031end
5032
5033--- Generates a color contrast.
5034---
5035--- Determines whether a colour is most visible against white or black, and returns a new color object for the one chosen.
5036---
5037--- @param self Color
5038--- @return Color
5039function Color.generate_contrast(self, tolerance)
5040 local contrast = self:select_contrast(tolerance)
5041
5042 if (contrast == 0) then
5043 return Color.new_rgba(255, 255, 255)
5044 end
5045
5046 return Color.new_rgba(0, 0, 0)
5047end
5048
5049--- Set the red channel value of the color.
5050---
5051--- @param self Color
5052--- @param r int
5053--- @since 1.2.0-release
5054function Color.set_red(self, r)
5055 self.r = math_min(255, math_max(0, r))
5056
5057 update_hsl_space(self)
5058end
5059
5060--- Set the green channel value of the color.
5061---
5062--- @param self Color
5063--- @param g int
5064--- @since 1.2.0-release
5065function Color.set_green(self, g)
5066 self.g = math_min(255, math_max(0, g))
5067
5068 update_hsl_space(self)
5069end
5070
5071--- Set the blue channel value of the color.
5072---
5073--- @param self Color
5074--- @param b int
5075--- @since 1.2.0-release
5076function Color.set_blue(self, b)
5077 self.b = math_min(255, math_max(0, b))
5078
5079 update_hsl_space(self)
5080end
5081
5082--- Set the hue of the color.
5083---
5084--- @param self Color
5085--- @param h float
5086function Color.set_hue(self, h)
5087 self.h = h % 1
5088
5089 update_rgb_space(self)
5090end
5091
5092--- Shift the hue of the color by a given amount.
5093---
5094--- Use negative numbers go to down the spectrum.
5095---
5096--- @param self Color
5097--- @param amount float
5098function Color.shift_hue(self, amount)
5099 self.h = (self.h + amount) % 1
5100
5101 update_rgb_space(self)
5102end
5103
5104--- Shift the hue of the color by a given amount, but do not loop the spectrum.
5105---
5106--- Use negative numbers go to down the spectrum.
5107---
5108--- @param self Color
5109--- @param amount float
5110function Color.shift_hue_clamped(self, amount)
5111 self.h = math_min(1, math_max(0, self.h + amount))
5112
5113 update_rgb_space(self)
5114end
5115
5116--- Shift the hue of the color by a given amount, but keep within an upper and lower hue bound.
5117---
5118--- Use negative numbers go to down the spectrum.
5119---
5120--- @param self Color
5121--- @param amount float
5122--- @param lower_bound float
5123--- @param upper_bound float
5124function Color.shift_hue_within(self, amount, lower_bound, upper_bound)
5125 self.h = math_min(upper_bound, math_max(lower_bound, self.h + amount))
5126
5127 update_rgb_space(self)
5128end
5129
5130--- Returns true if hue is below or equal to a given hue.
5131---
5132--- @param self Color
5133--- @param h float
5134function Color.hue_is_below(self, h)
5135 return self.h <= h
5136end
5137
5138--- Returns true if hue is above or equal to a given hue.
5139---
5140--- @param self Color
5141--- @param h float
5142function Color.hue_is_above(self, h)
5143 return self.h >= h
5144end
5145
5146--- Returns true if hue is betwen two given hues.
5147---
5148--- @param self Color
5149--- @param lower_bound float
5150--- @param upper_bound float
5151function Color.hue_is_between(self, lower_bound, upper_bound)
5152 return self.h >= lower_bound and self.h <= upper_bound
5153end
5154
5155--- Returns true if the hue is within a given tolerance at a specific hue value. False if not.
5156---
5157--- @param self Color
5158--- @param h float
5159--- @param tolerance float
5160--- @since 1.2.0-release
5161function Color.hue_is_within_tolerance(self, h, tolerance)
5162 return h <= self.h + tolerance and h >= self.h - tolerance
5163end
5164
5165--- Set the saturation of the color.
5166---
5167--- @param self Color
5168--- @param s float
5169function Color.set_saturation(self, s)
5170 self.s = math_min(1, math_max(0, s))
5171
5172 update_rgb_space(self)
5173end
5174
5175--- Shift the saturation of the color by a given amount.
5176---
5177--- Use negative numbers to decrease saturation.
5178---
5179--- @param self Color
5180--- @param amount float
5181function Color.shift_saturation(self, amount)
5182 self.s = math_min(1, math_max(0, self.s + amount))
5183
5184 update_rgb_space(self)
5185end
5186
5187--- Shift the saturation of the color by a given amount, but keep within an upper and lower saturation bound.
5188---
5189--- Use negative numbers to decrease saturation.
5190---
5191--- @param self Color
5192--- @param amount float
5193function Color.shift_saturation_within(self, amount, lower_bound, upper_bound)
5194 self.s = math_min(upper_bound, math_max(lower_bound, self.s + amount))
5195
5196 update_rgb_space(self)
5197end
5198
5199--- Returns true if saturation is below or equal to a given saturation.
5200---
5201--- @param self Color
5202--- @param s float
5203function Color.saturation_is_below(self, s)
5204 return self.s <= s
5205end
5206
5207--- Returns true if saturation is above or equal to a given saturation.
5208---
5209--- @param self Color
5210--- @param s float
5211function Color.saturation_is_above(self, s)
5212 return self.s >= s
5213end
5214
5215--- Returns true if saturation is betwen two given saturations.
5216---
5217--- @param self Color
5218--- @param lower_bound float
5219--- @param upper_bound float
5220function Color.saturation_is_between(self, lower_bound, upper_bound)
5221 return self.s >= lower_bound and self.s <= upper_bound
5222end
5223
5224--- Returns true if the saturation is within a given tolerance at a specific hue value. False if not.
5225---
5226--- @param self Color
5227--- @param s float
5228--- @param tolerance float
5229--- @since 1.2.0-release
5230function Color.saturation_is_within_tolerance(self, s, tolerance)
5231 return s <= self.s + tolerance and s >= self.s - tolerance
5232end
5233
5234--- Set the lightness of the color.
5235---
5236--- @param self Color
5237--- @param l float
5238function Color.set_lightness(self, l)
5239 self.l = math_min(1, math_max(0, l))
5240
5241 update_rgb_space(self)
5242end
5243
5244--- Shift the lightness of the color within a given amount.
5245---
5246--- Use negative numbers to decrease lightness.
5247---
5248--- @param self Color
5249--- @param amount float
5250function Color.shift_lightness(self, amount)
5251 self.l = math_min(1, math_max(0, self.l + amount))
5252
5253 update_rgb_space(self)
5254end
5255
5256--- Shift the lightness of the color by a given amount, but keep within an upper and lower lightness bound.
5257-----
5258----- Use negative numbers to decrease lightness.
5259---
5260--- @param self Color
5261--- @param amount float
5262function Color.shift_lightness_within(self, amount, lower_bound, upper_bound)
5263 self.l = math_min(upper_bound, math_max(lower_bound, self.l + amount))
5264
5265 update_rgb_space(self)
5266end
5267
5268--- Returns true if lightness is below or equal to a given lightness.
5269---
5270--- @param self Color
5271--- @param l float
5272function Color.lightness_is_below(self, l)
5273 return self.l <= l
5274end
5275
5276--- Returns true if lightness is above or equal to a given lightness.
5277---
5278--- @param self Color
5279--- @param l float
5280function Color.lightness_is_above(self, l)
5281 return self.l >= l
5282end
5283
5284--- Returns true if lightness is betwen two given lightnesses.
5285---
5286--- @param self Color
5287--- @param lower_bound float
5288--- @param upper_bound float
5289function Color.lightness_is_between(self, lower_bound, upper_bound)
5290 return self.l >= lower_bound and self.l <= upper_bound
5291end
5292
5293--- Returns true if the lightness is within a given tolerance at a specific hue value. False if not.
5294---
5295--- @param self Color
5296--- @param l float
5297--- @param tolerance float
5298--- @since 1.2.0-release
5299function Color.lightness_is_within_tolerance(self, l, tolerance)
5300 return l <= self.l + tolerance and l >= self.l - tolerance
5301end
5302
5303--- Sets the alpha of the color.
5304---
5305--- @param self Color
5306--- @param alpha int
5307--- @since 1.1.0-release
5308function Color.set_alpha(self, alpha)
5309 self.a = alpha
5310
5311 validate_rgba(self)
5312end
5313
5314--- Returns true if the color is truely invisible (0 alpha).
5315---
5316--- @param self Color
5317function Color.is_invisible(self)
5318 return self.a == 0
5319end
5320
5321--- Returns true if the color is invisible to within a given tolerance (0-255 alpha).
5322---
5323--- @param self Color
5324--- @param tolerance int
5325function Color.is_invisible_within(self, tolerance)
5326 return self.a <= 0 + tolerance
5327end
5328
5329--- Returns true if the color is truely visible (255 alpha).
5330---
5331--- @param self Color
5332function Color.is_visible(self)
5333 return self.a == 255
5334end
5335
5336--- Returns true if the color is visible to within a given tolerance (0-255 alpha).
5337---
5338--- @param self Color
5339--- @param tolerance int
5340function Color.is_visible_within(self, tolerance)
5341 return self.a >= 255 - tolerance
5342end
5343
5344--- Increase the alpha of the color by a given amount.
5345---
5346--- @param self Color
5347--- @param amount int
5348function Color.fade_in(self, amount)
5349 if (self.a == 255) then
5350 return
5351 end
5352
5353 self.a = self.a + amount
5354
5355 if (self.a > 255) then
5356 self.a = 255
5357 end
5358end
5359
5360--- Decrease the alpha of the color by a given amount.
5361---
5362--- @param self Color
5363--- @param amount int
5364function Color.fade_out(self, amount)
5365 if (self.a == 0) then
5366 return
5367 end
5368
5369 self.a = self.a - amount
5370
5371 if (self.a < 0) then
5372 self.a = 0
5373 end
5374end
5375--endregion
5376--endregion
5377
5378--region dependency: havoc_timer
5379--region class.timer
5380--- @field seconds float
5381--- @field tick_count int
5382--- @field current_tick int
5383--- @field tickrate int
5384--- @field is_counting boolean
5385local Timer = {}
5386
5387--- Shader metatable.
5388local Timer_mt = {
5389 __index = Timer,
5390 __call = function(tbl, ...) return Timer.new(...) end
5391}
5392
5393--- Create a new timer.
5394---
5395--- @param use_curtime boolean: if true then the timer will use globals.curtime. If false, the timer will use globals.realtime.
5396function Timer.new(use_curtime)
5397 local object = setmetatable(
5398 {
5399 current_time = use_curtime and globals_curtime or globals_realtime,
5400 clock_started_at = nil,
5401 clock_paused_at = nil,
5402 },
5403 Timer_mt
5404 )
5405
5406 return object
5407end
5408
5409--- Get the elapsed time of the timer.
5410---
5411--- @param self Timer
5412function Timer.get_elapsed_time(self)
5413 if (self:has_started() == false) then
5414 return 0
5415 end
5416
5417 if (self.clock_paused_at ~= nil) then
5418 return self.clock_paused_at - self.clock_started_at
5419 end
5420
5421 return self.current_time() - self.clock_started_at
5422end
5423
5424--- Get the elapsed time of the timer and then stop the timer.
5425---
5426--- @param self Timer
5427function Timer.get_elapsed_time_and_stop(self)
5428 local elapsed_time = self:get_elapsed_time()
5429
5430 self:stop()
5431
5432 return elapsed_time
5433end
5434
5435--- Start the timer.
5436---
5437--- @param self Timer
5438function Timer.start(self)
5439 if (self:has_started() == true) then
5440 return
5441 end
5442
5443 self.clock_started_at = self.current_time()
5444end
5445
5446--- Stop the timer. Resetting the elapsed time to 0.
5447---
5448--- @param self Timer
5449function Timer.stop(self)
5450 self.clock_paused_at = nil
5451 self.clock_started_at = nil
5452end
5453
5454--- Stop the timer, and then start it again immediately.
5455---
5456--- @param self Timer
5457function Timer.restart(self)
5458 self:stop()
5459 self:start()
5460end
5461
5462--- Pause the timer. Will not reset the elapsed time. Unpause using `Timer.unpause`.
5463---
5464--- @param self Timer
5465function Timer.pause(self)
5466 if (self:has_started() == false) then
5467 return
5468 end
5469
5470 self.clock_paused_at = self.current_time()
5471end
5472
5473--- Unpause the timer.
5474---
5475--- @param self Timer
5476function Timer.unpause(self)
5477 if (self:has_started() == false) then
5478 return
5479 end
5480
5481 if (self:is_paused() == false) then
5482 return
5483 end
5484
5485 local clock_paused_for = self.current_time() - self.clock_paused_at
5486
5487 self.clock_started_at = self.clock_started_at + clock_paused_for
5488 self.clock_paused_at = nil
5489end
5490
5491--- Toggle between paused and unpaused.
5492---
5493--- @param self Timer
5494function Timer.toggle_pause(self)
5495 if (self:is_paused() == true) then
5496 self:unpause()
5497 else
5498 self:pause()
5499 end
5500end
5501
5502--- Returns true if the timer is currently paused. False if not.
5503---
5504--- @param self Timer
5505function Timer.is_paused(self)
5506 return self.clock_paused_at ~= nil
5507end
5508
5509--- Returns true if the timer has been started (regardless of pause state). Returns false if the timer has not been started.
5510---
5511--- @param self Timer
5512function Timer.has_started(self)
5513 return self.clock_started_at ~= nil
5514end
5515--endregion
5516--endregion
5517
5518--region globals
5519-- Kills the player achieved during a round.
5520local round_kill_count = 0
5521
5522-- Kills the player achieved during the match.
5523local game_kill_count = entity_get_prop(
5524 entity_get_all("CCSPlayerResource")[1],
5525 "m_iKills", entity_get_local_player()
5526)
5527
5528-- Kills all players achieved during a round.
5529local round_total_kill_count = 0
5530
5531-- Killstreak expiry timer.
5532local killstreak_expiry_timer = Timer.new()
5533
5534-- Default killstreak indicator color.
5535local killstreak_indicator_color = Color.new_rgba(
5536 199,
5537 229,
5538 46,
5539 255
5540)
5541
5542-- Starting lightness (0-1) of the indicator.
5543local killstreak_indicator_start_lightness_color = killstreak_indicator_color.l
5544
5545-- Amount to shift the hue by each kill. Negative numbers go down the spectrum, and positive go up it.
5546local color_killstreak_indicator_shift_amount = -16
5547
5548-- UI animation globals.
5549local ui_streak_burn_down = false
5550local ui_streak_popup_text = ""
5551local ui_streak_popup_fade_out = false
5552local ui_streak_popup_alpha = 0
5553
5554-- Screen width.
5555local screen_width, screen_height = client_screen_size()
5556
5557-- Screen center X/Y positions.
5558local center_x = screen_width / 2
5559
5560-- Streak indicator real Y.
5561local streak_indicator_y = 0
5562
5563-- Streak popup indicator real Y.
5564local streak_popup_indicator_y = 0
5565
5566-- Sounds volume.ui_slider_volume.
5567local volume = 0
5568--endregion
5569
5570--region ui
5571-- Enable plugin.
5572local ui_checkbox_enable_plugin = ui_new_checkbox(
5573 "lua",
5574 script_menu_location,
5575 "Enable Havoc Announcer"
5576)
5577
5578-- Enable announcer.
5579local ui_checkbox_enable_announcer = ui_new_checkbox(
5580 "lua",
5581 script_menu_location,
5582 "| Announcements"
5583)
5584
5585-- Enable hitsounds.
5586local ui_checkbox_enable_hitsounds = ui_new_checkbox(
5587 "lua",
5588 script_menu_location,
5589 "| Hit Sounds"
5590)
5591
5592-- Enable kill/death sounds.
5593local ui_checkbox_enable_deathsounds = ui_new_checkbox(
5594 "lua",
5595 script_menu_location,
5596 "| Kill/Death Sounds"
5597)
5598
5599-- Sounds volume slider.
5600local ui_slider_volume = ui_new_slider(
5601 "lua",
5602 script_menu_location,
5603 "| Sounds Volume",
5604 0,
5605 100,
5606 100,
5607 true,
5608 "%"
5609)
5610
5611-- Enable time-sensitive killstreaks.
5612local ui_checkbox_enable_timed_killstreaks = ui_new_checkbox(
5613 "lua",
5614 script_menu_location,
5615 "| Killstreaks Reset After Time"
5616)
5617
5618-- Enable cooldown sound of time-sensitive killstreaks.
5619local ui_checkbox_enable_timed_killstreaks_expire_sound = ui_new_checkbox(
5620 "lua",
5621 script_menu_location,
5622 "| Play Killstreak Reset Sound"
5623)
5624
5625 -- Reset time-sensitive killstreaks after X seconds.
5626local ui_slider_timed_killstreaks = ui_new_slider(
5627 "lua",
5628 script_menu_location,
5629 "| Reset Killstreaks After",
5630 4,
5631 120,
5632 4,
5633 true,
5634 "s"
5635)
5636
5637-- Reset killstreaks only upon death.
5638local ui_checkbox_enable_killstreaks_only_reset_on_death = ui_new_checkbox(
5639 "lua",
5640 script_menu_location,
5641 "| Don't Reset Streaks after Round"
5642)
5643
5644-- Enable killstreak indicator.
5645local ui_checkbox_enable_killstreaks_indicator = ui_new_checkbox(
5646 "lua",
5647 script_menu_location,
5648 "| Killstreak Text"
5649)
5650
5651-- Killstreak indicators text color.
5652local ui_color_killstreak_indicator = ui_new_color_picker(
5653 "lua",
5654 script_menu_location,
5655 "| Killstreak Text Default Color",
5656 killstreak_indicator_color:unpack_rgba()
5657)
5658
5659-- Killstreak indicators text color shift amount.
5660local ui_slider_killstreak_indicator_shift_amount = ui_new_slider(
5661 "lua",
5662 script_menu_location,
5663 "| Killstreak Text Color Change Per Kill",
5664 -90,
5665 90,
5666 color_killstreak_indicator_shift_amount,
5667 true,
5668 "",
5669 1,
5670 {[0] = "no change"}
5671)
5672
5673-- Killstreak indicator Y position.
5674local ui_slider_streak_indicator_y = ui_new_slider(
5675 "lua",
5676 script_menu_location,
5677 "| Killstreak Text Height",
5678 0,
5679 100,
5680 40,
5681 true,
5682 "%"
5683)
5684
5685-- Killstreak announcement popup Y position.
5686local ui_slider_streak_popup_indicator_y = ui_new_slider(
5687 "lua",
5688 script_menu_location,
5689 "| Announcement Text Height",
5690 0,
5691 100,
5692 36,
5693 true,
5694 "%"
5695)
5696
5697-- Killstreak announcement popup fade out amount per frame.
5698local ui_slider_streak_popup_indicator_fade_out_amount = ui_new_slider(
5699 "lua",
5700 script_menu_location,
5701 "| Announcement Text Fade Out Speed",
5702 1,
5703 100,
5704 2,
5705 true,
5706 "%"
5707)
5708
5709ui_set_visible(ui_checkbox_enable_hitsounds, false)
5710ui_set_visible(ui_checkbox_enable_deathsounds, false)
5711ui_set_visible(ui_checkbox_enable_announcer, false)
5712ui_set_visible(ui_checkbox_enable_timed_killstreaks, false)
5713ui_set_visible(ui_checkbox_enable_timed_killstreaks_expire_sound, false)
5714ui_set_visible(ui_slider_timed_killstreaks, false)
5715ui_set_visible(ui_checkbox_enable_killstreaks_only_reset_on_death, false)
5716ui_set_visible(ui_slider_volume, false)
5717ui_set_visible(ui_checkbox_enable_killstreaks_indicator, false)
5718ui_set_visible(ui_color_killstreak_indicator, false)
5719ui_set_visible(ui_slider_killstreak_indicator_shift_amount, false)
5720ui_set_visible(ui_slider_streak_indicator_y, false)
5721ui_set_visible(ui_slider_streak_popup_indicator_y, false)
5722ui_set_visible(ui_slider_streak_popup_indicator_fade_out_amount, false)
5723
5724ui_set(ui_checkbox_enable_hitsounds, true)
5725ui_set(ui_checkbox_enable_deathsounds, true)
5726ui_set(ui_checkbox_enable_announcer, true)
5727ui_set(ui_checkbox_enable_timed_killstreaks, false)
5728ui_set(ui_checkbox_enable_timed_killstreaks_expire_sound, true)
5729ui_set(ui_checkbox_enable_killstreaks_only_reset_on_death, true)
5730ui_set(ui_checkbox_enable_killstreaks_indicator, true)
5731--endregion
5732
5733--region helpers
5734--- Returns true if the killstreak timer has expired, and false if not.
5735---
5736--- @return boolean
5737local function killstreak_expired()
5738 return killstreak_expiry_timer:get_elapsed_time() >= ui_get(ui_slider_timed_killstreaks)
5739end
5740
5741--- Reset the indicator text color.
5742---
5743--- @since 1.3.0-beta
5744local function ui_streak_color_reset()
5745 -- Set the indicator color.
5746 killstreak_indicator_color:set_from_ui_color_picker(ui_color_killstreak_indicator)
5747end
5748
5749--- Play a sound from the CS:GO sound folder.
5750---
5751--- @since 0.0.0-alpha
5752local function play_sound(sound_name)
5753 client_exec(string.format("playvol %s%s %s", sounds_path, sound_name, ui_get(ui_slider_volume) / 100))
5754end
5755--endregion
5756
5757--region player_death
5758--- Round kill announcements.
5759---
5760--- @since 0.0.0-alpha
5761local function round_kill()
5762 -- Play sound from a valid index.
5763 if (announcer_round_kills[round_kill_count] ~= nil) then
5764 play_sound(announcer_round_kills[round_kill_count][1])
5765 end
5766end
5767
5768--- Game kill announcements.
5769---
5770--- @since 0.0.0-alpha
5771local function game_kill()
5772 -- Plays sound from a valid index.
5773 if (sound_announcer_game_kills[game_kill_count] ~= nil) then
5774 play_sound(sound_announcer_game_kills[game_kill_count][1])
5775
5776 return true
5777 end
5778
5779 -- If kill is the first of the round, play first blood.
5780 if (round_total_kill_count == 1) then
5781 play_sound(sound_first_blood)
5782
5783 return true
5784 end
5785
5786 return false
5787end
5788
5789--- Main announcer function.
5790---
5791--- @since 0.0.0-alpha
5792local function announcer()
5793 if (ui_get(ui_checkbox_enable_announcer) == false) then
5794 return
5795 end
5796
5797 -- If game kill announcement occurs then do not also speak out any kill streaks.
5798 if (game_kill() == true) then
5799 return
5800 end
5801
5802 round_kill()
5803end
5804
5805--- Timed killstreaks.
5806---
5807--- @since 1.1.0-release
5808local function enemy_death_timed_killstreaks()
5809 round_kill_count = round_kill_count + 1
5810 game_kill_count = game_kill_count + 1
5811
5812 if (killstreak_expired() == false) then
5813 announcer()
5814 end
5815end
5816
5817--- Untimed killstreaks.
5818---
5819--- @since 1.1.0-release
5820local function enemy_death_untimed_killstreaks()
5821 round_kill_count = round_kill_count + 1
5822 game_kill_count = game_kill_count + 1
5823
5824 announcer()
5825end
5826
5827--- UI killstreak color update.
5828---
5829--- round_kill_count will lag behind by 1 whenever this code is called.
5830---
5831--- @since 1.3.0-beta
5832local function ui_streak_color_update()
5833 if (round_kill_count ~= 0) then
5834 killstreak_indicator_color:shift_hue(color_killstreak_indicator_shift_amount)
5835 end
5836
5837 killstreak_indicator_color.l = 1
5838end
5839
5840--- UI killstreak popup update.
5841---
5842--- @since 1.4.0-beta
5843local function ui_streak_popup_update()
5844 if (round_kill_count == 0 and round_total_kill_count == 1) then
5845 ui_streak_popup_text = text_first_blood
5846 ui_streak_popup_alpha = 255
5847 elseif (sound_announcer_game_kills[game_kill_count + 1] ~= nil) then
5848 ui_streak_popup_text = sound_announcer_game_kills[game_kill_count + 1][2]
5849 ui_streak_popup_alpha = 255
5850 elseif (announcer_round_kills[round_kill_count + 1] ~= nil) then
5851 ui_streak_popup_text = announcer_round_kills[round_kill_count + 1][2]
5852 ui_streak_popup_alpha = 255
5853 end
5854end
5855
5856--- Play sound on enemy's death.
5857---
5858--- @param victim_ent_index int
5859--- @param attacker_ent_index int
5860--- @since 0.0.0-alpha
5861local function enemy_death(victim_ent_index, attacker_ent_index)
5862 -- Ignore suicides. Suicide will be accounted for next round.
5863 if (attacker_ent_index == victim_ent_index) then
5864 return
5865 end
5866
5867 if (attacker_ent_index == entity_get_local_player() and entity_is_enemy(victim_ent_index)) then
5868 ui_streak_color_update()
5869 ui_streak_popup_update()
5870
5871 if (ui_get(ui_checkbox_enable_deathsounds) == true) then
5872 play_sound(sound_enemy_death)
5873 end
5874
5875 -- Switch between timed and untime kill streaks.
5876 if (ui_get(ui_checkbox_enable_timed_killstreaks) == true) then
5877 -- Restart the killstreak timer every kill.
5878 killstreak_expiry_timer:restart()
5879
5880 enemy_death_timed_killstreaks()
5881 else
5882 enemy_death_untimed_killstreaks()
5883 end
5884 end
5885end
5886
5887--- Play sound on player's death.
5888---
5889--- @param victim_ent_index int
5890--- @since 0.0.0-alpha
5891local function player_death(victim_ent_index)
5892 if (victim_ent_index == entity_get_local_player()) then
5893 if (ui_get(ui_checkbox_enable_deathsounds) == true) then
5894 play_sound(sound_player_death)
5895 end
5896
5897 round_kill_count = 0
5898 ui_streak_color_reset()
5899 killstreak_expiry_timer:stop()
5900 end
5901end
5902
5903--- On player death callback.
5904---
5905--- @param e
5906--- @since 0.0.0-alpha
5907local function on_player_death(e)
5908 -- Always increment total kill counter regardless if plugin is enabled.
5909 round_total_kill_count = round_total_kill_count + 1
5910
5911 if (ui_get(ui_checkbox_enable_plugin) == false) then
5912 return
5913 end
5914
5915 local victim_id = e.userid
5916 local victim_ent_index = client_userid_to_entindex(victim_id)
5917
5918 if (victim_id == nil) then
5919 return
5920 end
5921
5922 local attacker_id = e.attacker
5923 local attacker_ent_index = client_userid_to_entindex(attacker_id)
5924
5925 player_death(victim_ent_index)
5926 enemy_death(victim_ent_index, attacker_ent_index)
5927end
5928--endregion
5929
5930--region player_hurt
5931--- Play hitsounds.
5932---
5933--- @param victim_ent_index int
5934--- @param attacker_ent_index int
5935--- @since 0.0.0-alpha
5936local function enemy_attacked(victim_ent_index, attacker_ent_index)
5937 if (attacker_ent_index == entity_get_local_player() and (victim_ent_index)) then
5938 play_sound(sound_body_hit)
5939 end
5940end
5941
5942--- On player hurt callback.
5943---
5944--- @param e
5945--- @since 0.0.0-alpha
5946local function on_player_hurt(e)
5947 if (ui_get(ui_checkbox_enable_plugin) == false or ui_get(ui_checkbox_enable_hitsounds) == false) then
5948 return
5949 end
5950
5951 local victim_id = e.userid
5952 local victim_ent_index = client_userid_to_entindex(victim_id)
5953
5954 if (victim_id == nil) then
5955 return
5956 end
5957
5958 local attacker_id = e.attacker
5959 local attacker_ent_index = client_userid_to_entindex(attacker_id)
5960
5961 enemy_attacked(victim_ent_index, attacker_ent_index)
5962end
5963--endregion
5964
5965--region round_start
5966--- On round start callback.
5967---
5968--- @since 0.0.0-alpha
5969local function on_round_start()
5970 game_kill_count = entity_get_prop(entity_get_all("CCSPlayerResource")[1], "m_iKills", entity_get_local_player())
5971
5972 -- Return if only resetting a killstreak when the player dies.
5973 if (ui_get(ui_checkbox_enable_killstreaks_only_reset_on_death) == true) then
5974 return
5975 end
5976
5977 round_total_kill_count = 0
5978 round_kill_count = 0
5979end
5980--endregion
5981
5982--region player_connect_full
5983--- Reset all kills.
5984---
5985--- @since 0.0.0-alpha
5986local function reset_all_kills()
5987 round_kill_count = 0
5988 game_kill_count = entity_get_prop(entity_get_all("CCSPlayerResource")[1], "m_iKills", entity_get_local_player())
5989 round_total_kill_count = 0
5990
5991 ui_streak_color_reset()
5992end
5993
5994--- On player connect full callback.
5995---
5996--- @since 0.0.0-alpha
5997local function on_player_connect_full(event)
5998 local player_ent_index = client_userid_to_entindex(event.userid)
5999
6000 if (player_ent_index ~= entity_get_local_player()) then
6001 return
6002 end
6003
6004 reset_all_kills()
6005end
6006--endregion
6007
6008--region paint
6009--- UI killstreak indicator.
6010---
6011--- @since 1.2.0-release
6012local function ui_streak(ctx)
6013 if (killstreak_indicator_color:lightness_is_below(killstreak_indicator_start_lightness_color)) then
6014 ui_streak_burn_down = false
6015 else
6016 ui_streak_burn_down = true
6017 end
6018
6019 if (ui_streak_burn_down) then
6020 killstreak_indicator_color:shift_lightness(-0.003)
6021 end
6022
6023 client_draw_text(
6024 ctx,
6025 center_x,
6026 streak_indicator_y,
6027 killstreak_indicator_color.r, killstreak_indicator_color.g, killstreak_indicator_color.b, killstreak_indicator_color.a,
6028 "c+",
6029 0,
6030 string.format(kill_streak_text_format, round_kill_count)
6031 )
6032end
6033
6034--- UI killstreak popup.
6035---
6036--- @since 1.3.2-beta
6037local function ui_streak_popup(ctx)
6038 if (ui_streak_popup_alpha > 0) then
6039 ui_streak_popup_fade_out = true
6040 else
6041 ui_streak_popup_fade_out = false
6042 end
6043
6044 if (ui_streak_popup_fade_out) then
6045 ui_streak_popup_alpha = ui_streak_popup_alpha - (ui_get(ui_slider_streak_popup_indicator_fade_out_amount) / 10)
6046 end
6047
6048 client_draw_text(
6049 ctx,
6050 center_x,
6051 streak_popup_indicator_y,
6052 killstreak_indicator_color.r, killstreak_indicator_color.g, killstreak_indicator_color.b, ui_streak_popup_alpha,
6053 "c+",
6054 0,
6055 ui_streak_popup_text
6056 )
6057end
6058
6059--- UI killstreak indicator.
6060---
6061--- @since 1.3.2-beta
6062local function ui_killstreak_indicator(ctx)
6063 -- Do not draw if player has no killstreak.
6064 if (round_kill_count < 1) then
6065 return
6066 end
6067
6068 -- Do not draw if plugin or section is not enabled.
6069 if (ui_get(ui_checkbox_enable_killstreaks_indicator) == false or ui_get(ui_checkbox_enable_plugin) == false) then
6070 return
6071 end
6072
6073 local local_player = entity_get_local_player()
6074 local life_state = entity_get_prop(local_player, "m_lifeState")
6075
6076 -- Do not draw if the player is not alive.
6077 if (life_state ~= 0) then
6078 return
6079 end
6080
6081 ui_streak(ctx)
6082 ui_streak_popup(ctx)
6083end
6084
6085--- On paint callback.
6086---
6087--- Wales is wet. The 3rd of the evil spirits knows this well. The 1st, 2nd, and 4th, however, were about to find out
6088--- about the hell they just walked blindly into.
6089---
6090--- @since 0.0.0-alpha
6091local function on_paint(ctx)
6092 ui_killstreak_indicator(ctx)
6093end
6094--endregion
6095
6096--region run_command
6097--- Killstreak timer.
6098---
6099--- @since 1.1.0-release
6100local function killstreak_timer()
6101 if (round_kill_count < 1 or ui_get(ui_checkbox_enable_timed_killstreaks) == false) then
6102 return
6103 end
6104
6105 if (killstreak_expired() == true) then
6106 ui_streak_color_reset()
6107
6108 round_kill_count = 0
6109
6110 if (ui_get(ui_checkbox_enable_timed_killstreaks_expire_sound) == true) then
6111 play_sound(sound_timed_killstreak_expires)
6112 end
6113 end
6114end
6115
6116--- On run command callback.
6117---
6118--- @since 1.1.0-release
6119local function on_run_command()
6120 killstreak_timer()
6121end
6122--endregion
6123
6124--region player_respawn
6125--- Stops the killstreak timer if the player dies.
6126---
6127--- @since 1.3.2-release
6128local function has_player_respawned(e)
6129 local victim_id = e.userid
6130 local victim_ent_index = client_userid_to_entindex(victim_id)
6131
6132 if (victim_ent_index == entity_get_local_player()) then
6133 killstreak_expiry_timer:stop()
6134 end
6135end
6136--- On player spawn callback.
6137---
6138--- @since 1.3.2-release
6139local function on_player_spawn(e)
6140 has_player_respawned(e)
6141end
6142--endregion
6143
6144--region ui_set_callback
6145--- UI visibility check (timed killstreaks section).
6146---
6147--- @since 1.3.2-release
6148local function on_ui_checkbox_enable_timed_killstreaks()
6149 local enabled_state = ui_get(ui_checkbox_enable_plugin) and ui_get(ui_checkbox_enable_timed_killstreaks)
6150
6151 ui_set_visible(ui_checkbox_enable_timed_killstreaks_expire_sound, enabled_state)
6152 ui_set_visible(ui_slider_timed_killstreaks, enabled_state)
6153end
6154
6155--- UI visibility check (killstreaks indicator section).
6156---
6157--- @since 1.3.2-release
6158local function on_ui_checkbox_enable_killstreaks_indicator()
6159 local enabled_state = ui_get(ui_checkbox_enable_plugin) and ui_get(ui_checkbox_enable_killstreaks_indicator)
6160
6161 ui_set_visible(ui_slider_killstreak_indicator_shift_amount, enabled_state)
6162 ui_set_visible(ui_color_killstreak_indicator, enabled_state)
6163 ui_set_visible(ui_slider_streak_indicator_y, enabled_state)
6164 ui_set_visible(ui_slider_streak_popup_indicator_y, enabled_state)
6165 ui_set_visible(ui_slider_streak_popup_indicator_fade_out_amount, enabled_state)
6166end
6167
6168--- UI visibility check (global).
6169---
6170--- @since 1.3.2-release
6171local function on_ui_checkbox_enable_plugin()
6172 local enabled_state = ui_get(ui_checkbox_enable_plugin)
6173
6174 ui_set_visible(ui_checkbox_enable_hitsounds, enabled_state)
6175
6176 ui_set_visible(ui_checkbox_enable_deathsounds, enabled_state)
6177
6178 ui_set_visible(ui_checkbox_enable_announcer, enabled_state)
6179
6180 ui_set_visible(ui_slider_volume, enabled_state)
6181
6182 ui_set_visible(ui_checkbox_enable_timed_killstreaks, enabled_state)
6183 on_ui_checkbox_enable_timed_killstreaks()
6184
6185 ui_set_visible(ui_checkbox_enable_killstreaks_only_reset_on_death, enabled_state)
6186
6187 ui_set_visible(ui_checkbox_enable_killstreaks_indicator, enabled_state)
6188 on_ui_checkbox_enable_killstreaks_indicator()
6189end
6190
6191--- UI killstreak indicator color.
6192---
6193--- Calling this will overwrite the current state.
6194---
6195--- @since 1.4.2-beta
6196local function on_ui_color_killstreak_indicator()
6197 -- Set the indicator color.
6198 killstreak_indicator_color:set_from_ui_color_picker(ui_color_killstreak_indicator)
6199
6200 if (round_kill_count ~= 0) then
6201 local shift_compensation = color_killstreak_indicator_shift_amount * (round_kill_count - 1)
6202
6203 -- Shift the indicator hue to match the number of kills.
6204 killstreak_indicator_color:shift_hue(shift_compensation)
6205 end
6206
6207 -- Set the default lightness state to the current live state.
6208 killstreak_indicator_start_lightness_color = killstreak_indicator_color.l
6209end
6210
6211--- UI killstreak indicator color shift amount.
6212---
6213--- @since 1.4.2-beta
6214local function on_ui_slider_killstreak_indicator_shift_amount()
6215 color_killstreak_indicator_shift_amount = ui_get(ui_slider_killstreak_indicator_shift_amount) / 360
6216
6217 on_ui_color_killstreak_indicator()
6218end
6219
6220-- UI killstreak indicator Y axis convert real value.
6221-- @since 1.5.0
6222local function on_ui_slider_streak_indicator_y()
6223 streak_indicator_y = screen_height * (ui_get(ui_slider_streak_indicator_y) / 100)
6224end
6225
6226-- UI killstreak indicator Y axis convert real value.
6227-- @since 1.5.0
6228local function on_ui_slider_streak_popup_indicator_y()
6229 streak_popup_indicator_y = screen_height * (ui_get(ui_slider_streak_popup_indicator_y) / 100)
6230end
6231
6232-- UI volume slider convert real value.
6233-- @since 1.5.0
6234local function on_ui_slider_volume()
6235 volume = ui_get(ui_slider_volume) / 100
6236end
6237--endregion
6238
6239--region hooks
6240client_set_event_callback('player_death', on_player_death)
6241client_set_event_callback('player_hurt', on_player_hurt)
6242client_set_event_callback('round_start', on_round_start)
6243client_set_event_callback('begin_new_match', reset_all_kills)
6244client_set_event_callback('player_connect_full', on_player_connect_full)
6245client_set_event_callback('paint', on_paint)
6246client_set_event_callback('run_command', on_run_command)
6247client_set_event_callback('player_spawn', on_player_spawn)
6248
6249ui_set_callback(ui_checkbox_enable_plugin, on_ui_checkbox_enable_plugin)
6250ui_set_callback(ui_checkbox_enable_timed_killstreaks, on_ui_checkbox_enable_timed_killstreaks)
6251ui_set_callback(ui_checkbox_enable_killstreaks_indicator, on_ui_checkbox_enable_killstreaks_indicator)
6252ui_set_callback(ui_color_killstreak_indicator, on_ui_color_killstreak_indicator)
6253ui_set_callback(ui_slider_killstreak_indicator_shift_amount, on_ui_slider_killstreak_indicator_shift_amount)
6254ui_set_callback(ui_slider_streak_indicator_y, on_ui_slider_streak_indicator_y)
6255ui_set_callback(ui_slider_streak_popup_indicator_y, on_ui_slider_streak_popup_indicator_y)
6256ui_set_callback(ui_slider_volume, on_ui_slider_volume)
6257--endregion
6258
6259--region overrides
6260-- Override the shift amount after loading the script to ensure the amount is a valid hue value.
6261on_ui_slider_killstreak_indicator_shift_amount()
6262on_ui_slider_streak_indicator_y()
6263on_ui_slider_streak_popup_indicator_y()
6264on_ui_slider_volume()
6265--endregion
6266
6267-- Adaptive Config
6268
6269--------------------------------------------------------------------------------
6270-- Constants and variables
6271--------------------------------------------------------------------------------
6272local enable_ref
6273local config_ref
6274local label_ref
6275
6276-- Array of aimbot references
6277-- references[IDX_BUILTIN] is an array of references to the built-in menu items
6278-- references[IDX_GLOBAL] is an array of references to the global config
6279local references = {}
6280local IDX_BUILTIN = 1
6281local IDX_GLOBAL = 2
6282
6283local config_idx_to_name = {}
6284local config_name_to_idx = {}
6285local weapon_id_to_config_idx = {}
6286
6287-- Active weapon config is managed by the script when the local player is alive
6288-- Active weapon config is managed by the user (via the menu) while the local player is dead
6289local active_config_idx
6290
6291local SPECATOR_TEAM_ID = 1
6292
6293--------------------------------------------------------------------------------
6294-- Utility functions
6295--------------------------------------------------------------------------------
6296local function copy_settings(config_idx_src, config_idx_dst)
6297 local src_refs = references[config_idx_src]
6298 local dst_refs = references[config_idx_dst]
6299 for i = 1, #dst_refs do
6300 ui.set(dst_refs[i], ui.get(src_refs[i]))
6301 end
6302end
6303
6304local function load_config(config_idx)
6305 if active_config_idx ~= config_idx then
6306 active_config_idx = config_idx
6307 copy_settings(config_idx, IDX_BUILTIN)
6308 ui.set(label_ref, "Active weapon config: " .. config_idx_to_name[config_idx])
6309 end
6310end
6311
6312local function update_config_visibility(state)
6313 local display_config = state
6314 local script_state = ui.get(enable_ref)
6315 if display_config == nil then
6316 display_config = entity.is_alive(entity.get_local_player()) == false
6317 end
6318 local display_label = not display_config
6319 ui.set_visible(config_ref, display_config and script_state)
6320 ui.set_visible(label_ref, display_label and script_state)
6321 return display_config
6322end
6323
6324local function save_reference(config_idx, setting_idx, ref)
6325 references[config_idx][setting_idx] = ref
6326 return ref
6327end
6328
6329local function bind(func, ...)
6330 local args = { ... }
6331 return function(ref)
6332 func(ref, unpack(args))
6333 end
6334end
6335
6336local function delayed_bind(func, delay, ...)
6337 local args = { ... }
6338 return function(ref)
6339 client.delay_call(delay, func, ref, unpack(args))
6340 end
6341end
6342
6343-- Temporary function for enabling config in the menu
6344local function temp_task()
6345 update_config_visibility()
6346 client.delay_call(5, temp_task)
6347end
6348
6349--------------------------------------------------------------------------------
6350-- Callback functions
6351--------------------------------------------------------------------------------
6352local function on_setup_command()
6353 local local_player = entity.get_local_player()
6354 -- Get the local players weapon so we can find its item definition index
6355 local weapon = entity.get_player_weapon(local_player)
6356 -- Get the weapons item definition and toggle off the 16th bit to get the real item def index
6357 local weapon_id = bit.band(entity.get_prop(weapon, "m_iItemDefinitionIndex"), 0xFFFF)
6358 -- Use the weapon_id_to_config_idx lookup table to get the new config index and attempt to load the config
6359 load_config(weapon_id_to_config_idx[weapon_id] or IDX_GLOBAL)
6360end
6361
6362local function on_player_death(e)
6363 if client.userid_to_entindex(e.userid) == entity.get_local_player() then
6364 update_config_visibility(true)
6365 end
6366end
6367
6368local function on_player_spawn(e)
6369 if client.userid_to_entindex(e.userid) == entity.get_local_player() then
6370 update_config_visibility(false)
6371 end
6372end
6373
6374local function on_player_team_change(e)
6375 if client.userid_to_entindex(e.userid) == entity.get_local_player() then
6376 -- Check if the team the local player switched to is spectator(1)
6377 if e.team == SPECATOR_TEAM_ID then
6378 update_config_visibility(true)
6379 end
6380 end
6381end
6382
6383local function on_game_disconnect()
6384 update_config_visibility(true)
6385end
6386
6387-- Called when a user selects a different weapon config with the combobox
6388local function on_weapon_config_selected(ref)
6389 -- If the local player is alive then do nothing and hide this combobox
6390 if update_config_visibility() == false then
6391 -- This should never happen
6392 -- client.error_log("Weapon config selected while local player is alive!")
6393 return
6394 end
6395
6396 -- Load settings from the selected weapon config
6397 local config_name = ui.get(ref)
6398 local config_idx = config_name_to_idx[config_name]
6399 load_config(config_idx)
6400end
6401
6402-- Called when a user changes the value of a built-in menu item (e.g. checking "Automatic penetrationn")
6403-- Also called when a config is loaded
6404local function on_builtin_setting_change(ref, setting_idx)
6405 -- Propagate built-in setting changes to the adaptive settings
6406 if active_config_idx ~= nil and ui.get(enable_ref) == true then
6407 ui.set(references[active_config_idx][setting_idx], ui.get(ref))
6408 end
6409end
6410
6411-- Called when a user changes the value of a weapon configs menu item (e.g. checking "Global automatic penetration")
6412-- Also called when a config is loaded
6413local function on_adaptive_setting_changed(ref, config_idx, setting_idx)
6414 -- Propagate adaptive setting changes to the built-in settings
6415 if config_idx == active_config_idx and ui.get(enable_ref) == true then
6416 ui.set(references[IDX_BUILTIN][setting_idx], ui.get(ref))
6417 end
6418end
6419
6420-- Called when a user toggles the main script checkbox
6421-- Also called on script load
6422local function on_adaptive_config_toggled(ref)
6423 local script_state = ui.get(ref)
6424 -- Update the configs visibility when the script is toggled
6425 update_config_visibility()
6426 -- Set / unset event callbacks based on the state of the script so that we aren't just invoking callbacks for no reason
6427 local update_callback = script_state and client.set_event_callback or client.unset_event_callback
6428 update_callback("setup_command", on_setup_command)
6429 update_callback("player_death", on_player_death)
6430 update_callback("player_spawn", on_player_spawn)
6431 update_callback("player_team", on_player_team_change)
6432 update_callback("cs_game_disconnected", on_game_disconnect)
6433end
6434
6435--------------------------------------------------------------------------------
6436-- Initialization code
6437--------------------------------------------------------------------------------
6438local function duplicate(tab, container, name, ui_func, ...)
6439 -- This menu item will have the same index across all weapon configs
6440 local setting_index = #references[IDX_BUILTIN] + 1
6441 -- Create hidden menu items to store values
6442 for i = IDX_GLOBAL, #references do
6443 local config_name = config_idx_to_name[i]
6444 -- Create a duplicate menu item to store settings that can be copied later
6445 local ref = save_reference(i, setting_index, ui_func(tab, container, config_name .. " " .. name:lower(), ...))
6446 -- Set a default value for the target hitbox as this multiselect cannot be empty
6447 if name == "Target hitbox" then
6448 ui.set(ref, { "Head" })
6449 end
6450 ui.set_visible(ref, false)
6451 ui.set_callback(ref, bind(on_adaptive_setting_changed, i, setting_index))
6452 end
6453 local ref = save_reference(IDX_BUILTIN, setting_index, ui.reference(tab, container, name))
6454 -- Set a callback on the built-in menu items so that settings are not overwritten whenever we are loading a new config
6455 ui.set_callback(ref, delayed_bind(on_builtin_setting_change, 0.01, setting_index))
6456end
6457
6458local function init_config(name, ...)
6459 local config_idx = #references + 1
6460 references[config_idx] = {}
6461 config_idx_to_name[config_idx] = name
6462 config_name_to_idx[name] = config_idx
6463 -- Populate the weapon_id_to_config_idx lookup table so we can easily get a configs index from a weapon id
6464 for _, weapon_id in ipairs({ ... }) do
6465 weapon_id_to_config_idx[weapon_id] = config_idx
6466 end
6467 return config_idx
6468end
6469
6470local function init()
6471 IDX_BUILTIN = init_config("Built-in menu items")
6472 init_config("Global")
6473 init_config("Auto", 11, 38)
6474 init_config("Awp", 9)
6475 init_config("Scout", 40)
6476 init_config("Desert Eagle", 1)
6477 init_config("Revolver", 64)
6478 init_config("Pistol", 2, 3, 4, 30, 32, 36, 61, 63)
6479 init_config("Rifle", 7, 8, 10, 13, 16, 39, 60)
6480 -- init_config("Submachine gun", 17, 19, 23, 24, 26, 33, 34)
6481 -- init_config("Machine gun", 14, 28)
6482 -- init_config("Shotgun", 25, 27, 29, 35)
6483
6484 assert(config_idx_to_name[IDX_GLOBAL] == "Global")
6485
6486 enable_ref = ui.new_checkbox("RAGE", "Other", "Adaptive config")
6487 config_ref = ui.new_combobox("RAGE", "Other", "\nAdaptive config", config_idx_to_name)
6488 label_ref = ui.new_label("RAGE", "Other", "Active weapon config: " .. ui.get(config_ref))
6489
6490 duplicate("RAGE", "Aimbot", "Target selection", ui.new_combobox, "Cycle", "Cycle (2x)", "Near crosshair", "Highest damage", "Lowest ping", "Best K/D ratio", "Best hit chance")
6491 duplicate("RAGE", "Aimbot", "Target hitbox", ui.new_multiselect, "Head", "Chest", "Stomach", "Arms", "Legs", "Feet")
6492 duplicate("RAGE", "Aimbot", "Avoid limbs if moving", ui.new_checkbox)
6493 duplicate("RAGE", "Aimbot", "Avoid head if jumping", ui.new_checkbox)
6494 duplicate("RAGE", "Aimbot", "Multi-point", ui.new_multiselect, "Head", "Chest", "Stomach", "Arms", "Legs", "Feet")
6495 duplicate("RAGE", "Aimbot", "Multi-point scale", ui.new_slider, 24, 100, 24, true, "%", 1, multipoint_override)
6496 duplicate("RAGE", "Aimbot", "Dynamic multi-point", ui.new_checkbox)
6497 duplicate("RAGE", "Aimbot", "Prefer safe point", ui.new_checkbox)
6498 duplicate("RAGE", "Aimbot", "Automatic fire", ui.new_checkbox)
6499 duplicate("RAGE", "Aimbot", "Automatic penetration", ui.new_checkbox)
6500 duplicate("RAGE", "Aimbot", "Silent aim", ui.new_checkbox)
6501 duplicate("RAGE", "Aimbot", "Minimum hit chance", ui.new_slider, 0, 100, 50, true, "%", 1, hitchance_override)
6502 duplicate("RAGE", "Aimbot", "Minimum damage", ui.new_slider, 0, 126, 0, true, "%", 1, mindamage_override)
6503 duplicate("RAGE", "Aimbot", "Automatic scope", ui.new_checkbox)
6504 duplicate("RAGE", "Aimbot", "Maximum FOV", ui.new_slider, 1, 180, 180, true, "°")
6505 duplicate("RAGE", "Other", "Accuracy boost", ui.new_combobox, "Off", "Low", "Medium", "High", "Maximum")
6506 duplicate("RAGE", "Other", "Quick stop", ui.new_checkbox)
6507 duplicate("RAGE", "Other", "Quick stop options", ui.new_multiselect, "Early", "Slow motion", "Duck", "Move between shots", "Ignore molotov")
6508 duplicate("RAGE", "Other", "Prefer body aim", ui.new_checkbox)
6509 duplicate("RAGE", "Other", "Prefer body aim disablers", ui.new_multiselect, "Low inaccuracy", "Target shot fired", "Target resolved", "Safe point headshot", "Low damage")
6510 duplicate("RAGE", "Other", "Delay shot on peek", ui.new_checkbox)
6511
6512 ui.set_callback(config_ref, on_weapon_config_selected)
6513 ui.set_callback(enable_ref, on_adaptive_config_toggled)
6514
6515 temp_task()
6516 on_adaptive_config_toggled(enable_ref)
6517end
6518
6519init()
6520
6521-- Aspect ratio
6522--local variables for API functions. Generated using https://github.com/sapphyrus/gamesense-lua/blob/master/generate_api.lua
6523local client_latency, client_set_clan_tag, client_log, client_timestamp, client_userid_to_entindex, client_trace_line, client_set_event_callback, client_screen_size, client_trace_bullet, client_color_log, client_system_time, client_delay_call, client_visible, client_exec, client_eye_position, client_set_cvar, client_scale_damage, client_draw_hitboxes, client_get_cvar, client_camera_angles, client_draw_debug_text, client_random_int, client_random_float = client.latency, client.set_clan_tag, client.log, client.timestamp, client.userid_to_entindex, client.trace_line, client.set_event_callback, client.screen_size, client.trace_bullet, client.color_log, client.system_time, client.delay_call, client.visible, client.exec, client.eye_position, client.set_cvar, client.scale_damage, client.draw_hitboxes, client.get_cvar, client.camera_angles, client.draw_debug_text, client.random_int, client.random_float
6524local entity_get_player_resource, entity_get_local_player, entity_is_enemy, entity_get_bounding_box, entity_is_dormant, entity_get_steam64, entity_get_player_name, entity_hitbox_position, entity_get_game_rules, entity_get_all, entity_set_prop, entity_is_alive, entity_get_player_weapon, entity_get_prop, entity_get_players, entity_get_classname = entity.get_player_resource, entity.get_local_player, entity.is_enemy, entity.get_bounding_box, entity.is_dormant, entity.get_steam64, entity.get_player_name, entity.hitbox_position, entity.get_game_rules, entity.get_all, entity.set_prop, entity.is_alive, entity.get_player_weapon, entity.get_prop, entity.get_players, entity.get_classname
6525local 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
6526local ui_new_slider, ui_new_combobox, ui_reference, ui_is_menu_open, ui_set_visible, ui_new_textbox, ui_new_color_picker, ui_set_callback, ui_set, ui_new_checkbox, ui_new_hotkey, ui_new_button, ui_new_multiselect, ui_get = ui.new_slider, ui.new_combobox, ui.reference, ui.is_menu_open, ui.set_visible, ui.new_textbox, ui.new_color_picker, ui.set_callback, ui.set, ui.new_checkbox, ui.new_hotkey, ui.new_button, ui.new_multiselect, ui.get
6527local renderer_circle_outline, renderer_rectangle, renderer_gradient, renderer_circle, renderer_text, renderer_line, renderer_measure_text, renderer_indicator, renderer_world_to_screen = renderer.circle_outline, renderer.rectangle, renderer.gradient, renderer.circle, renderer.text, renderer.line, renderer.measure_text, renderer.indicator, renderer.world_to_screen
6528local math_ceil, math_tan, math_cos, math_sinh, math_pi, math_max, math_atan2, math_floor, math_sqrt, math_deg, math_atan, math_fmod, math_acos, math_pow, math_abs, math_min, math_sin, math_log, math_exp, math_cosh, math_asin, math_rad = math.ceil, math.tan, math.cos, math.sinh, math.pi, math.max, math.atan2, math.floor, math.sqrt, math.deg, math.atan, math.fmod, math.acos, math.pow, math.abs, math.min, math.sin, math.log, math.exp, math.cosh, math.asin, math.rad
6529local table_sort, table_remove, table_concat, table_insert = table.sort, table.remove, table.concat, table.insert
6530local string_find, string_format, string_gsub, string_len, string_gmatch, string_match, string_reverse, string_upper, string_lower, string_sub = string.find, string.format, string.gsub, string.len, string.gmatch, string.match, string.reverse, string.upper, string.lower, string.sub
6531local ipairs, assert, pairs, next, tostring, tonumber, setmetatable, unpack, type, getmetatable, pcall, error = ipairs, assert, pairs, next, tostring, tonumber, setmetatable, unpack, type, getmetatable, pcall, error
6532--end of local variables
6533
6534local function set_aspect_ratio(aspect_ratio_multiplier)
6535 local screen_width, screen_height = client_screen_size()
6536 local aspectratio_value = (screen_width*aspect_ratio_multiplier)/screen_height
6537
6538 if aspect_ratio_multiplier == 1 then
6539 aspectratio_value = 0
6540 end
6541 client_set_cvar("r_aspectratio", tonumber(aspectratio_value))
6542end
6543
6544local function noop()
6545end
6546
6547--greatest common divisor
6548local function gcd(m, n)
6549 while m ~= 0 do
6550 m, n = math_fmod(n, m), m
6551 end
6552
6553 return n
6554end
6555
6556local screen_width, screen_height, aspect_ratio_reference
6557
6558local function on_aspect_ratio_changed()
6559 local aspect_ratio = ui_get(aspect_ratio_reference)*0.01
6560 aspect_ratio = 2 - aspect_ratio
6561 set_aspect_ratio(aspect_ratio)
6562end
6563
6564local multiplier = 0.01
6565local steps = 200
6566
6567local function setup(screen_width_temp, screen_height_temp)
6568 screen_width, screen_height = screen_width_temp, screen_height_temp
6569 local aspect_ratio_table = {}
6570
6571 for i=1, steps do
6572 local i2=(steps-i)*multiplier
6573 local divisor = gcd(screen_width*i2, screen_height)
6574 if screen_width*i2/divisor < 100 or i2 == 1 then
6575 aspect_ratio_table[i] = screen_width*i2/divisor .. ":" .. screen_height/divisor
6576 end
6577 end
6578
6579 if aspect_ratio_reference ~= nil then
6580 ui_set_visible(aspect_ratio_reference, false)
6581 ui_set_callback(aspect_ratio_reference, noop)
6582 end
6583
6584 aspect_ratio_reference = ui.new_slider("VISUALS", "Effects", "Force aspect ratio", 0, steps-1, steps/2, true, "%", 1, aspect_ratio_table)
6585 ui_set_callback(aspect_ratio_reference, on_aspect_ratio_changed)
6586end
6587setup(client_screen_size())
6588
6589local function on_paint(ctx)
6590 local screen_width_temp, screen_height_temp = client_screen_size()
6591 if screen_width_temp ~= screen_width or screen_height_temp ~= screen_height then
6592 setup(screen_width_temp, screen_height_temp)
6593 end
6594end
6595client.set_event_callback("paint", on_paint)
6596
6597-- Color Bar
6598
6599local client_userid_to_entindex, client_set_event_callback, client_screen_size, client_trace_bullet, client_color_log, client_reload_active_scripts, client_scale_damage, client_get_cvar, client_random_int, client_latency, client_set_clan_tag, client_log, client_timestamp, client_trace_line, client_random_float, client_draw_debug_text, client_delay_call, client_visible, client_exec, client_eye_position, client_set_cvar, client_error_log, client_draw_hitboxes, client_camera_angles, client_open_panorama_context, client_system_time = client.userid_to_entindex, client.set_event_callback, client.screen_size, client.trace_bullet, client.color_log, client.reload_active_scripts, client.scale_damage, client.get_cvar, client.random_int, client.latency, client.set_clan_tag, client.log, client.timestamp, client.trace_line, client.random_float, client.draw_debug_text, client.delay_call, client.visible, client.exec, client.eye_position, client.set_cvar, client.error_log, client.draw_hitboxes, client.camera_angles, client.open_panorama_context, client.system_time
6600local entity_get_player_resource, entity_get_local_player, entity_is_enemy, entity_get_bounding_box, entity_is_dormant, entity_get_steam64, entity_get_player_name, entity_hitbox_position, entity_get_game_rules, entity_get_all, entity_set_prop, entity_is_alive, entity_get_player_weapon, entity_get_prop, entity_get_players, entity_get_classname = entity.get_player_resource, entity.get_local_player, entity.is_enemy, entity.get_bounding_box, entity.is_dormant, entity.get_steam64, entity.get_player_name, entity.hitbox_position, entity.get_game_rules, entity.get_all, entity.set_prop, entity.is_alive, entity.get_player_weapon, entity.get_prop, entity.get_players, entity.get_classname
6601local 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
6602local ui_new_slider, ui_new_combobox, ui_reference, ui_set_visible, ui_new_textbox, ui_new_color_picker, ui_new_checkbox, ui_mouse_position, ui_new_listbox, ui_new_multiselect, ui_is_menu_open, ui_new_hotkey, ui_set, ui_new_button, ui_set_callback, ui_name, ui_get = ui.new_slider, ui.new_combobox, ui.reference, ui.set_visible, ui.new_textbox, ui.new_color_picker, ui.new_checkbox, ui.mouse_position, ui.new_listbox, ui.new_multiselect, ui.is_menu_open, ui.new_hotkey, ui.set, ui.new_button, ui.set_callback, ui.name, ui.get
6603local renderer_load_svg, renderer_circle_outline, renderer_rectangle, renderer_gradient, renderer_circle, renderer_text, renderer_line, renderer_triangle, renderer_measure_text, renderer_world_to_screen, renderer_indicator, renderer_texture = renderer.load_svg, renderer.circle_outline, renderer.rectangle, renderer.gradient, renderer.circle, renderer.text, renderer.line, renderer.triangle, renderer.measure_text, renderer.world_to_screen, renderer.indicator, renderer.texture
6604local math_ceil, math_tan, math_cos, math_sinh, math_pi, math_max, math_atan2, math_floor, math_sqrt, math_deg, math_atan, math_fmod, math_acos, math_pow, math_abs, math_min, math_sin, math_log, math_exp, math_cosh, math_asin, math_rad = math.ceil, math.tan, math.cos, math.sinh, math.pi, math.max, math.atan2, math.floor, math.sqrt, math.deg, math.atan, math.fmod, math.acos, math.pow, math.abs, math.min, math.sin, math.log, math.exp, math.cosh, math.asin, math.rad
6605local table_pack, table_sort, table_remove, table_unpack, table_concat, table_insert = table.pack, table.sort, table.remove, table.unpack, table.concat, table.insert
6606local string_find, string_format, string_gsub, string_len, string_gmatch, string_match, string_reverse, string_upper, string_lower, string_sub = string.find, string.format, string.gsub, string.len, string.gmatch, string.match, string.reverse, string.upper, string.lower, string.sub
6607local materialsystem_chams_material, materialsystem_arms_material, materialsystem_find_texture, materialsystem_find_material, materialsystem_override_material, materialsystem_find_materials, materialsystem_get_model_materials = materialsystem.chams_material, materialsystem.arms_material, materialsystem.find_texture, materialsystem.find_material, materialsystem.override_material, materialsystem.find_materials, materialsystem.get_model_materials
6608local ipairs, assert, pairs, next, tostring, tonumber, setmetatable, unpack, type, getmetatable, pcall, error = ipairs, assert, pairs, next, tostring, tonumber, setmetatable, unpack, type, getmetatable, pcall, error
6609--end of local variables
6610
6611local function hsv_to_rgb(h, s, v, a)
6612 local r, g, b
6613
6614 local i = math.floor(h * 6);
6615 local f = h * 6 - i;
6616 local p = v * (1 - s);
6617 local q = v * (1 - f * s);
6618 local t = v * (1 - (1 - f) * s);
6619
6620 i = i % 6
6621
6622 if i == 0 then r, g, b = v, t, p
6623 elseif i == 1 then r, g, b = q, v, p
6624 elseif i == 2 then r, g, b = p, v, t
6625 elseif i == 3 then r, g, b = p, q, v
6626 elseif i == 4 then r, g, b = t, p, v
6627 elseif i == 5 then r, g, b = v, p, q
6628 end
6629
6630 return r * 255, g * 255, b * 255, a * 255
6631end
6632
6633local function func_rgb_rainbowize(frequency, rgb_split_ratio)
6634 local r, g, b, a = hsv_to_rgb(globals.realtime() * frequency, 1, 1, 1)
6635
6636 r = r * rgb_split_ratio
6637 g = g * rgb_split_ratio
6638 b = b * rgb_split_ratio
6639
6640 return r, g, b
6641end
6642
6643local function on_paint(ctx)
6644
6645local r, g, b = func_rgb_rainbowize(0.1, 1)
6646
6647 local a = 255
6648
6649 renderer_gradient(0, 0, 960, 2, g, b, r, a, r, g, b, a, true)
6650 renderer_gradient(960, 0, 960, 2, r, g, b, a, b, r, g, a, true)
6651
6652 local a_lower = a*0.5
6653
6654 renderer_gradient(0, 2, 960, 2, g, b, r, a_lower, r, g, b, a_lower, true)
6655 renderer_gradient(960, 2, 960, 2, r, g, b, a_lower, b, r, g, a_lower, true)
6656
6657end
6658
6659client.set_event_callback("paint", on_paint)
6660
6661-- Damage Indicators
6662
6663--------------------------------------------------------------------------------
6664-- Caching common functions
6665--------------------------------------------------------------------------------
6666local client_set_event_callback, client_userid_to_entindex, entity_get_local_player, entity_get_prop, renderer_text, renderer_world_to_screen, ui_get, ui_new_checkbox, ui_new_color_picker = client.set_event_callback, client.userid_to_entindex, entity.get_local_player, entity.get_prop, renderer.text, renderer.world_to_screen, ui.get, ui.new_checkbox, ui.new_color_picker
6667
6668--------------------------------------------------------------------------------
6669-- Menu
6670--------------------------------------------------------------------------------
6671local damage_indicator = ui_new_checkbox("LUA", "A", "Damage indicator")
6672local damage_color = ui_new_color_picker("LUA", "A", "Damage color", 255, 255, 255, 255)
6673
6674--------------------------------------------------------------------------------
6675-- Constants and variables
6676--------------------------------------------------------------------------------
6677local shot_data = {}
6678
6679--------------------------------------------------------------------------------
6680-- Game event handling
6681--------------------------------------------------------------------------------
6682local function paint()
6683 if not ui_get(damage_indicator) then
6684 return
6685 end
6686 local r, g, b = ui_get(damage_color)
6687 for i=1, #shot_data do
6688 local shot = shot_data[i]
6689 if shot.draw then
6690 if shot.z >= shot.target then
6691 shot.alpha = shot.alpha - 1
6692 end
6693 if shot.alpha <= 0 then
6694 shot.draw = false
6695 end
6696 local sx, sy = renderer_world_to_screen(shot.x, shot.y, shot.z)
6697 if sx ~= nil then
6698 renderer_text(sx, sy, r, g, b, shot.alpha, "cb", 0, shot.damage)
6699 end
6700 shot.z = shot.z + 0.25
6701 end
6702 end
6703end
6704
6705local function player_hurt(e)
6706 if not ui_get(damage_indicator) then
6707 return
6708 end
6709 local attacker_entindex = client_userid_to_entindex(e.attacker)
6710 local victim_entindex = client_userid_to_entindex(e.userid)
6711 if attacker_entindex ~= entity_get_local_player() then
6712 return
6713 end
6714 local x, y, z = entity_get_prop(victim_entindex, "m_vecOrigin")
6715 local duck_amount = entity_get_prop(victim_entindex, "m_flDuckAmount")
6716 z = z + (46 + (1 - duck_amount) * 18)
6717 shot_data[#shot_data + 1] = {
6718 x = x,
6719 y = y,
6720 z = z,
6721 target = z + 25,
6722 damage = e.dmg_health,
6723 alpha = 255,
6724 draw = true
6725 }
6726end
6727
6728local function round_start()
6729 if not ui_get(damage_indicator) then
6730 return
6731 end
6732 shot_data = {}
6733end
6734
6735client_set_event_callback("paint", paint)
6736client_set_event_callback("player_hurt", player_hurt)
6737client_set_event_callback("round_start", round_start)
6738
6739-- Draw Hitboxes
6740
6741--------------------------------------------------------------------------------
6742-- Caching common functions
6743--------------------------------------------------------------------------------
6744local client_draw_hitboxes, client_set_event_callback, client_userid_to_entindex, entity_get_local_player, ui_get, ui_new_checkbox, ui_new_color_picker, ui_new_combobox, ui_new_slider, ui_set_callback, ui_set_visible = client.draw_hitboxes, client.set_event_callback, client.userid_to_entindex, entity.get_local_player, ui.get, ui.new_checkbox, ui.new_color_picker, ui.new_combobox, ui.new_slider, ui.set_callback, ui.set_visible
6745
6746--------------------------------------------------------------------------------
6747-- Menu
6748--------------------------------------------------------------------------------
6749local enabled = ui_new_checkbox("LUA", "A", "Draw hitbox")
6750local color = ui_new_color_picker("LUA", "A", "Color", 255, 255, 255, 255)
6751local mode = ui_new_combobox("LUA", "A", "Mode", "Full", "Hitgroup")
6752local duration = ui_new_slider("LUA", "A", "\n", 1, 10000, 1000, true, "s", 0.001)
6753
6754local function handle_menu()
6755 local state = ui_get(enabled)
6756 ui_set_visible(mode, state)
6757 ui_set_visible(duration, state)
6758end
6759
6760handle_menu()
6761ui_set_callback(enabled, handle_menu)
6762
6763--------------------------------------------------------------------------------
6764-- Constants and variables
6765--------------------------------------------------------------------------------
6766local hitgroups = {
6767 [1] = {0, 1},
6768 [2] = {4, 5, 6},
6769 [3] = {2, 3},
6770 [4] = {13, 15, 16},
6771 [5] = {14, 17, 18},
6772 [6] = {7, 9, 11},
6773 [7] = {8, 10, 12}
6774}
6775
6776--------------------------------------------------------------------------------
6777-- Game event handling
6778--------------------------------------------------------------------------------
6779local function player_hurt(e)
6780 if not ui_get(enabled) then
6781 return
6782 end
6783 local r, g, b, a = ui_get(color)
6784 local duration = ui_get(duration) * 0.001
6785 local victim_entindex = client_userid_to_entindex(e.userid)
6786 local attacker_entindex = client_userid_to_entindex(e.attacker)
6787 if attacker_entindex ~= entity_get_local_player() then
6788 return
6789 end
6790 if ui_get(mode) == "Hitgroup" then
6791 client_draw_hitboxes(victim_entindex, duration, hitgroups[e.hitgroup], r, g, b, a)
6792 else
6793 client_draw_hitboxes(victim_entindex, duration, 19, r, g, b, a)
6794 end
6795end
6796
6797client_set_event_callback("player_hurt", player_hurt)
6798
6799-- Draw Purchases
6800
6801--local variables for API functions. Generated using https://github.com/sapphyrus/gamesense-lua/blob/master/generate_api.lua
6802local client_userid_to_entindex, client_set_event_callback, client_screen_size, client_trace_bullet, client_color_log, client_reload_active_scripts, client_scale_damage, client_get_cvar, client_random_int, client_latency, client_set_clan_tag, client_log, client_timestamp, client_trace_line, client_random_float, client_draw_debug_text, client_visible, client_exec, client_delay_call, client_set_cvar, client_eye_position, client_draw_hitboxes, client_camera_angles, client_open_panorama_context, client_system_time = client.userid_to_entindex, client.set_event_callback, client.screen_size, client.trace_bullet, client.color_log, client.reload_active_scripts, client.scale_damage, client.get_cvar, client.random_int, client.latency, client.set_clan_tag, client.log, client.timestamp, client.trace_line, client.random_float, client.draw_debug_text, client.visible, client.exec, client.delay_call, client.set_cvar, client.eye_position, client.draw_hitboxes, client.camera_angles, client.open_panorama_context, client.system_time
6803local entity_get_player_resource, entity_get_local_player, entity_is_enemy, entity_get_bounding_box, entity_is_dormant, entity_get_steam64, entity_get_player_name, entity_hitbox_position, entity_get_game_rules, entity_get_all, entity_set_prop, entity_is_alive, entity_get_player_weapon, entity_get_prop, entity_get_players, entity_get_classname = entity.get_player_resource, entity.get_local_player, entity.is_enemy, entity.get_bounding_box, entity.is_dormant, entity.get_steam64, entity.get_player_name, entity.hitbox_position, entity.get_game_rules, entity.get_all, entity.set_prop, entity.is_alive, entity.get_player_weapon, entity.get_prop, entity.get_players, entity.get_classname
6804local 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
6805local ui_new_slider, ui_new_hotkey, ui_new_combobox, ui_reference, ui_is_menu_open, ui_set_visible, ui_new_textbox, ui_new_color_picker, ui_set_callback, ui_set, ui_new_checkbox, ui_mouse_position, ui_new_button, ui_new_multiselect, ui_get = ui.new_slider, ui.new_hotkey, ui.new_combobox, ui.reference, ui.is_menu_open, ui.set_visible, ui.new_textbox, ui.new_color_picker, ui.set_callback, ui.set, ui.new_checkbox, ui.mouse_position, ui.new_button, ui.new_multiselect, ui.get
6806local renderer_load_svg, renderer_circle_outline, renderer_rectangle, renderer_gradient, renderer_circle, renderer_text, renderer_line, renderer_triangle, renderer_measure_text, renderer_world_to_screen, renderer_indicator, renderer_texture = renderer.load_svg, renderer.circle_outline, renderer.rectangle, renderer.gradient, renderer.circle, renderer.text, renderer.line, renderer.triangle, renderer.measure_text, renderer.world_to_screen, renderer.indicator, renderer.texture
6807local math_ceil, math_tan, math_cos, math_sinh, math_pi, math_max, math_atan2, math_floor, math_sqrt, math_deg, math_atan, math_fmod, math_acos, math_pow, math_abs, math_min, math_sin, math_log, math_exp, math_cosh, math_asin, math_rad = math.ceil, math.tan, math.cos, math.sinh, math.pi, math.max, math.atan2, math.floor, math.sqrt, math.deg, math.atan, math.fmod, math.acos, math.pow, math.abs, math.min, math.sin, math.log, math.exp, math.cosh, math.asin, math.rad
6808local table_sort, table_remove, table_concat, table_insert = table.sort, table.remove, table.concat, table.insert
6809local string_find, string_format, string_gsub, string_len, string_gmatch, string_match, string_reverse, string_upper, string_lower, string_sub = string.find, string.format, string.gsub, string.len, string.gmatch, string.match, string.reverse, string.upper, string.lower, string.sub
6810local ipairs, assert, pairs, next, tostring, tonumber, setmetatable, unpack, type, getmetatable, pcall, error = ipairs, assert, pairs, next, tostring, tonumber, setmetatable, unpack, type, getmetatable, pcall, error
6811--end of local variables
6812
6813local bit_band = bit.band
6814local idx_to_console_name, weapon_types = {[1]="weapon_deagle",[2]="weapon_elite",[3]="weapon_fiveseven",[4]="weapon_glock",[7]="weapon_ak47",[8]="weapon_aug",[9]="weapon_awp",[10]="weapon_famas",[11]="weapon_g3sg1",[13]="weapon_galilar",[14]="weapon_m249",[16]="weapon_m4a1",[17]="weapon_mac10",[19]="weapon_p90",[23]="weapon_mp5sd",[24]="weapon_ump45",[25]="weapon_xm1014",[26]="weapon_bizon",[27]="weapon_mag7",[28]="weapon_negev",[29]="weapon_sawedoff",[30]="weapon_tec9",[31]="weapon_taser",[32]="weapon_hkp2000",[33]="weapon_mp7",[34]="weapon_mp9",[35]="weapon_nova",[36]="weapon_p250",[38]="weapon_scar20",[39]="weapon_sg556",[40]="weapon_ssg08",[41]="weapon_knifegg",[42]="weapon_knife",[43]="weapon_flashbang",[44]="weapon_hegrenade",[45]="weapon_smokegrenade",[46]="weapon_molotov",[47]="weapon_decoy",[48]="weapon_incgrenade",[49]="weapon_c4",[50]="item_kevlar",[51]="item_assaultsuit",[52]="item_heavyassaultsuit",[55]="item_defuser",[56]="item_cutters",[57]="weapon_healthshot",[59]="weapon_knife_t",[60]="weapon_m4a1_silencer",[61]="weapon_usp_silencer",[63]="weapon_cz75a",[64]="weapon_revolver",[68]="weapon_tagrenade",[69]="weapon_fists",[70]="weapon_breachcharge",[72]="weapon_tablet",[74]="weapon_melee",[75]="weapon_axe",[76]="weapon_hammer",[78]="weapon_spanner",[80]="weapon_knife_ghost",[81]="weapon_firebomb",[82]="weapon_diversion",[83]="weapon_frag_grenade",[84]="weapon_snowball",[500]="weapon_bayonet",[505]="weapon_knife_flip",[506]="weapon_knife_gut",[507]="weapon_knife_karambit",[508]="weapon_knife_m9_bayonet",[509]="weapon_knife_tactical",[512]="weapon_knife_falchion",[514]="weapon_knife_survival_bowie",[515]="weapon_knife_butterfly",[516]="weapon_knife_push",[519]="weapon_knife_ursus",[520]="weapon_knife_gypsy_jackknife",[522]="weapon_knife_stiletto",[523]="weapon_knife_widowmaker"}, {["secondary"]={1,2,3,4,30,32,36,61,63,64},["rifle"]={7,8,9,10,11,13,16,38,39,40,60},["heavy"]={14,25,27,28,29,35},["smg"]={17,19,23,24,26,33,34},["equipment"]={31,50,51,52,55,56},["melee"]={41,42,59,69,74,75,76,78,80,500,505,506,507,508,509,512,514,515,516,519,520,522,523},["grenade"]={43,44,45,46,47,48,68,81,82,83,84},["c4"]={49,70},["boost"]={57},["utility"]={72}}
6815local weapon_types_lookup, console_name_to_idx = setmetatable({}, {__index=function(tbl, idx) return type(idx) == "number" and rawget(tbl, bit_band(idx, 0xFFFF)) or nil end}), {}
6816for type, weapons in pairs(weapon_types) do
6817 for i=1, #weapons do
6818 weapon_types_lookup[weapons[i]], weapon_types_lookup[idx_to_console_name[weapons[i]]], console_name_to_idx[weapons[i]] = type, type, idx_to_console_name[weapons[i]]
6819 end
6820end
6821
6822--{"c4", "boost", "utility", "rifle", "heavy", "smg", "secondary", "melee", "equipment", "grenade"}
6823
6824local type_opacities = {
6825 secondary=0.7,
6826 equipment=0.7,
6827 grenade=0.4,
6828 utility=0.4,
6829}
6830
6831local function table_contains(tbl, val)
6832 for i=1,#tbl do
6833 if tbl[i] == val then
6834 return true
6835 end
6836 end
6837 return false
6838end
6839
6840local function draw_container(x, y, w, h, header, a)
6841 local c = {10, 60, 40, 40, 40, 60, 20}
6842
6843 for i = 0,6,1 do
6844 renderer_rectangle(x+i, y+i, w-(i*2), h-(i*2), c[i+1], c[i+1], c[i+1], a)
6845 end
6846
6847 if header then
6848 local x_inner, y_inner = x+7, y+7
6849 local w_inner = w-14
6850
6851 renderer_gradient(x_inner, y_inner, math_floor(w_inner/2), 1, 59, 175, 222, a, 202, 70, 205, a, true)
6852 renderer_gradient(x_inner+math_floor(w_inner/2), y_inner, math_ceil(w_inner/2), 1, 202, 70, 205, a, 201, 227, 58, a, true)
6853
6854 local a_lower = a*0.2
6855 renderer_gradient(x_inner, y_inner+1, math_floor(w_inner/2), 1, 59, 175, 222, a_lower, 202, 70, 205, a_lower, true)
6856 renderer_gradient(x_inner+math_floor(w_inner/2), y_inner+1, math_ceil(w_inner/2), 1, 202, 70, 205, a_lower, 201, 227, 58, a_lower, true)
6857 end
6858end
6859
6860local enabled_reference = ui.new_checkbox("VISUALS", "Other ESP", "Draw purchases")
6861local color_reference = ui.new_color_picker("VISUALS", "Other ESP", "Draw purchases color", 230, 230, 230, 255)
6862
6863local images_lib = require "images"
6864local images_icons
6865
6866local player_name_flags = nil
6867local icon_height = 13
6868local padding = 4
6869local line_height = 17
6870
6871local purchases = {}
6872
6873local function on_paint()
6874 if not ui_get(enabled_reference) then
6875 return
6876 end
6877 local r, g, b, a = ui_get(color_reference)
6878
6879 --delay loading, only load icons if script is enabled
6880 if images_icons == nil then
6881 images_icons = images_lib.load(require("imagepack_icons"))
6882 end
6883
6884 local width_max = 90
6885 local names, width_name = {}, {}
6886 local i = 1
6887 for player, purchases_player in pairs(purchases) do
6888 names[player] = entity_get_player_name(player) .. " bought "
6889 local width = renderer_measure_text(player_name_flags, names[player])
6890 width_name[player] = width
6891
6892 for i=1, #purchases_player do
6893 if purchases_player[i] ~= "kevlar" or not table_contains(purchases_player, "assaultsuit") then
6894 local icon = images_icons[({purchases_player[i]:gsub("weapon_", ""):gsub("item_", "")})[1]]
6895 if icon ~= nil then
6896 width = width + icon:measure(nil, icon_height) + padding
6897 --else
6898 -- client.log("icon for ", purchases_player[i], " not found")
6899 end
6900 end
6901 end
6902
6903 width_max = math_max(width_max, width)
6904 i = i + 1
6905 end
6906
6907 if i == 1 then
6908 return
6909 end
6910
6911 local game_rules = entity_get_game_rules()
6912 local a = 255
6913 local round_start_time = entity_get_prop(game_rules, "m_fRoundStartTime")
6914 local round_time = entity_get_prop(game_rules, "m_timeUntilNextPhaseStarts")
6915
6916 local time_since_start = globals_curtime()-round_start_time
6917
6918 if time_since_start > 5 and time_since_start <= 6 then
6919 a = 255 * (1-(time_since_start-5)/1)
6920 elseif time_since_start > 6 then
6921 a = 0
6922 end
6923
6924 if a == 0 then
6925 return
6926 end
6927
6928 local screen_width, screen_height = client_screen_size()
6929 local x, y = screen_width-width_max-16-11, screen_height/2.3
6930
6931 draw_container(x-4, y-4, width_max+16, i*line_height, true, a)
6932 local x, y = x+5, y+8
6933
6934 local i = 1
6935 for player, purchases_player in pairs(purchases) do
6936 local y_offset = (i-1)*line_height
6937 renderer_text(x, y+y_offset, r, g, b, a, player_name_flags, 0, names[player])
6938 local x_offset = width_name[player]
6939
6940 local weapon_types_order = {"c4", "boost", "utility", "rifle", "heavy", "smg", "secondary", "melee", "equipment", "grenade"}
6941 for i=1, #weapon_types_order do
6942 local type_current = weapon_types_order[i]
6943 for i=1, #purchases_player do
6944 local weapon_type = weapon_types_lookup[purchases_player[i]]
6945 if weapon_type == type_current then
6946 if purchases_player[i] ~= "item_kevlar" or not table_contains(purchases_player, "item_assaultsuit") then
6947 local icon = images_icons[({purchases_player[i]:gsub("weapon_", ""):gsub("item_", "")})[1]]
6948 if icon ~= nil then
6949 local opacity_multiplier = type_opacities[weapon_type] or 1
6950 local width = icon:draw(x+x_offset, y+y_offset, nil, icon_height, r, g, b, a*opacity_multiplier)
6951 x_offset = x_offset + width + padding
6952 end
6953 end
6954 end
6955 end
6956 end
6957
6958 i = i + 1
6959 end
6960end
6961client.set_event_callback("paint", on_paint)
6962
6963local function on_item_purchase(e)
6964 local player = client_userid_to_entindex(e.userid)
6965 if not entity_is_enemy(player) then return end
6966 if purchases[player] == nil then
6967 purchases[player] = {}
6968 end
6969 table_insert(purchases[player], e.weapon)
6970end
6971client.set_event_callback("item_purchase", on_item_purchase)
6972
6973local function on_player_spawn(e)
6974 local player = client_userid_to_entindex(e.userid)
6975 if not entity_is_enemy(player) then return end
6976 if purchases[player] == nil then
6977 purchases[player] = {}
6978 end
6979end
6980client.set_event_callback("player_spawn", on_player_spawn)
6981
6982local function reset()
6983 purchases = {}
6984end
6985client.set_event_callback("round_end", reset)
6986client.set_event_callback("round_start", reset)
6987
6988-- Havoc Color correction
6989
6990--region setup/config
6991-- Set this to either "a" or "b", depending on where you want the menu for the lua to be.
6992local script_menu_location = "b"
6993--endregion
6994
6995--region gs_api
6996--region Client
6997local client = {
6998 latency = client.latency,
6999 log = client.log,
7000 userid_to_entindex = client.userid_to_entindex,
7001 set_event_callback = client.set_event_callback,
7002 screen_size = client.screen_size,
7003 eye_position = client.eye_position,
7004 color_log = client.color_log,
7005 delay_call = client.delay_call,
7006 visible = client.visible,
7007 exec = client.exec,
7008 trace_line = client.trace_line,
7009 draw_hitboxes = client.draw_hitboxes,
7010 camera_angles = client.camera_angles,
7011 draw_debug_text = client.draw_debug_text,
7012 random_int = client.random_int,
7013 random_float = client.random_float,
7014 trace_bullet = client.trace_bullet,
7015 scale_damage = client.scale_damage,
7016 timestamp = client.timestamp,
7017 set_clantag = client.set_clantag,
7018 system_time = client.system_time,
7019 reload_active_scripts = client.reload_active_scripts
7020}
7021--endregion
7022
7023--region Entity
7024local entity = {
7025 get_local_player = entity.get_local_player,
7026 is_enemy = entity.is_enemy,
7027 hitbox_position = entity.hitbox_position,
7028 get_player_name = entity.get_player_name,
7029 get_steam64 = entity.get_steam64,
7030 get_bounding_box = entity.get_bounding_box,
7031 get_all = entity.get_all,
7032 set_prop = entity.set_prop,
7033 is_alive = entity.is_alive,
7034 get_player_weapon = entity.get_player_weapon,
7035 get_prop = entity.get_prop,
7036 get_players = entity.get_players,
7037 get_classname = entity.get_classname,
7038 get_game_rules = entity.get_game_rules,
7039 get_player_resource = entity.get_prop,
7040 is_dormant = entity.is_dormant,
7041}
7042--endregion
7043
7044--region Globals
7045local globals = {
7046 realtime = globals.realtime,
7047 absoluteframetime = globals.absoluteframetime,
7048 tickcount = globals.tickcount,
7049 curtime = globals.curtime,
7050 mapname = globals.mapname,
7051 tickinterval = globals.tickinterval,
7052 framecount = globals.framecount,
7053 frametime = globals.frametime,
7054 maxplayers = globals.maxplayers,
7055 lastoutgoingcommand = globals.lastoutgoingcommand,
7056}
7057--endregion
7058
7059--region Ui
7060local ui = {
7061 new_slider = ui.new_slider,
7062 new_combobox = ui.new_combobox,
7063 reference = ui.reference,
7064 set_visible = ui.set_visible,
7065 is_menu_open = ui.is_menu_open,
7066 new_color_picker = ui.new_color_picker,
7067 set_callback = ui.set_callback,
7068 set = ui.set,
7069 new_checkbox = ui.new_checkbox,
7070 new_hotkey = ui.new_hotkey,
7071 new_button = ui.new_button,
7072 new_multiselect = ui.new_multiselect,
7073 get = ui.get,
7074 new_textbox = ui.new_textbox,
7075 mouse_position = ui.mouse_position
7076}
7077--endregion
7078
7079--region Renderer
7080local renderer = {
7081 text = renderer.text,
7082 measure_text = renderer.measure_text,
7083 rectangle = renderer.rectangle,
7084 line = renderer.line,
7085 gradient = renderer.gradient,
7086 circle = renderer.circle,
7087 circle_outline = renderer.circle_outline,
7088 triangle = renderer.triangle,
7089 world_to_screen = renderer.world_to_screen,
7090 indicator = renderer.indicator,
7091 texture = renderer.texture,
7092 load_svg = renderer.load_svg
7093}
7094--endregion
7095--endregion
7096
7097--region dependencies
7098--region dependency: havoc_color
7099-- version 1.2.0
7100
7101--region helpers
7102--- Convert HSL to RGB.
7103---
7104--- Original function by EmmanuelOga:
7105--- https://github.com/EmmanuelOga/columns/blob/master/utils/color.lua
7106---
7107--- @param color Color
7108local function update_rgb_space(color)
7109 local r, g, b
7110
7111 if (color.s == 0) then
7112 r, g, b = color.l, color.l, color.l
7113 else
7114 function hue_to_rgb(p, q, t)
7115 if t < 0 then t = t + 1 end
7116 if t > 1 then t = t - 1 end
7117 if t < 1/6 then return p + (q - p) * 6 * t end
7118 if t < 1/2 then return q end
7119 if t < 2/3 then return p + (q - p) * (2/3 - t) * 6 end
7120
7121 return p
7122 end
7123
7124 local q = 0
7125
7126 if (color.l < 0.5) then
7127 q = color.l * (1 + color.s)
7128 else
7129 q = color.l + color.s - color.l * color.s
7130 end
7131
7132 local p = 2 * color.l - q
7133
7134 r = hue_to_rgb(p, q, color.h + 1/3)
7135 g = hue_to_rgb(p, q, color.h)
7136 b = hue_to_rgb(p, q, color.h - 1/3)
7137 end
7138
7139 color.r = r * 255
7140 color.g = g * 255
7141 color.b = b * 255
7142end
7143
7144--- Convert RGB to HSL.
7145---
7146--- Original function by EmmanuelOga:
7147--- https://github.com/EmmanuelOga/columns/blob/master/utils/color.lua
7148---
7149--- @param color Color
7150local function update_hsl_space(color)
7151 local r, g, b = color.r / 255, color.g / 255, color.b / 255
7152 local max, min = math.max(r, g, b), math.min(r, g, b)
7153 local h, s, l
7154
7155 l = (max + min) / 2
7156
7157 if (max == min) then
7158 h, s = 0, 0
7159 else
7160 local d = max - min
7161
7162 if (l > 0.5) then
7163 s = d / (2 - max - min)
7164 else
7165 s = d / (max + min)
7166 end
7167
7168 if (max == r) then
7169 h = (g - b) / d
7170
7171 if (g < b) then
7172 h = h + 6
7173 end
7174 elseif (max == g) then
7175 h = (b - r) / d + 2
7176 elseif (max == b) then
7177 h = (r - g) / d + 4
7178 end
7179
7180 h = h / 6
7181 end
7182
7183 color.h, color.s, color.l = h, s, l or 255
7184end
7185
7186--- Validate the RGB+A space and clamp errors.
7187---
7188--- @param color Color
7189local function validate_rgba(color)
7190 color.r = math.min(255, math.max(0, color.r))
7191 color.g = math.min(255, math.max(0, color.g))
7192 color.b = math.min(255, math.max(0, color.b))
7193 color.a = math.min(255, math.max(0, color.a))
7194end
7195
7196--- Validate the HSL+A space and clamp errors.
7197---
7198--- @param color Color
7199local function validate_hsla(color)
7200 color.h = math.min(1, math.max(0, color.h))
7201 color.s = math.min(1, math.max(0, color.s))
7202 color.l = math.min(1, math.max(0, color.l))
7203
7204 color.a = math.min(1, math.max(0, color.a))
7205end
7206--endregion
7207
7208--region class.color
7209local Color = {}
7210
7211--- Color metatable.
7212local color_mt = {
7213 __index = Color,
7214 __call = function(tbl, ...) return Color.new_rgba(...) end
7215}
7216
7217--- Create new color object in using the RGB+A space.
7218---
7219--- @param r int
7220--- @param g int
7221--- @param b int
7222--- @param a int
7223--- @return Color
7224function Color.new_rgba(r, g, b, a)
7225 if (a == nil) then
7226 a = 255
7227 end
7228
7229 local object = setmetatable({r = r, g = g, b = b, a = a, h = 0, s = 0, l = 0}, color_mt)
7230
7231 validate_rgba(object)
7232 update_hsl_space(object)
7233
7234 return object
7235end
7236
7237--- Create new color object in using the HSL+A space.
7238---
7239--- @param self Color
7240--- @param h int
7241--- @param s int
7242--- @param l int
7243--- @param a int
7244--- @return Color
7245function Color.new_hsla(h, s, l, a)
7246 if (a == nil) then
7247 a = 255
7248 end
7249
7250 h = h % 1
7251
7252 local object = setmetatable({r = 0, g = 0, b = 0, a = a, h = h, s = s, l = l}, color_mt)
7253
7254 validate_hsla(object)
7255 update_rgb_space(object)
7256
7257 return object
7258end
7259
7260--- Create a color from a UI reference.
7261---
7262--- @param ui_reference ui_reference
7263--- @return Color
7264--- @since 1.1.0-release
7265function Color.new_from_ui_color_picker(ui_reference)
7266 local r, g, b, a = ui.get(ui_reference)
7267
7268 return Color.new_rgba(r, g, b, a)
7269end
7270
7271--- Create a color from another color.
7272---
7273--- @param color Color
7274--- @return Color
7275--- @since 1.2.0-release
7276function Color.new_from_other_color(color)
7277 local r, g, b, a = color:unpack_rgba()
7278
7279 return Color.new_rgba(r, g, b, a)
7280end
7281
7282--- Overwrite current color using RGB+A space.
7283---
7284--- @param self Color
7285--- @param r int
7286--- @param g int
7287--- @param b int
7288--- @param a int
7289function Color.set_rgba(self, r, g, b, a)
7290 if (a == nil) then
7291 a = 255
7292 end
7293
7294 self.r, self.g, self.b, self.a = r, g, b, a
7295
7296 validate_rgba(self)
7297 update_hsl_space(self)
7298end
7299
7300--- Overwrite current color using HSL+A space.
7301---
7302--- @param self Color
7303--- @param h int
7304--- @param s int
7305--- @param l int
7306--- @param a int
7307function Color.set_hsla(self, h, s, l, a)
7308 if (a == nil) then
7309 a = 255
7310 end
7311
7312 h = h % 1
7313
7314 self.h, self.s, self.l, self.a = h, s, l, a
7315
7316 validate_hsla(self)
7317 update_rgb_space(self)
7318end
7319
7320--- Overwrite current color using a UI reference.
7321---
7322--- @param self Color
7323--- @param ui_reference ui_reference
7324--- @since 1.1.0-release
7325function Color.set_from_ui_color_picker(self, ui_reference)
7326 local r, g, b, a = ui.get(ui_reference)
7327
7328 self:set_rgba(r, g, b, a)
7329end
7330
7331--- Overwrite current color using another color.
7332---
7333--- @param self Color
7334--- @param color Color
7335--- @since 1.2.0-release
7336function Color.set_from_other_color(self, color)
7337 local r, g, b, a = color:unpack_rgba()
7338
7339 self:set_rgba(r, g, b, a)
7340end
7341
7342--- Unpack RGB+A space.
7343---
7344--- @param self Color
7345function Color.unpack_rgba(self)
7346 return self.r, self.g, self.b, self.a
7347end
7348
7349--- Unpack HSL+A space.
7350---
7351--- @param self Color
7352function Color.unpack_hsla(self)
7353 return self.h, self.s, self.l, self.a
7354end
7355
7356--- Unpack RGB, HSL, and A space.
7357---
7358--- @param self Color
7359--- @since 1.1.0-release
7360function Color.unpack_all(self)
7361 return self.r, self.g, self.b, self.h, self.s, self.l, self.a
7362end
7363
7364--- Selects a color contrast.
7365---
7366--- Determines whether a colour is most visible against white or black, and returns white for 0, and 1 for black.
7367---
7368--- @param self Color
7369--- @return int
7370function Color.select_contrast(self, tolerance)
7371 tolerance = tolerance or 150
7372
7373 local contrast = self.r * 0.213 + self.g * 0.715 + self.b * 0.072
7374
7375 if (contrast < tolerance) then
7376 return 0
7377 end
7378
7379 return 1
7380end
7381
7382--- Generates a color contrast.
7383---
7384--- Determines whether a colour is most visible against white or black, and returns a new color object for the one chosen.
7385---
7386--- @param self Color
7387--- @return Color
7388function Color.generate_contrast(self, tolerance)
7389 local contrast = self:select_contrast(tolerance)
7390
7391 if (contrast == 0) then
7392 return Color.new_rgba(255, 255, 255)
7393 end
7394
7395 return Color.new_rgba(0, 0, 0)
7396end
7397
7398--- Set the red channel value of the color.
7399---
7400--- @param self Color
7401--- @param r int
7402--- @since 1.2.0-release
7403function Color.set_red(self, r)
7404 self.r = math.min(255, math.max(0, r))
7405
7406 update_hsl_space(self)
7407end
7408
7409--- Set the green channel value of the color.
7410---
7411--- @param self Color
7412--- @param g int
7413--- @since 1.2.0-release
7414function Color.set_green(self, g)
7415 self.g = math.min(255, math.max(0, g))
7416
7417 update_hsl_space(self)
7418end
7419
7420--- Set the blue channel value of the color.
7421---
7422--- @param self Color
7423--- @param b int
7424--- @since 1.2.0-release
7425function Color.set_blue(self, b)
7426 self.b = math.min(255, math.max(0, b))
7427
7428 update_hsl_space(self)
7429end
7430
7431--- Set the hue of the color.
7432---
7433--- @param self Color
7434--- @param h float
7435function Color.set_hue(self, h)
7436 self.h = h % 1
7437
7438 update_rgb_space(self)
7439end
7440
7441--- Shift the hue of the color by a given amount.
7442---
7443--- Use negative numbers go to down the spectrum.
7444---
7445--- @param self Color
7446--- @param amount float
7447function Color.shift_hue(self, amount)
7448 self.h = (self.h + amount) % 1
7449
7450 update_rgb_space(self)
7451end
7452
7453--- Shift the hue of the color by a given amount, but do not loop the spectrum.
7454---
7455--- Use negative numbers go to down the spectrum.
7456---
7457--- @param self Color
7458--- @param amount float
7459function Color.shift_hue_clamped(self, amount)
7460 self.h = math.min(1, math.max(0, self.h + amount))
7461
7462 update_rgb_space(self)
7463end
7464
7465--- Shift the hue of the color by a given amount, but keep within an upper and lower hue bound.
7466---
7467--- Use negative numbers go to down the spectrum.
7468---
7469--- @param self Color
7470--- @param amount float
7471--- @param lower_bound float
7472--- @param upper_bound float
7473function Color.shift_hue_within(self, amount, lower_bound, upper_bound)
7474 self.h = math.min(upper_bound, math.max(lower_bound, self.h + amount))
7475
7476 update_rgb_space(self)
7477end
7478
7479--- Returns true if hue is below or equal to a given hue.
7480---
7481--- @param self Color
7482--- @param h float
7483function Color.hue_is_below(self, h)
7484 return self.h <= h
7485end
7486
7487--- Returns true if hue is above or equal to a given hue.
7488---
7489--- @param self Color
7490--- @param h float
7491function Color.hue_is_above(self, h)
7492 return self.h >= h
7493end
7494
7495--- Returns true if hue is betwen two given hues.
7496---
7497--- @param self Color
7498--- @param lower_bound float
7499--- @param upper_bound float
7500function Color.hue_is_between(self, lower_bound, upper_bound)
7501 return self.h >= lower_bound and self.h <= upper_bound
7502end
7503
7504--- Returns true if the hue is within a given tolerance at a specific hue value. False if not.
7505---
7506--- @param self Color
7507--- @param h float
7508--- @param tolerance float
7509--- @since 1.2.0-release
7510function Color.hue_is_within_tolerance(self, h, tolerance)
7511 return h <= self.h + tolerance and h >= self.h - tolerance
7512end
7513
7514--- Set the saturation of the color.
7515---
7516--- @param self Color
7517--- @param s float
7518function Color.set_saturation(self, s)
7519 self.s = math.min(1, math.max(0, s))
7520
7521 update_rgb_space(self)
7522end
7523
7524--- Shift the saturation of the color by a given amount.
7525---
7526--- Use negative numbers to decrease saturation.
7527---
7528--- @param self Color
7529--- @param amount float
7530function Color.shift_saturation(self, amount)
7531 self.s = math.min(1, math.max(0, self.s + amount))
7532
7533 update_rgb_space(self)
7534end
7535
7536--- Shift the saturation of the color by a given amount, but keep within an upper and lower saturation bound.
7537---
7538--- Use negative numbers to decrease saturation.
7539---
7540--- @param self Color
7541--- @param amount float
7542function Color.shift_saturation_within(self, amount, lower_bound, upper_bound)
7543 self.s = math.min(upper_bound, math.max(lower_bound, self.s + amount))
7544
7545 update_rgb_space(self)
7546end
7547
7548--- Returns true if saturation is below or equal to a given saturation.
7549---
7550--- @param self Color
7551--- @param s float
7552function Color.saturation_is_below(self, s)
7553 return self.s <= s
7554end
7555
7556--- Returns true if saturation is above or equal to a given saturation.
7557---
7558--- @param self Color
7559--- @param s float
7560function Color.saturation_is_above(self, s)
7561 return self.s >= s
7562end
7563
7564--- Returns true if saturation is betwen two given saturations.
7565---
7566--- @param self Color
7567--- @param lower_bound float
7568--- @param upper_bound float
7569function Color.saturation_is_between(self, lower_bound, upper_bound)
7570 return self.s >= lower_bound and self.s <= upper_bound
7571end
7572
7573--- Returns true if the saturation is within a given tolerance at a specific hue value. False if not.
7574---
7575--- @param self Color
7576--- @param s float
7577--- @param tolerance float
7578--- @since 1.2.0-release
7579function Color.saturation_is_within_tolerance(self, s, tolerance)
7580 return s <= self.s + tolerance and s >= self.s - tolerance
7581end
7582
7583--- Set the lightness of the color.
7584---
7585--- @param self Color
7586--- @param l float
7587function Color.set_lightness(self, l)
7588 self.l = math.min(1, math.max(0, l))
7589
7590 update_rgb_space(self)
7591end
7592
7593--- Shift the lightness of the color within a given amount.
7594---
7595--- Use negative numbers to decrease lightness.
7596---
7597--- @param self Color
7598--- @param amount float
7599function Color.shift_lightness(self, amount)
7600 self.l = math.min(1, math.max(0, self.l + amount))
7601
7602 update_rgb_space(self)
7603end
7604
7605--- Shift the lightness of the color by a given amount, but keep within an upper and lower lightness bound.
7606-----
7607----- Use negative numbers to decrease lightness.
7608---
7609--- @param self Color
7610--- @param amount float
7611function Color.shift_lightness_within(self, amount, lower_bound, upper_bound)
7612 self.l = math.min(upper_bound, math.max(lower_bound, self.l + amount))
7613
7614 update_rgb_space(self)
7615end
7616
7617--- Returns true if lightness is below or equal to a given lightness.
7618---
7619--- @param self Color
7620--- @param l float
7621function Color.lightness_is_below(self, l)
7622 return self.l <= l
7623end
7624
7625--- Returns true if lightness is above or equal to a given lightness.
7626---
7627--- @param self Color
7628--- @param l float
7629function Color.lightness_is_above(self, l)
7630 return self.l >= l
7631end
7632
7633--- Returns true if lightness is betwen two given lightnesses.
7634---
7635--- @param self Color
7636--- @param lower_bound float
7637--- @param upper_bound float
7638function Color.lightness_is_between(self, lower_bound, upper_bound)
7639 return self.l >= lower_bound and self.l <= upper_bound
7640end
7641
7642--- Returns true if the lightness is within a given tolerance at a specific hue value. False if not.
7643---
7644--- @param self Color
7645--- @param l float
7646--- @param tolerance float
7647--- @since 1.2.0-release
7648function Color.lightness_is_within_tolerance(self, l, tolerance)
7649 return l <= self.l + tolerance and l >= self.l - tolerance
7650end
7651
7652--- Sets the alpha of the color.
7653---
7654--- @param self Color
7655--- @param alpha int
7656--- @since 1.1.0-release
7657function Color.set_alpha(self, alpha)
7658 self.a = alpha
7659
7660 validate_rgba(self)
7661end
7662
7663--- Returns true if the color is truely invisible (0 alpha).
7664---
7665--- @param self Color
7666function Color.is_invisible(self)
7667 return self.a == 0
7668end
7669
7670--- Returns true if the color is invisible to within a given tolerance (0-255 alpha).
7671---
7672--- @param self Color
7673--- @param tolerance int
7674function Color.is_invisible_within(self, tolerance)
7675 return self.a <= 0 + tolerance
7676end
7677
7678--- Returns true if the color is truely visible (255 alpha).
7679---
7680--- @param self Color
7681function Color.is_visible(self)
7682 return self.a == 255
7683end
7684
7685--- Returns true if the color is visible to within a given tolerance (0-255 alpha).
7686---
7687--- @param self Color
7688--- @param tolerance int
7689function Color.is_visible_within(self, tolerance)
7690 return self.a >= 255 - tolerance
7691end
7692
7693--- Increase the alpha of the color by a given amount.
7694---
7695--- @param self Color
7696--- @param amount int
7697function Color.fade_in(self, amount)
7698 if (self.a == 255) then
7699 return
7700 end
7701
7702 self.a = self.a + amount
7703
7704 if (self.a > 255) then
7705 self.a = 255
7706 end
7707end
7708
7709--- Decrease the alpha of the color by a given amount.
7710---
7711--- @param self Color
7712--- @param amount int
7713function Color.fade_out(self, amount)
7714 if (self.a == 0) then
7715 return
7716 end
7717
7718 self.a = self.a - amount
7719
7720 if (self.a < 0) then
7721 self.a = 0
7722 end
7723end
7724--endregion
7725--endregion
7726--endregion
7727
7728--region globals
7729-- Screen width.
7730local screen_width, screen_height = client.screen_size()
7731local color = Color.new_rgba(0, 85, 101, 12)
7732--endregion
7733
7734--region ui
7735if (script_menu_location ~= "a" and script_menu_location ~= "b") then
7736 script_menu_location = "a"
7737end
7738
7739local enable_plugin = ui.new_checkbox(
7740 "lua",
7741 script_menu_location,
7742 "Enable Havoc Color Correction"
7743)
7744
7745local ui_color = ui.new_color_picker(
7746 "lua",
7747 script_menu_location,
7748 "| Color",
7749 color.r,
7750 color.g,
7751 color.b,
7752 color.a
7753)
7754
7755ui.set_visible(ui_color, false)
7756
7757local function handle_enable_plugin()
7758 local menu_visible = ui.get(enable_plugin) == true
7759
7760 ui.set_visible(ui_color, menu_visible)
7761end
7762--endregion
7763
7764--region on_paint
7765local function on_paint()
7766 if (ui.get(enable_plugin) == false) then
7767 return
7768 end
7769
7770 renderer.gradient(
7771 0,
7772 0,
7773
7774 screen_width,
7775 screen_height,
7776
7777 color.r,
7778 color.g,
7779 color.b,
7780 color.a,
7781
7782 color.r,
7783 color.g,
7784 color.b,
7785 color.a,
7786
7787 false
7788 )
7789end
7790--endregion
7791
7792--region hooks
7793client.set_event_callback('paint', on_paint)
7794
7795ui.set_callback(enable_plugin, handle_enable_plugin)
7796ui.set_callback(ui_color, function()
7797 color:set_from_ui_color_picker(ui_color)
7798end)
7799--endregion
7800
7801----------------------------------------------------------------------------------
7802-- Caching common functions
7803--------------------------------------------------------------------------------
7804local client_set_event_callback, client_userid_to_entindex, entity_get_local_player, entity_get_prop, renderer_text, renderer_world_to_screen, ui_get, ui_new_checkbox, ui_new_color_picker, globals_curtime = client.set_event_callback, client.userid_to_entindex, entity.get_local_player, entity.get_prop, renderer.text, renderer.world_to_screen, ui.get, ui.new_checkbox, ui.new_color_picker, globals.curtime
7805
7806--------------------------------------------------------------------------------
7807-- Menu
7808--------------------------------------------------------------------------------
7809local headshot_text = ui_new_checkbox("LUA", "A", "Headshot text")
7810local headshot_color = ui_new_color_picker("LUA", "A", "Headshot color", 255, 255, 255, 255)
7811
7812--------------------------------------------------------------------------------
7813-- Constants and variables
7814--------------------------------------------------------------------------------
7815local shot_data = {}
7816
7817--------------------------------------------------------------------------------
7818-- Game event handling
7819--------------------------------------------------------------------------------
7820local function paint()
7821 if not ui_get(headshot_text) then
7822 return
7823 end
7824 local r, g, b = ui_get(headshot_color)
7825 for i=1, #shot_data do
7826 local shot = shot_data[i]
7827 if shot.draw then
7828 if globals_curtime() >= shot.time then
7829 shot.alpha = shot.alpha - 1
7830 end
7831 if shot.alpha <= 0 then
7832 shot.draw = false
7833 end
7834 local sx, sy = renderer_world_to_screen(shot.x, shot.y, shot.z)
7835 if sx ~= nil then
7836 renderer_text(sx, sy, r, g, b, shot.alpha, "cb", 0, "HEADSHOT")
7837 end
7838 end
7839 end
7840end
7841
7842local function player_hurt(e)
7843 if not ui_get(headshot_text) then
7844 return
7845 end
7846 local attacker_entindex = client_userid_to_entindex(e.attacker)
7847 local victim_entindex = client_userid_to_entindex(e.userid)
7848 if attacker_entindex ~= entity_get_local_player() or e.hitgroup ~= 1 then
7849 return
7850 end
7851 local x, y, z = entity_get_prop(victim_entindex, "m_vecOrigin")
7852 local duck_amount = entity_get_prop(victim_entindex, "m_flDuckAmount")
7853 z = z + (46 + (1 - duck_amount) * 18)
7854 shot_data[#shot_data + 1] = {
7855 x = x,
7856 y = y,
7857 z = z,
7858 time = globals_curtime() + 3,
7859 alpha = 255,
7860 draw = true
7861 }
7862end
7863
7864local function round_start()
7865 if not ui_get(headshot_text) then
7866 return
7867 end
7868 shot_data = {}
7869end
7870
7871client_set_event_callback("paint", paint)
7872client_set_event_callback("player_hurt", player_hurt)
7873client_set_event_callback("round_start", round_start)
7874
7875-- Hitrate
7876
7877--local variables for API. Automatically generated by https://github.com/simpleavaster/gslua/blob/master/authors/sapphyrus/generate_api.lua
7878local client_latency, client_log, client_draw_rectangle, client_draw_circle_outline, client_userid_to_entindex, client_draw_indicator, client_draw_gradient, client_set_event_callback, client_screen_size, client_eye_position = client.latency, client.log, client.draw_rectangle, client.draw_circle_outline, client.userid_to_entindex, client.draw_indicator, client.draw_gradient, client.set_event_callback, client.screen_size, client.eye_position
7879local client_draw_circle, client_color_log, client_delay_call, client_draw_text, client_visible, client_exec, client_trace_line, client_set_cvar = client.draw_circle, client.color_log, client.delay_call, client.draw_text, client.visible, client.exec, client.trace_line, client.set_cvar
7880local client_world_to_screen, client_draw_hitboxes, client_get_cvar, client_draw_line, client_camera_angles, client_draw_debug_text, client_random_int, client_random_float = client.world_to_screen, client.draw_hitboxes, client.get_cvar, client.draw_line, client.camera_angles, client.draw_debug_text, client.random_int, client.random_float
7881local entity_get_local_player, entity_is_enemy, entity_get_player_name, entity_get_steam64, entity_get_bounding_box, entity_get_all, entity_set_prop, entity_get_player_weapon = entity.get_local_player, entity.is_enemy, entity.get_player_name, entity.get_steam64, entity.get_bounding_box, entity.get_all, entity.set_prop, entity.get_player_weapon
7882local entity_hitbox_position, entity_get_prop, entity_get_players, entity_get_classname = entity.hitbox_position, entity.get_prop, entity.get_players, entity.get_classname
7883local globals_realtime, globals_absoluteframetime, globals_tickcount, globals_curtime, globals_mapname, globals_tickinterval, globals_framecount, globals_frametime, globals_maxplayers = globals.realtime, globals.absoluteframetime, globals.tickcount, globals.curtime, globals.mapname, globals.tickinterval, globals.framecount, globals.frametime, globals.maxplayers
7884local ui_new_slider, ui_new_combobox, ui_reference, ui_set_visible, ui_is_menu_open, ui_new_color_picker, ui_set_callback, ui_set, ui_new_checkbox, ui_new_hotkey, ui_new_button, ui_new_multiselect, ui_get = ui.new_slider, ui.new_combobox, ui.reference, ui.set_visible, ui.is_menu_open, ui.new_color_picker, ui.set_callback, ui.set, ui.new_checkbox, ui.new_hotkey, ui.new_button, ui.new_multiselect, ui.get
7885local math_ceil, math_tan, math_log10, math_randomseed, math_cos, math_sinh, math_random, math_huge, math_pi, math_max, math_atan2, math_ldexp, math_floor, math_sqrt, math_deg, math_atan, math_fmod = math.ceil, math.tan, math.log10, math.randomseed, math.cos, math.sinh, math.random, math.huge, math.pi, math.max, math.atan2, math.ldexp, math.floor, math.sqrt, math.deg, math.atan, math.fmod
7886local math_acos, math_pow, math_abs, math_min, math_sin, math_frexp, math_log, math_tanh, math_exp, math_modf, math_cosh, math_asin, math_rad = math.acos, math.pow, math.abs, math.min, math.sin, math.frexp, math.log, math.tanh, math.exp, math.modf, math.cosh, math.asin, math.rad
7887local table_maxn, table_foreach, table_sort, table_remove, table_foreachi, table_move, table_getn, table_concat, table_insert = table.maxn, table.foreach, table.sort, table.remove, table.foreachi, table.move, table.getn, table.concat, table.insert
7888local string_find, string_format, string_rep, string_gsub, string_len, string_gmatch, string_dump, string_match, string_reverse, string_byte, string_char, string_upper, string_lower, string_sub = string.find, string.format, string.rep, string.gsub, string.len, string.gmatch, string.dump, string.match, string.reverse, string.byte, string.char, string.upper, string.lower, string.sub
7889--end of local variables
7890
7891
7892local hits = 0
7893local misses = 0
7894local painthitrate = ui_new_checkbox("LUA", "A", "Paint Hitrate")
7895local painthitrate_s = ui_new_slider("LUA", "A", "Paint Hitrate Offset", 0, 1000, 196)
7896local function on_player_hurt(e)
7897 local attacker_id = client_userid_to_entindex(e.attacker)
7898 if attacker_id == nil then
7899 return
7900 end
7901
7902 if attacker_id ~= entity_get_local_player() then
7903 return
7904 end
7905
7906 hits = hits + 1
7907
7908end
7909
7910
7911local function on_aim_miss(e)
7912 misses = misses + 1
7913end
7914
7915local function on_paint(c)
7916 if (ui_get(painthitrate)) then
7917 local scrsize_x, scrsize_y = client_screen_size()
7918 local center_y = scrsize_y / 2
7919 local num = ui_get(painthitrate_s) * 10
7920 local center_x = scrsize_x - num
7921 local total = misses + hits
7922 local hitPercent = hits / total
7923 local fixed = 0
7924 if (hitPercent > 0) then
7925 fixed = hitPercent * 100
7926 fixed = string.format("%2.1f", fixed)
7927 end
7928
7929 client_draw_text(c, center_x + 45, center_y, 150, 200, 60, 255, "+", 0, "hits: ", hits)
7930 client_draw_text(c, center_x + 45, center_y + 20, 150, 200, 60, 255, "+", 0, "misses: ", misses)
7931 client_draw_text(c, center_x + 45, center_y + 40, 150, 200, 60, 255, "+", 0, "total: ", total)
7932 client_draw_text(c, center_x + 45, center_y + 60, 150, 200, 60, 255, "+", 0, "percent: ", fixed, "%")
7933 end
7934
7935end
7936
7937
7938client_set_event_callback('player_hurt', on_player_hurt)
7939client_set_event_callback('aim_miss', on_aim_miss)
7940--on connect reset hits and misses
7941client_set_event_callback("player_connect_full", function(e)
7942 if client.userid_to_entindex(e.userid) ~= entity.get_local_player() then
7943 return
7944 end
7945 misses = 0
7946 hits = 0
7947end)
7948client_set_event_callback("paint", on_paint)
7949
7950-- Hotkey list
7951
7952local ALPHA = 255
7953local dragging = (function()local a={}local b,c,d,e,f,g,h,i,j,k,l,m,n,o;local p={__index={drag=function(self,...)local q,r=self:get()local s,t=a.drag(q,r,...)if q~=s or r~=t then self:set(s,t)end;return s,t end,set=function(self,q,r)local j,k=client.screen_size()ui.set(self.x_reference,q/j*self.res)ui.set(self.y_reference,r/k*self.res)end,get=function(self)local j,k=client.screen_size()return ui.get(self.x_reference)/self.res*j,ui.get(self.y_reference)/self.res*k end}}function a.new(u,v,w,x)x=x or 10000;local j,k=client.screen_size()local y=ui.new_slider("LUA","A",u.." window position",0,x,v/j*x)local z=ui.new_slider("LUA","A","\n"..u.." window position y",0,x,w/k*x)ui.set_visible(y,false)ui.set_visible(z,false)return setmetatable({name=u,x_reference=y,y_reference=z,res=x},p)end;function a.drag(q,r,A,B,C,D,E)if globals.framecount()~=b then c=ui.is_menu_open()f,g=d,e;d,e=ui.mouse_position()i=h;h=client.key_state(0x01)==true;m=l;l={}o=n;n=false;j,k=client.screen_size()end;if c and i~=nil then if(not i or o)and h and f>q and g>r and f<q+A and g<r+B then n=true;q,r=q+d-f,r+e-g;if not D then q=math.max(0,math.min(j-A,q))r=math.max(0,math.min(k-B,r))end end end;table.insert(l,{q,r,A,B})return q,r,A,B end;return a end)()
7954
7955local active = ui.new_checkbox("VISUALS", "Other ESP", "Hotkey list")
7956local color_picker = ui.new_color_picker("VISUALS", "Other ESP", "Hotkey list color picker", 89, 119, 239)
7957local hotkeys_dragging = dragging.new("Hotkeys", 100, 200)
7958
7959local references = { }
7960local hotkey_id = {
7961 "holding",
7962 "toggled",
7963 "disabled"
7964}
7965
7966local function item_count(tab)
7967 if tab == nil then return 0 end
7968 if #tab == 0 then
7969 local val = 0
7970 for k in pairs(tab) do
7971 val = val + 1
7972 end
7973
7974 return val
7975 end
7976
7977 return #tab
7978end
7979
7980local function create_item(tab, container, name, arg, cname)
7981 local collected = { }
7982 local reference = { ui.reference(tab, container, name) }
7983
7984 for i=1, #reference do
7985 if i <= arg then
7986 collected[i] = reference[i]
7987 end
7988 end
7989
7990 references[cname or name] = collected
7991end
7992
7993local function paint_handler()
7994 if not ui.get(active) then
7995 return
7996 end
7997
7998 local m_items = { }
7999 local x_offset, y_offset = 0, 26
8000
8001 for ref in pairs(references) do
8002 local current_ref = references[ref]
8003 local count = item_count(current_ref)
8004
8005 local active = true
8006 local state = { ui.get(current_ref[count]) }
8007
8008 if count > 1 then
8009 active = ui.get(current_ref[1])
8010 end
8011
8012 if active and state[2] ~= 0 and (state[2] == 3 and not state[1] or state[2] ~= 3 and state[1]) then
8013 m_items[ref] = hotkey_id[state[2]]
8014
8015 local ms = renderer.measure_text(nil, ref)
8016
8017 if ms > x_offset then
8018 x_offset = ms
8019 end
8020 end
8021 end
8022
8023 if ui.is_menu_open() then
8024 x_offset = 55
8025 m_items = {
8026 ["menu item"] = "state"
8027 }
8028 end
8029
8030 if item_count(m_items) == 0 then
8031 return
8032 end
8033
8034 -- do stuff
8035 local x, y = hotkeys_dragging:get()
8036 local w, h = 75 + x_offset, 11 + (15*item_count(m_items))
8037
8038 local r, g, b, a = ui.get(color_picker)
8039 local a = ALPHA > a and a or ALPHA
8040
8041 renderer.rectangle(x, y, w, 20, 0, 0, 0, a)
8042 renderer.text(x+5, y+3, 255, 255, 255, 255, "", 0, "Hotkeys")
8043
8044 renderer.rectangle(x, y + 19, w, 2, r, g, b, ALPHA)
8045 renderer.rectangle(x, y + 20, w, h, 17, 17, 17, a)
8046
8047 for key, val in pairs(m_items) do
8048 local key_type = "[" .. val .. "]"
8049
8050 renderer.text(x + 5, y + y_offset, 255, 255, 255, 255, "", 0, key)
8051 renderer.text(x + w - renderer.measure_text(nil, key_type) - 5, y + y_offset, 255, 255, 255, 255, "", 0, key_type)
8052
8053 y_offset = y_offset + 15
8054 end
8055
8056 hotkeys_dragging:drag(w, h*2)
8057end
8058
8059-- Creating menu items
8060create_item("RAGE", "Aimbot", "Force safe point", 1, "Safe point")
8061create_item("RAGE", "Other", "Force body aim", 1)
8062create_item("RAGE", "Other", "Duck peek assist", 1)
8063create_item("RAGE", "Other", "Anti-aim correction override", 1, "Resolver override")
8064create_item("RAGE", "Other", "Double tap", 2)
8065create_item("AA", "Other", "Slow motion", 2)
8066create_item("AA", "Other", "On shot anti-aim", 2)
8067create_item("MISC", "Movement", "Z-Hop", 2)
8068create_item("MISC", "Movement", "Pre-speed", 2)
8069create_item("MISC", "Movement", "Blockbot", 2)
8070create_item("MISC", "Movement", "Jump at edge", 2)
8071create_item("MISC", "Miscellaneous", "Free look", 1)
8072
8073-- create_item("MISC", "Miscellaneous", "Ping spike", 2)
8074create_item("MISC", "Miscellaneous", "Automatic grenade release", 2, "Grenade release")
8075create_item("VISUALS", "Player ESP", "Activation type", 1, "Visuals")
8076
8077client.set_event_callback("paint", paint_handler)
8078
8079-- images
8080local M = {}
8081
8082local renderer_load_svg, renderer_texture, math_floor = renderer.load_svg, renderer.texture, math.floor
8083
8084local image_class = {}
8085local image_mt = {
8086 __index = image_class
8087}
8088
8089local cache = {}
8090
8091function image_class:measure(width, height)
8092 if width == nil and height == nil then
8093 return self.width, self.height
8094 elseif width == nil then
8095 height = height or self.height
8096 local width = math_floor(self.width * (height/self.height))
8097 return width, height
8098 elseif height == nil then
8099 width = width or self.width
8100 local height = math_floor(self.height * (width/self.width))
8101 return width, height
8102 else
8103 return width, height
8104 end
8105end
8106
8107function image_class:draw(x, y, width, height, r, g, b, a, force_same_res_render)
8108 local width, height = self:measure(width, height)
8109 local id = width .. "_" .. height
8110 local texture = self.textures[id]
8111 if texture == nil then
8112 if ({next(self.textures)})[2] == nil or force_same_res_render then
8113 texture = renderer_load_svg(self.svg, width, height)
8114 if texture == nil then
8115 self.textures[id] = -1
8116 error("failed to load svg " .. self.name .. " for " .. width .. "x" .. height)
8117 else
8118 client.log("loaded svg ", self.name, " for ", width, "x", height)
8119 self.textures[id] = texture
8120 end
8121 else
8122 --right now we just choose a random texture (determined by the pairs order aka unordered)
8123 --todo: select the texture with the highest or closest resolution?
8124 texture = ({next(self.textures)})[2]
8125 end
8126 end
8127 if texture == nil or texture == -1 then
8128 return
8129 end
8130 if a > 0 then
8131 renderer_texture(texture, x, y, width, height, r, g, b, a)
8132 end
8133 return width, height
8134end
8135
8136function M.load(data)
8137 local result = {}
8138
8139 if cache[data] == nil then
8140 local header = data[-1]
8141 for image_name, image_data in pairs(data) do
8142 if image_name ~= -1 then
8143 local image = setmetatable({}, image_mt)
8144
8145 --initialize image object
8146 image.name = image_name
8147 image.width = image_data[1]
8148 image.height = image_data[2]
8149
8150 image.svg = image_data[3]
8151 if header ~= nil and image.svg:sub(0, 5) ~= "<?xml" then
8152 image.svg = header .. image.svg
8153 end
8154
8155 image.textures = {}
8156
8157 result[image_name] = image
8158 end
8159 end
8160
8161 cache[data] = result
8162 else
8163 result = cache[data]
8164 end
8165
8166 return result
8167end
8168
8169return M
8170
8171--Jordan Effect
8172
8173--local variables for API. Automatically generated by https://github.com/simpleavaster/gslua/blob/master/authors/sapphyrus/generate_api.lua
8174local client_latency, client_log, client_draw_rectangle, client_draw_circle_outline, client_userid_to_entindex, client_draw_indicator, client_draw_gradient, client_set_event_callback, client_screen_size, client_eye_position = client.latency, client.log, client.draw_rectangle, client.draw_circle_outline, client.userid_to_entindex, client.draw_indicator, client.draw_gradient, client.set_event_callback, client.screen_size, client.eye_position
8175local client_draw_circle, client_color_log, client_delay_call, client_draw_text, client_visible, client_exec, client_trace_line, client_set_cvar = client.draw_circle, client.color_log, client.delay_call, client.draw_text, client.visible, client.exec, client.trace_line, client.set_cvar
8176local client_world_to_screen, client_draw_hitboxes, client_get_cvar, client_draw_line, client_camera_angles, client_draw_debug_text, client_random_int, client_random_float = client.world_to_screen, client.draw_hitboxes, client.get_cvar, client.draw_line, client.camera_angles, client.draw_debug_text, client.random_int, client.random_float
8177local entity_get_local_player, entity_is_enemy, entity_get_player_name, entity_get_steam64, entity_get_bounding_box, entity_get_all, entity_set_prop, entity_get_player_weapon = entity.get_local_player, entity.is_enemy, entity.get_player_name, entity.get_steam64, entity.get_bounding_box, entity.get_all, entity.set_prop, entity.get_player_weapon
8178local entity_hitbox_position, entity_get_prop, entity_get_players, entity_get_classname = entity.hitbox_position, entity.get_prop, entity.get_players, entity.get_classname
8179local globals_realtime, globals_absoluteframetime, globals_tickcount, globals_curtime, globals_mapname, globals_tickinterval, globals_framecount, globals_frametime, globals_maxplayers = globals.realtime, globals.absoluteframetime, globals.tickcount, globals.curtime, globals.mapname, globals.tickinterval, globals.framecount, globals.frametime, globals.maxplayers
8180local ui_new_slider, ui_new_combobox, ui_reference, ui_set_visible, ui_is_menu_open, ui_new_color_picker, ui_set_callback, ui_set, ui_new_checkbox, ui_new_hotkey, ui_new_button, ui_new_multiselect, ui_get = ui.new_slider, ui.new_combobox, ui.reference, ui.set_visible, ui.is_menu_open, ui.new_color_picker, ui.set_callback, ui.set, ui.new_checkbox, ui.new_hotkey, ui.new_button, ui.new_multiselect, ui.get
8181local math_ceil, math_tan, math_log10, math_randomseed, math_cos, math_sinh, math_random, math_huge, math_pi, math_max, math_atan2, math_ldexp, math_floor, math_sqrt, math_deg, math_atan, math_fmod = math.ceil, math.tan, math.log10, math.randomseed, math.cos, math.sinh, math.random, math.huge, math.pi, math.max, math.atan2, math.ldexp, math.floor, math.sqrt, math.deg, math.atan, math.fmod
8182local math_acos, math_pow, math_abs, math_min, math_sin, math_frexp, math_log, math_tanh, math_exp, math_modf, math_cosh, math_asin, math_rad = math.acos, math.pow, math.abs, math.min, math.sin, math.frexp, math.log, math.tanh, math.exp, math.modf, math.cosh, math.asin, math.rad
8183local table_maxn, table_foreach, table_sort, table_remove, table_foreachi, table_move, table_getn, table_concat, table_insert = table.maxn, table.foreach, table.sort, table.remove, table.foreachi, table.move, table.getn, table.concat, table.insert
8184local string_find, string_format, string_rep, string_gsub, string_len, string_gmatch, string_dump, string_match, string_reverse, string_byte, string_char, string_upper, string_lower, string_sub = string.find, string.format, string.rep, string.gsub, string.len, string.gmatch, string.dump, string.match, string.reverse, string.byte, string.char, string.upper, string.lower, string.sub
8185local material_get_model, material_find = materialsystem.get_model_materials, materialsystem.find_material
8186--end of local variables
8187
8188
8189local gui = {
8190 checkbox = ui_new_checkbox("VISUALS", "Effects", "Kill effect"),
8191 slider = ui_new_slider("VISUALS", "Effects", "Kill effect duration", 3, 20, 5, true, "s", 0.1),
8192}
8193
8194
8195local function on_death(e)
8196 if ui_get(gui.checkbox) ~= true then
8197 return
8198 end
8199
8200 local attacker = e.attacker
8201 local attacker_id = client_userid_to_entindex(attacker)
8202 local local_id = entity_get_local_player()
8203
8204 if attacker_id == local_id then
8205 entity_set_prop(local_id, "m_flHealthShotBoostExpirationTime", globals_curtime() + (ui_get(gui.slider) * 0.1))
8206 end
8207end
8208
8209
8210client_set_event_callback("player_death", on_death)
8211
8212--left hand weapon_knife
8213
8214local ui_get = ui.get
8215
8216local get_prop = entity.get_prop
8217local get_local_player = entity.get_local_player
8218local get_entity_weapon = entity.get_player_weapon
8219
8220local knife_lefthand = ui.new_checkbox("MISC", "Miscellaneous", "Knife left hand")
8221
8222local function on_run_command(e)
8223
8224 if not ui_get(knife_lefthand) then
8225 return
8226 end
8227
8228 local local_player = get_local_player()
8229 if local_player ~= nil then
8230
8231 local weapon = get_entity_weapon(local_player)
8232 if weapon ~= nil then
8233
8234 local item = get_prop(weapon, "m_iItemDefinitionIndex")
8235 if item ~= nil then
8236
8237 if(item == 42 or item == 59 or item == 197108 or item == 197113 or item == 197114 or item == 197115 or item == 197116 or item == 197117 or item == 197123 or item == 197120 or item == 197124 or item == 197122 or item == 197127 or item == 197128 or item == 197130 or item == 197131) then
8238 client.exec("cl_righthand 0")
8239 else
8240 client.exec("cl_righthand 1")
8241 end
8242
8243 end
8244 end
8245 end
8246
8247end
8248
8249client.set_event_callback("run_command", on_run_command)
8250
8251-- local player trace_line
8252
8253local ffi = require("ffi")
8254local type=type;local setmetatable=setmetatable;local tostring=tostring;local a=math.pi;local b=math.min;local c=math.max;local d=math.deg;local e=math.rad;local f=math.sqrt;local g=math.sin;local h=math.cos;local i=math.atan;local j=math.acos;local k=math.fmod;local l={}l.__index=l;function Vector3(m,n,o)if type(m)~="number"then m=0.0 end;if type(n)~="number"then n=0.0 end;if type(o)~="number"then o=0.0 end;m=m or 0.0;n=n or 0.0;o=o or 0.0;return setmetatable({x=m,y=n,z=o},l)end;function l.__eq(p,q)return p.x==q.x and p.y==q.y and p.z==q.z end;function l.__unm(p)return Vector3(-p.x,-p.y,-p.z)end;function l.__add(p,q)local r=type(p)local s=type(q)if r=="table"and s=="table"then return Vector3(p.x+q.x,p.y+q.y,p.z+q.z)elseif r=="table"and s=="number"then return Vector3(p.x+q,p.y+q,p.z+q)elseif r=="number"and s=="table"then return Vector3(p+q.x,p+q.y,p+q.z)end end;function l.__sub(p,q)local r=type(p)local s=type(q)if r=="table"and s=="table"then return Vector3(p.x-q.x,p.y-q.y,p.z-q.z)elseif r=="table"and s=="number"then return Vector3(p.x-q,p.y-q,p.z-q)elseif r=="number"and s=="table"then return Vector3(p-q.x,p-q.y,p-q.z)end end;function l.__mul(p,q)local r=type(p)local s=type(q)if r=="table"and s=="table"then return Vector3(p.x*q.x,p.y*q.y,p.z*q.z)elseif r=="table"and s=="number"then return Vector3(p.x*q,p.y*q,p.z*q)elseif r=="number"and s=="table"then return Vector3(p*q.x,p*q.y,p*q.z)end end;function l.__div(p,q)local r=type(p)local s=type(q)if r=="table"and s=="table"then return Vector3(p.x/q.x,p.y/q.y,p.z/q.z)elseif r=="table"and s=="number"then return Vector3(p.x/q,p.y/q,p.z/q)elseif r=="number"and s=="table"then return Vector3(p/q.x,p/q.y,p/q.z)end end;function l.__tostring(p)return"( "..p.x..", "..p.y..", "..p.z.." )"end;function l:clear()self.x=0.0;self.y=0.0;self.z=0.0 end;function l:unpack()return self.x,self.y,self.z end;function l:length_2d_sqr()return self.x*self.x+self.y*self.y end;function l:length_sqr()return self.x*self.x+self.y*self.y+self.z*self.z end;function l:length_2d()return f(self:length_2d_sqr())end;function l:length()return f(self:length_sqr())end;function l:dot(t)return self.x*t.x+self.y*t.y+self.z*t.z end;function l:cross(t)return Vector3(self.y*t.z-self.z*t.y,self.z*t.x-self.x*t.z,self.x*t.y-self.y*t.x)end;function l:dist_to(t)return(t-self):length()end;function l:is_zero(u)u=u or 0.001;if self.x<u and self.x>-u and self.y<u and self.y>-u and self.z<u and self.z>-u then return true end;return false end;function l:normalize()local v=self:length()if v<=0.0 then return 0.0 end;self.x=self.x/v;self.y=self.y/v;self.z=self.z/v;return v end;function l:normalize_no_len()local v=self:length()if v<=0.0 then return end;self.x=self.x/v;self.y=self.y/v;self.z=self.z/v end;function l:normalized()local v=self:length()if v<=0.0 then return Vector3()end;return Vector3(self.x/v,self.y/v,self.z/v)end;function clamp(w,x,y)if w<x then return x elseif w>y then return y end;return w end;function normalize_angle(z)local A;local B;B=tostring(z)if B=="nan"or B=="inf"then return 0.0 end;if z>=-180.0 and z<=180.0 then return z end;A=k(k(z+360.0,360.0),360.0)if A>180.0 then A=A-360.0 end;return A end;function vector_to_angle(C)local v;local D;local E;v=C:length()if v>0.0 then D=d(i(-C.z,v))E=d(i(C.y,C.x))else if C.x>0.0 then D=270.0 else D=90.0 end;E=0.0 end;return Vector3(D,E,0.0)end;function angle_forward(z)local F=g(e(z.x))local G=h(e(z.x))local H=g(e(z.y))local I=h(e(z.y))return Vector3(G*I,G*H,-F)end;function angle_right(z)local F=g(e(z.x))local G=h(e(z.x))local H=g(e(z.y))local I=h(e(z.y))local J=g(e(z.z))local K=h(e(z.z))return Vector3(-1.0*J*F*I+-1.0*K*-H,-1.0*J*F*H+-1.0*K*I,-1.0*J*G)end;function angle_up(z)local F=g(e(z.x))local G=h(e(z.x))local H=g(e(z.y))local I=h(e(z.y))local J=g(e(z.z))local K=h(e(z.z))return Vector3(K*F*I+-J*-H,K*F*H+-J*I,K*G)end;function get_FOV(L,M,N)local O;local P;local Q;local R;P=angle_forward(L)Q=(N-M):normalized()R=j(P:dot(Q)/Q:length())return c(0.0,d(R))end
8255ffi.cdef[[
8256 typedef struct {
8257 float x;
8258 float y;
8259 float z;
8260 }vec3_t;
8261 struct beam_info_t {
8262 int m_type;
8263 void* m_start_ent;
8264 int m_start_attachment;
8265 void* m_end_ent;
8266 int m_end_attachment;
8267 vec3_t m_start;
8268 vec3_t m_end;
8269 int m_model_index;
8270 const char *m_model_name;
8271 int m_halo_index;
8272 const char *m_halo_name;
8273 float m_halo_scale;
8274 float m_life;
8275 float m_width;
8276 float m_end_width;
8277 float m_fade_length;
8278 float m_amplitude;
8279 float m_brightness;
8280 float m_speed;
8281 int m_start_frame;
8282 float m_frame_rate;
8283 float m_red;
8284 float m_green;
8285 float m_blue;
8286 bool m_renderable;
8287 int m_num_segments;
8288 int m_flags;
8289 vec3_t m_center;
8290 float m_start_radius;
8291 float m_end_radius;
8292 };
8293 typedef void (__thiscall* draw_beams_t)(void*, void*);
8294 typedef void*(__thiscall* create_beam_points_t)(void*, struct beam_info_t&);
8295]]
8296
8297local render_beams_signature = "\xB9\xCC\xCC\xCC\xCC\xA1\xCC\xCC\xCC\xCC\xFF\x10\xA1\xCC\xCC\xCC\xCC\xB9"
8298local match = client.find_signature("client_panorama.dll", render_beams_signature) or error("render_beams_signature not found")
8299local render_beams = ffi.cast('void**', ffi.cast("char*", match) + 1)[0] or error("render_beams is nil")
8300local render_beams_class = ffi.cast("void***", render_beams)
8301local render_beams_vtbl = render_beams_class[0]
8302
8303local draw_beams = ffi.cast("draw_beams_t", render_beams_vtbl[6]) or error("couldn't cast draw_beams_t", 2)
8304local create_beam_points = ffi.cast("create_beam_points_t", render_beams_vtbl[12]) or error("couldn't cast create_beam_points_t", 2)
8305
8306local local_player_bullet_beams = ui.new_checkbox("visuals", "Effects", "Local player bullet beams")
8307local local_player_bullet_beams_color = ui.new_color_picker("visuals", "Effects", "Local player bullet beams color", 150, 130, 255, 255)
8308local local_player_bullet_beams_style = ui.new_combobox("visuals", "effects", "\nstyle", {"Skeet", "Beam", "Bubble"})
8309local local_player_bullet_beams_thickness = ui.new_slider("visuals", "effects", "Tracer thickness", 0, 50, 20, true, nil, .1)
8310local local_player_beam_life = ui.new_slider("visuals", "effects", "Beam life", 1, 10)
8311
8312
8313local enemy_bullet_beams = ui.new_checkbox("visuals", "Effects", "Enemy player bullet beams")
8314local enemy_bullet_beams_color = ui.new_color_picker("visuals", "Effects", "Enemy player bullet beams color", 150, 130, 255, 255)
8315local enemy_bullet_beams_style = ui.new_combobox("visuals", "effects", "\nenemystyle", {"Skeet", "Beam", "Bubble"})
8316local enemy_bullet_beams_thickness = ui.new_slider("visuals", "effects", "Enemy tracer thickness", 0, 50, 20, true, nil, .1)
8317local enemy_beam_life = ui.new_slider("visuals", "effects", "Enemy beam life", 1, 10)
8318
8319
8320
8321local local_player_trails = ui.new_checkbox("visuals", "Effects", "Local player trails")
8322local local_player_trails_color = ui.new_color_picker("visuals", "Effects", "Local player trails color", 150, 130, 255, 255)
8323local rainbow = ui.new_checkbox("visuals", "Effects", "Local player rainbow trail")
8324local local_player_trails_height = ui.new_slider("visuals", "effects", "Trail height", 1, 100, 20)
8325local local_player_trails_thickness = ui.new_slider("visuals", "effects", "Trail thickness", 0, 50, 20, true, nil, .1)
8326local local_player_trails_life = ui.new_slider("visuals", "effects", "Trail life", 1, 10)
8327
8328
8329local get_local_player = entity.get_local_player
8330local get_prop = entity.get_prop
8331local userid_to_entindex = client.userid_to_entindex
8332local eye_position = client.eye_position
8333local bor = bit.bor
8334local new = ffi.new
8335local get = ui.get
8336
8337
8338
8339
8340
8341
8342local function updateMenu()
8343 ui.set_visible(local_player_trails_thickness, get(local_player_trails))
8344 ui.set_visible(local_player_trails_color, get(local_player_trails))
8345 ui.set_visible(rainbow, get(local_player_trails))
8346 ui.set_visible(local_player_trails_height, get(local_player_trails))
8347 ui.set_visible(local_player_trails_life, get(local_player_trails))
8348
8349
8350 ui.set_visible(enemy_bullet_beams_color, get(enemy_bullet_beams))
8351 ui.set_visible(enemy_bullet_beams_style, get(enemy_bullet_beams))
8352 ui.set_visible(enemy_bullet_beams_thickness, get(enemy_bullet_beams))
8353 ui.set_visible(enemy_beam_life, get(enemy_bullet_beams))
8354
8355
8356 ui.set_visible(local_player_bullet_beams_color, get(local_player_bullet_beams))
8357 ui.set_visible(local_player_bullet_beams_style, get(local_player_bullet_beams))
8358 ui.set_visible(local_player_bullet_beams_thickness, get(local_player_bullet_beams))
8359 ui.set_visible(local_player_beam_life, get(local_player_bullet_beams))
8360end
8361updateMenu()
8362
8363ui.set_callback(local_player_trails, function() updateMenu() end)
8364ui.set_callback(enemy_bullet_beams, function() updateMenu() end)
8365ui.set_callback(local_player_bullet_beams, function() updateMenu() end)
8366
8367local function create_beams(beamtype, startpos,endpos, red, green, blue, alpha, thicc, dalife)
8368 local beam_info = new("struct beam_info_t")
8369 beam_info.m_type = 0x00
8370 beam_info.m_model_index = -1
8371 beam_info.m_halo_scale = 0
8372
8373 beam_info.m_life = dalife
8374 beam_info.m_fade_length = 1
8375
8376 beam_info.m_width = thicc -- multiplication is faster than division
8377 beam_info.m_end_width = thicc -- multiplication is faster than division
8378
8379 beam_info.m_model_name = beamtype
8380
8381
8382 beam_info.m_amplitude = 2.3
8383 beam_info.m_speed = 0.2
8384
8385 beam_info.m_start_frame = 0
8386 beam_info.m_frame_rate = 0
8387
8388 beam_info.m_red = red
8389 beam_info.m_green = green
8390 beam_info.m_blue = blue
8391 beam_info.m_brightness = alpha
8392
8393 beam_info.m_num_segments = 2
8394 beam_info.m_renderable = true
8395
8396 beam_info.m_flags = bor(0x00000100 + 0x00000200 + 0x00008000)
8397
8398 beam_info.m_start = startpos
8399 beam_info.m_end = endpos
8400
8401 local beam = create_beam_points(render_beams_class, beam_info)
8402 if beam ~= nil then
8403 draw_beams(render_beams, beam)
8404 end
8405end
8406
8407
8408
8409
8410local function hsv_to_rgb(h, s, v, a)
8411 local r, g, b
8412
8413 local i = math.floor(h * 6);
8414 local f = h * 6 - i;
8415 local p = v * (1 - s);
8416 local q = v * (1 - f * s);
8417 local t = v * (1 - (1 - f) * s);
8418
8419 i = i % 6
8420
8421 if i == 0 then r, g, b = v, t, p
8422 elseif i == 1 then r, g, b = q, v, p
8423 elseif i == 2 then r, g, b = p, v, t
8424 elseif i == 3 then r, g, b = p, q, v
8425 elseif i == 4 then r, g, b = t, p, v
8426 elseif i == 5 then r, g, b = v, p, q
8427 end
8428
8429 return r * 255, g * 255, b * 255, a * 255
8430end
8431
8432local function func_rgb_rainbowize(frequency, rgb_split_ratio)
8433 local r, g, b, a = hsv_to_rgb(globals.realtime() * frequency, 1, 1, 1)
8434
8435 r = r * rgb_split_ratio
8436 g = g * rgb_split_ratio
8437 b = b * rgb_split_ratio
8438
8439 return r, g, b
8440end
8441
8442
8443
8444
8445client.set_event_callback("paint", function(c)
8446 if get(local_player_trails) and entity.is_alive(entity.get_local_player()) then
8447
8448 local vx,vy,vz = entity.get_prop(entity.get_local_player(), "m_vecVelocity")
8449 local flVelocity = math.sqrt(vx ^ 2 + vy ^ 2 )
8450 local u = math.sqrt(vz^2)
8451 --client.log(u)
8452 if (flVelocity >= 10 or u >= 1) then
8453 local onground = (bit.band(entity.get_prop(entity.get_local_player(), "m_fFlags"), 1) == 1)
8454 local pos = Vector3(entity.get_prop(entity.get_local_player(), "m_vecAbsOrigin"))
8455 local pos2 = Vector3(entity.get_prop(entity.get_local_player(), "m_vecAbsOrigin"))
8456 local height = get(local_player_trails_height)
8457 pos2.z = pos2.z + height
8458 local r,g,b,a = get(local_player_trails_color)
8459 if (get(rainbow)) then
8460 r, g, b = func_rgb_rainbowize(1, 1)
8461 create_beams("sprites/physbeam.vmt",pos,pos2, r,g,b,a, get(local_player_trails_thickness), get(local_player_trails_life))
8462 else
8463 create_beams("sprites/physbeam.vmt",pos,pos2, r,g,b,a, get(local_player_trails_thickness), get(local_player_trails_life))
8464 end
8465 end
8466 end
8467end)
8468
8469
8470
8471
8472
8473local oldTick = 0
8474client.set_event_callback("bullet_impact", function(e)
8475 if (oldTick < globals.tickcount()) then
8476 oldTick = globals.tickcount()
8477 local beamtype = "sprites/purplelaser1.vmt"
8478 if get(local_player_bullet_beams_style) == "Skeet" then
8479 beamtype = "sprites/purplelaser1.vmt"
8480 elseif get(local_player_bullet_beams_style) == "Beam" then
8481 beamtype = "sprites/physbeam.vmt"
8482 elseif get(local_player_bullet_beams_style) == "Bubble" then
8483 beamtype = "sprites/bubble.vmt"
8484 end
8485 if userid_to_entindex(e.userid) == get_local_player() and get(local_player_bullet_beams) then
8486 local r,g,b,a = get(local_player_bullet_beams_color)
8487 create_beams(beamtype, {e.x, e.y, e.z},Vector3(eye_position()), r, g, b, a, get(local_player_bullet_beams_thickness), get(local_player_beam_life))
8488 end
8489 end
8490 if userid_to_entindex(e.userid) ~= get_local_player() and get(enemy_bullet_beams) and entity.is_enemy(userid_to_entindex(e.userid)) then
8491 local er,eg,eb,ea = get(enemy_bullet_beams_color)
8492 local ebeamtype = "sprites/purplelaser1.vmt"
8493 if get(enemy_bullet_beams_style) == "Skeet" then
8494 ebeamtype = "sprites/purplelaser1.vmt"
8495 elseif get(enemy_bullet_beams_style) == "Beam" then
8496 ebeamtype = "sprites/physbeam.vmt"
8497 elseif get(enemy_bullet_beams_style) == "Bubble" then
8498 ebeamtype = "sprites/bubble.vmt"
8499 end
8500 create_beams(ebeamtype, {e.x, e.y, e.z},Vector3(entity.hitbox_position(client.userid_to_entindex(e.userid), 13)), er,eg,eb,ea, get(enemy_bullet_beams_thickness), get(enemy_beam_life))
8501 end
8502end)
8503
8504client.set_event_callback("player_connect_full", function(e)
8505 if client.userid_to_entindex(e.userid) ~= entity.get_local_player() then
8506 return
8507 end
8508 oldTick = 0
8509end)
8510
8511-- Quick peek
8512
8513-- local variables for API functions. any changes to the line below will be lost on re-generation
8514local client_eye_position, client_set_event_callback, client_userid_to_entindex, entity_get_classname, entity_get_local_player, entity_get_player_weapon, entity_get_prop, entity_is_alive, math_atan2, math_cos, math_deg, math_rad, math_sin, math_sqrt, renderer_line, renderer_triangle, renderer_world_to_screen, ui_get, ui_new_checkbox, ui_new_color_picker, ui_new_hotkey, ui_new_multiselect, ui_new_slider, ui_reference, ui_set, ui_set_callback, ui_set_visible = client.eye_position, client.set_event_callback, client.userid_to_entindex, entity.get_classname, entity.get_local_player, entity.get_player_weapon, entity.get_prop, entity.is_alive, math.atan2, math.cos, math.deg, math.rad, math.sin, math.sqrt, renderer.line, renderer.triangle, renderer.world_to_screen, ui.get, ui.new_checkbox, ui.new_color_picker, ui.new_hotkey, ui.new_multiselect, ui.new_slider, ui.reference, ui.set, ui.set_callback, ui.set_visible
8515
8516local quickstop_reference = ui_reference("RAGE", "Other", "Quick stop")
8517
8518local enabled_reference = ui_new_checkbox("RAGE", "Other", "Quick peek")
8519local hotkey_reference = ui_new_hotkey("RAGE", "Other", "Quick peek hotkey", true)
8520local triggers_reference = ui_new_multiselect("RAGE", "Other", "\nQuick peek triggers", {"X shots", "Kill", "Standing still"})
8521local shots_reference = ui_new_slider("RAGE", "Other", "\nQuick peek shots", 1, 6, 1)
8522local draw_reference = ui_new_checkbox("VISUALS", "Other ESP", "Draw quick peek")
8523local color_reference = ui_new_color_picker("VISUALS", "Other ESP", "Quick peek color", 198, 70, 70, 146)
8524
8525local single_fire_weapons = {
8526 "CDeagle",
8527 "CWeaponSSG08",
8528 "CWeaponAWP"
8529}
8530
8531local function draw_circle_3d(x, y, z, radius, r, g, b, a, accuracy, width, outline, start_degrees, percentage, fill_r, fill_g, fill_b, fill_a)
8532 local accuracy = accuracy ~= nil and accuracy or 3
8533 local width = width ~= nil and width or 1
8534 local outline = outline ~= nil and outline or false
8535 local start_degrees = start_degrees ~= nil and start_degrees or 0
8536 local percentage = percentage ~= nil and percentage or 1
8537
8538 local center_x, center_y
8539 if fill_a then
8540 center_x, center_y = renderer_world_to_screen(x, y, z)
8541 end
8542
8543 local screen_x_line_old, screen_y_line_old
8544 for rot=start_degrees, percentage*360, accuracy do
8545 local rot_temp = math_rad(rot)
8546 local lineX, lineY, lineZ = radius * math_cos(rot_temp) + x, radius * math_sin(rot_temp) + y, z
8547 local screen_x_line, screen_y_line = renderer_world_to_screen(lineX, lineY, lineZ)
8548 if screen_x_line ~=nil and screen_x_line_old ~= nil then
8549 if fill_a and center_x ~= nil then
8550 renderer_triangle(screen_x_line, screen_y_line, screen_x_line_old, screen_y_line_old, center_x, center_y, fill_r, fill_g, fill_b, fill_a)
8551 end
8552 for i=1, width do
8553 local i=i-1
8554 renderer_line(screen_x_line, screen_y_line-i, screen_x_line_old, screen_y_line_old-i, r, g, b, a)
8555 renderer_line(screen_x_line-1, screen_y_line, screen_x_line_old-i, screen_y_line_old, r, g, b, a)
8556 end
8557 if outline then
8558 local outline_a = a/255*160
8559 renderer_line(screen_x_line, screen_y_line-width, screen_x_line_old, screen_y_line_old-width, 16, 16, 16, outline_a)
8560 renderer_line(screen_x_line, screen_y_line+1, screen_x_line_old, screen_y_line_old+1, 16, 16, 16, outline_a)
8561 end
8562 end
8563 screen_x_line_old, screen_y_line_old = screen_x_line, screen_y_line
8564 end
8565end
8566
8567local function distance3d(x1, y1, z1, x2, y2, z2)
8568 return math_sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) + (z2-z1)*(z2-z1))
8569end
8570
8571local function table_contains(tbl, val)
8572 for i = 1, #tbl do
8573 if tbl[i] == val then
8574 return true
8575 end
8576 end
8577 return false
8578end
8579
8580local function vector_angles(x1, y1, z1, x2, y2, z2)
8581 --https://github.com/ValveSoftware/source-sdk-2013/blob/master/sp/src/mathlib/mathlib_base.cpp#L535-L563
8582 local origin_x, origin_y, origin_z
8583 local target_x, target_y, target_z
8584 if x2 == nil then
8585 target_x, target_y, target_z = x1, y1, z1
8586 origin_x, origin_y, origin_z = client_eye_position()
8587 if origin_x == nil then
8588 return
8589 end
8590 else
8591 origin_x, origin_y, origin_z = x1, y1, z1
8592 target_x, target_y, target_z = x2, y2, z2
8593 end
8594
8595 local delta_x, delta_y, delta_z = target_x-origin_x, target_y-origin_y, target_z-origin_z
8596
8597 if delta_x == 0 and delta_y == 0 then
8598 return (delta_z > 0 and 270 or 90), 0
8599 else
8600 local yaw = math_deg(math_atan2(delta_y, delta_x))
8601 local hyp = math_sqrt(delta_x*delta_x + delta_y*delta_y)
8602 local pitch = math_deg(math_atan2(-delta_z, hyp))
8603
8604 return pitch, yaw
8605 end
8606end
8607
8608local hotkey_prev, shots, pos_x, pos_y, pos_z = false, 0
8609local quickstop_prev, quickstop_allowed, standing
8610
8611local function update_visiblity()
8612 local enabled = ui_get(enabled_reference)
8613 ui_set_visible(triggers_reference, enabled)
8614 ui_set_visible(shots_reference, enabled and table_contains(ui_get(triggers_reference), "X shots"))
8615
8616 if not enabled then
8617 hotkey_prev = false
8618 shots = 0
8619 pos_x = nil
8620 end
8621end
8622ui_set_callback(enabled_reference, update_visiblity)
8623ui_set_callback(triggers_reference, update_visiblity)
8624update_visiblity()
8625
8626local function on_paint()
8627 local is_enabled = ui_get(enabled_reference) and ui_get(hotkey_reference) and pos_x ~= nil and entity_is_alive(entity_get_local_player())
8628
8629 if quickstop_allowed or not is_enabled then
8630 if quickstop_prev ~= nil then
8631 ui_set(quickstop_reference, true)
8632 quickstop_prev = nil
8633 end
8634 quickstop_allowed = nil
8635 end
8636
8637 if not is_enabled or not ui_get(draw_reference) then
8638 return
8639 end
8640
8641 local wx, wy = renderer_world_to_screen(pos_x, pos_y, pos_z)
8642
8643 if wx ~= nil then
8644 local r, g, b, a = ui_get(color_reference)
8645 draw_circle_3d(pos_x, pos_y, pos_z, 14, r, g, b, a, 3, 2, false, 0, 1, r, g, b, a*0.6)
8646 end
8647end
8648client_set_event_callback("paint", on_paint)
8649
8650local function on_aim_fire(e)
8651 shots = shots + 1
8652end
8653client_set_event_callback("aim_fire", on_aim_fire)
8654
8655local function on_player_death(e)
8656 if table_contains(ui_get(triggers_reference), "Kill") and client_userid_to_entindex(e.attacker) == entity_get_local_player() then
8657 shots = -1
8658 end
8659end
8660client_set_event_callback("player_death", on_player_death)
8661
8662local function on_setup_command(cmd)
8663 if not ui_get(enabled_reference) then
8664 return
8665 end
8666
8667 local hotkey = ui_get(hotkey_reference)
8668
8669 if hotkey then
8670 local local_player = entity_get_local_player()
8671 if not hotkey_prev then
8672 pos_x, pos_y, pos_z = entity_get_prop(local_player, "m_vecAbsOrigin")
8673 shots = 0
8674 end
8675
8676 if cmd.in_attack == 1 then
8677 shots = -1
8678 end
8679
8680 local is_single_fire_weapon = table_contains(single_fire_weapons, entity_get_classname(entity_get_player_weapon(local_player)))
8681 local shots_min = is_single_fire_weapon and 1 or ui_get(shots_reference)
8682 local triggers = ui_get(triggers_reference)
8683
8684 if table_contains(triggers, "Standing still") then
8685 if not standing and distance3d(0, 0, 0, entity_get_prop(local_player, "m_vecVelocity")) < 15 then
8686 standing = true
8687 elseif cmd.sidemove ~= 0 or cmd.forwardmove ~= 0 then
8688 standing = false
8689 end
8690 else
8691 standing = false
8692 end
8693
8694 if (table_contains(triggers, "X shots") and (shots >= shots_min or shots == -1)) or standing then
8695 local x, y, z = entity_get_prop(local_player, "m_vecAbsOrigin")
8696
8697 if 15 > distance3d(x, y, z, pos_x, pos_y, pos_z) then
8698 shots = 0
8699 quickstop_allowed = true
8700 else
8701 local pitch, yaw = vector_angles(x, y, z, pos_x, pos_y, pos_z)
8702 local require_moving = false
8703 if not require_moving or cmd.forwardmove ~= 0 or cmd.sidemove ~= 0 then
8704 cmd.in_forward = 1
8705 cmd.in_back = 0
8706 cmd.in_moveleft = 0
8707 cmd.in_moveright = 0
8708 cmd.in_speed = 0
8709
8710 cmd.forwardmove = 450
8711 cmd.sidemove = 0
8712
8713 cmd.move_yaw = yaw
8714
8715 if ui_get(quickstop_reference) then
8716 quickstop_prev = true
8717 ui_set(quickstop_reference, false)
8718 end
8719 end
8720 end
8721 else
8722 quickstop_allowed = true
8723 end
8724 else
8725 shots = 0
8726 pos_x = nil
8727 end
8728
8729 hotkey_prev = hotkey
8730end
8731client_set_event_callback("setup_command", on_setup_command)
8732
8733local function on_shutdown()
8734 if quickstop_prev ~= nil then
8735 ui_set(quickstop_reference, true)
8736 quickstop_prev = nil
8737 end
8738end
8739client_set_event_callback("shutdown", on_shutdown)
8740
8741
8742-- PingFPS Speed
8743
8744-- Cache commonly used functions
8745local table_insert, table_remove = table.insert, table.remove
8746local draw_grad, draw_rect, draw_text, get_screen_size, get_latency = client.draw_gradient, client.draw_rectangle, client.draw_text, client.screen_size, client.latency
8747local globals_realtime, globals_absoluteframetime, globals_tickinterval = globals.realtime, globals.absoluteframetime, globals.tickinterval
8748local get_local_player, get_prop = entity.get_local_player, entity.get_prop
8749local min, abs, sqrt, floor = math.min, math.abs, math.sqrt, math.floor
8750
8751-- Declare script variables
8752local frametimes = {}
8753local fps_prev = 0
8754local last_update_time = 0
8755
8756local function accumulate_fps()
8757 local ft = globals_absoluteframetime()
8758 if ft > 0 then
8759 table_insert(frametimes, 1, ft)
8760 end
8761
8762 local count = #frametimes
8763 if count == 0 then
8764 return 0
8765 end
8766
8767 local i, accum = 0, 0
8768 while accum < 0.5 do
8769 i = i + 1
8770 accum = accum + frametimes[i]
8771 if i >= count then
8772 break
8773 end
8774 end
8775 accum = accum / i
8776 while i < count do
8777 i = i + 1
8778 table_remove(frametimes)
8779 end
8780
8781 local fps = 1 / accum
8782 local rt = globals_realtime()
8783 if abs(fps - fps_prev) > 4 or rt - last_update_time > 2 then
8784 fps_prev = fps
8785 last_update_time = rt
8786 else
8787 fps = fps_prev
8788 end
8789
8790 return floor(fps + 0.5)
8791end
8792
8793local function on_paint(ctx)
8794 local fps = accumulate_fps()
8795 local ping = floor(min(1000, get_latency()*1000) + 0.5)
8796 local sw, sh = get_screen_size()
8797
8798 sw = floor(sw*0.5 + 0.5)
8799 sh = sh - 20
8800
8801 draw_grad(ctx, sw-300,sh, 190,20, 30,30,30,0, 30,30,30,220, true)
8802 draw_rect(ctx, sw-110,sh, 220,20, 30,30,30,220)
8803 draw_grad(ctx, sw+110,sh, 190,20, 30,30,30,220, 30,30,30,0, true)
8804 draw_grad(ctx, sw-200,sh, 200,2, 0,0,0,0, 0,0,0,150, true)
8805 draw_grad(ctx, sw,sh, 200,2, 0,0,0,150, 0,0,0,0, true)
8806
8807 sh = sh + 5
8808
8809 local r, g, b
8810 if ping < 40 then
8811 r, g, b = 159, 202, 43
8812 elseif ping < 80 then
8813 r, g, b = 255, 222, 0
8814 else
8815 r, g, b = 255, 0, 60
8816 end
8817 draw_text(ctx, sw-90,sh, r,g,b,255, "r", 0, ping)
8818 draw_text(ctx, sw-84,sh+3, 255,255,255,150, "-", 0, "PING")
8819
8820 local tickrate = 1 / globals_tickinterval()
8821 if fps < tickrate then
8822 r, g, b = 255, 0, 60
8823 else
8824 r, g, b = 159, 202, 43
8825 end
8826 draw_text(ctx, sw-6,sh, r,g,b,255, "r", 0, fps)
8827 draw_text(ctx, sw,sh+3, 255,255,255,150, "-", 0, "FPS")
8828
8829 local vx, vy = get_prop(get_local_player(), "m_vecVelocity")
8830 if vx ~= nil then
8831 draw_text(ctx, sw+74,sh, 255,255,255,255, "r", 0, floor(min(10000, sqrt(vx*vx + vy*vy) + 0.5)))
8832 draw_text(ctx, sw+80,sh+3, 255,255,255,150, "-", 0, "SPEED")
8833 end
8834end
8835
8836client.set_event_callback("paint", on_paint)
8837
8838--Skybox Changer
8839
8840--local variables for API functions. Generated using https://github.com/sapphyrus/gamesense-lua/blob/master/generate_api.lua
8841local client_userid_to_entindex, client_set_event_callback, client_screen_size, client_trace_bullet, client_color_log, client_reload_active_scripts, client_scale_damage, client_get_cvar, client_random_int, client_latency, client_set_clan_tag, client_log, client_timestamp, client_trace_line, client_random_float, client_draw_debug_text, client_delay_call, client_visible, client_exec, client_eye_position, client_set_cvar, client_error_log, client_draw_hitboxes, client_camera_angles, client_open_panorama_context, client_system_time = client.userid_to_entindex, client.set_event_callback, client.screen_size, client.trace_bullet, client.color_log, client.reload_active_scripts, client.scale_damage, client.get_cvar, client.random_int, client.latency, client.set_clan_tag, client.log, client.timestamp, client.trace_line, client.random_float, client.draw_debug_text, client.delay_call, client.visible, client.exec, client.eye_position, client.set_cvar, client.error_log, client.draw_hitboxes, client.camera_angles, client.open_panorama_context, client.system_time
8842local entity_get_player_resource, entity_get_local_player, entity_is_enemy, entity_get_bounding_box, entity_is_dormant, entity_get_steam64, entity_get_player_name, entity_hitbox_position, entity_get_game_rules, entity_get_all, entity_set_prop, entity_is_alive, entity_get_player_weapon, entity_get_prop, entity_get_players, entity_get_classname = entity.get_player_resource, entity.get_local_player, entity.is_enemy, entity.get_bounding_box, entity.is_dormant, entity.get_steam64, entity.get_player_name, entity.hitbox_position, entity.get_game_rules, entity.get_all, entity.set_prop, entity.is_alive, entity.get_player_weapon, entity.get_prop, entity.get_players, entity.get_classname
8843local 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
8844local ui_new_slider, ui_new_combobox, ui_reference, ui_set_visible, ui_new_textbox, ui_new_color_picker, ui_new_checkbox, ui_mouse_position, ui_new_listbox, ui_new_multiselect, ui_is_menu_open, ui_new_hotkey, ui_set, ui_new_button, ui_set_callback, ui_name, ui_get = ui.new_slider, ui.new_combobox, ui.reference, ui.set_visible, ui.new_textbox, ui.new_color_picker, ui.new_checkbox, ui.mouse_position, ui.new_listbox, ui.new_multiselect, ui.is_menu_open, ui.new_hotkey, ui.set, ui.new_button, ui.set_callback, ui.name, ui.get
8845local renderer_load_svg, renderer_circle_outline, renderer_rectangle, renderer_gradient, renderer_circle, renderer_text, renderer_line, renderer_triangle, renderer_measure_text, renderer_world_to_screen, renderer_indicator, renderer_texture = renderer.load_svg, renderer.circle_outline, renderer.rectangle, renderer.gradient, renderer.circle, renderer.text, renderer.line, renderer.triangle, renderer.measure_text, renderer.world_to_screen, renderer.indicator, renderer.texture
8846local math_ceil, math_tan, math_cos, math_sinh, math_pi, math_max, math_atan2, math_floor, math_sqrt, math_deg, math_atan, math_fmod, math_acos, math_pow, math_abs, math_min, math_sin, math_log, math_exp, math_cosh, math_asin, math_rad = math.ceil, math.tan, math.cos, math.sinh, math.pi, math.max, math.atan2, math.floor, math.sqrt, math.deg, math.atan, math.fmod, math.acos, math.pow, math.abs, math.min, math.sin, math.log, math.exp, math.cosh, math.asin, math.rad
8847local table_sort, table_remove, table_concat, table_insert = table.sort, table.remove, table.concat, table.insert
8848local string_find, string_format, string_gsub, string_len, string_gmatch, string_match, string_reverse, string_upper, string_lower, string_sub = string.find, string.format, string.gsub, string.len, string.gmatch, string.match, string.reverse, string.upper, string.lower, string.sub
8849local materialsystem_chams_material, materialsystem_arms_material, materialsystem_find_texture, materialsystem_find_material, materialsystem_override_material, materialsystem_find_materials, materialsystem_get_model_materials = materialsystem.chams_material, materialsystem.arms_material, materialsystem.find_texture, materialsystem.find_material, materialsystem.override_material, materialsystem.find_materials, materialsystem.get_model_materials
8850local ipairs, assert, pairs, next, tostring, tonumber, setmetatable, unpack, type, getmetatable, pcall, error = ipairs, assert, pairs, next, tostring, tonumber, setmetatable, unpack, type, getmetatable, pcall, error
8851--end of local variables
8852
8853local package_searchpath = package.searchpath
8854local function file_exists(filename)
8855 return package_searchpath("", filename) == filename
8856end
8857
8858local function skybox_exists(skybox_name)
8859 return file_exists("./csgo/materials/skybox/" .. skybox_name .. "up.vmt")
8860end
8861
8862local sv_skyname = cvar.sv_skyname
8863local skyboxes = {
8864 ["Tibet"]="cs_tibet",
8865 ["Baggage"]="cs_baggage_skybox_",
8866 ["Monastery"]="embassy",
8867 ["Italy"]="italy",
8868 ["Aztec"]="jungle",
8869 ["Vertigo"]="office",
8870 ["Daylight"]="sky_cs15_daylight01_hdr",
8871 ["Daylight (2)"]="vertigoblue_hdr",
8872 ["Clouds"]="sky_cs15_daylight02_hdr",
8873 ["Clouds (2)"]="vertigo",
8874 ["Gray"]="sky_day02_05_hdr",
8875 ["Clear"]="nukeblank",
8876 ["Canals"]="sky_venice",
8877 ["Cobblestone"]="sky_cs15_daylight03_hdr",
8878 ["Assault"]="sky_cs15_daylight04_hdr",
8879 ["Clouds (Dark)"]="sky_csgo_cloudy01",
8880 ["Night"]="sky_csgo_night02",
8881 ["Night (2)"]="sky_csgo_night02b",
8882 ["Night (Flat)"]="sky_csgo_night_flat",
8883 ["Dusty"]="sky_dust",
8884 ["Rainy"]="vietnam",
8885 ["Custom: Sunrise"]="amethyst",
8886 ["Custom: Galaxy"]="sky_descent",
8887 ["Custom: Galaxy (2)"]="clear_night_sky",
8888 ["Custom: Galaxy (3)"]="otherworld",
8889 ["Custom: Galaxy (4)"]="mpa112",
8890 ["Custom: Clouds (Night)"]="cloudynight",
8891 ["Custom: Ocean"]="dreamyocean",
8892 ["Custom: Grimm Night"]="grimmnight",
8893 ["Custom: Heaven"]="sky051",
8894 ["Custom: Heaven (2)"]="sky081",
8895 ["Custom: Clouds"]="sky091",
8896 ["Custom: Night (Blue)"]="sky561",
8897}
8898
8899local skybox_names = {}
8900for k,v in pairs(skyboxes) do
8901 if k:sub(0, 8) ~= "Custom: " or skybox_exists(v) then
8902 table_insert(skybox_names, k)
8903 end
8904end
8905table_sort(skybox_names)
8906
8907local enabled_reference = ui.new_checkbox("VISUALS", "Effects", "Override skybox")
8908local color_reference = ui.new_color_picker("VISUALS", "Effects", "Override skybox", 255, 255, 255, 255)
8909local skybox_reference = ui.new_listbox("VISUALS", "Effects", "Override skybox name", skybox_names)
8910
8911local enabled_prev, skyname_default = false, nil
8912
8913local function on_color_changed()
8914 local enabled = ui_get(enabled_reference)
8915 if enabled or enabled_prev then
8916 local r, g, b, a = ui_get(color_reference)
8917 if not enabled then
8918 r, g, b, a = 255, 255, 255, 255
8919 end
8920 local materials = materialsystem_find_materials("skybox/")
8921 for i=1, #materials do
8922 materials[i]:color_modulate(r, g, b)
8923 materials[i]:alpha_modulate(a)
8924 end
8925 end
8926end
8927ui.set_callback(color_reference, on_color_changed)
8928
8929local function on_skybox_changed()
8930 local enabled = ui_get(enabled_reference)
8931
8932 ui_set_visible(skybox_reference, enabled)
8933 if enabled then
8934 local skybox = ui_get(skybox_reference)
8935 if type(skybox) == "number" then
8936 skybox = skybox_names[skybox+1]
8937 end
8938
8939 if skyname_default == nil then
8940 skyname_default = sv_skyname:get_string()
8941 end
8942
8943 sv_skyname:set_string(skyboxes[skybox])
8944 --check if new skybox is loaded, if not delay color update
8945 if #(materialsystem_find_materials("skybox/" .. skybox)) == 0 then
8946 client_delay_call(0.05, on_color_changed)
8947 else
8948 on_color_changed()
8949 end
8950 elseif enabled_prev then
8951 if skyname_default ~= nil then
8952 sv_skyname:set_string(skyname_default)
8953 end
8954 end
8955 on_color_changed()
8956 enabled_prev = enabled
8957end
8958ui.set_callback(enabled_reference, on_skybox_changed)
8959ui.set_callback(skybox_reference, on_skybox_changed)
8960on_skybox_changed()
8961
8962local function on_player_connect_full(e)
8963 if client_userid_to_entindex(e.userid) == entity_get_local_player() then
8964 skyname_default = nil
8965 on_skybox_changed()
8966 on_color_changed()
8967 end
8968end
8969client.set_event_callback("player_connect_full", on_player_connect_full)
8970
8971local function on_shutdown()
8972 if skyname_default ~= nil and ui_get(enabled_reference) then
8973 sv_skyname:set_string(skyname_default)
8974 end
8975end
8976client.set_event_callback("shutdown", on_shutdown)
8977
8978
8979--smoke wire frame
8980
8981local function setup_materials(list)
8982 local models = { }
8983
8984 for i=1, #list do
8985 models[i] = {
8986 name = list[i],
8987 data = materialsystem.find_material(list[i])
8988 }
8989 end
8990
8991 return models
8992end
8993
8994local function setup_var(data, in_call)
8995 local ticks_time = function(tick)
8996 return (globals.tickinterval() * tick)
8997 end
8998
8999 if not in_call then
9000 ui.set(data.reference, data.on_call)
9001 client.delay_call(ticks_time(data.time), setup_var, data, true)
9002 else
9003 ui.set(data.reference, data.end_call)
9004 end
9005end
9006
9007local function setup_smokeinfo()
9008 local data, me = 0, entity.get_local_player()
9009 local CSmokeGrenadeProjectile = entity.get_all("CSmokeGrenadeProjectile")
9010
9011 if me == nil or CSmokeGrenadeProjectile == nil then
9012 return
9013 end
9014
9015 for i=1, #CSmokeGrenadeProjectile do
9016 local smoke = CSmokeGrenadeProjectile[i]
9017
9018 if entity.get_prop(smoke, "m_bDidSmokeEffect") == 1 then
9019 data = data + 1
9020 end
9021 end
9022
9023 return data
9024end
9025
9026local function find_across(tab, in_a, key)
9027 for i=1, #tab do
9028 local pr = tab[i][in_a]
9029 if pr ~= nil and pr == key then
9030 return tab[i]
9031 end
9032 end
9033
9034 return nil
9035end
9036
9037local smokes = 0
9038local models = {
9039 "particle/vistasmokev1/vistasmokev1",
9040 "particle/vistasmokev1/vistasmokev1_smokegrenade",
9041 "particle/vistasmokev1/vistasmokev1_emods",
9042 "particle/vistasmokev1/vistasmokev1_emods_impactdust",
9043 "particle/vistasmokev1/vistasmokev1_fire"
9044}
9045
9046local post_data = { "Off", "Wireframe", "Circle" }
9047local ref = ui.reference("VISUALS", "Effects", "Remove smoke grenades")
9048
9049local grenade_effect = ui.new_combobox("VISUALS", "Effects", "Smoke effect", post_data)
9050
9051local net_update = function(force_disable)
9052 local active = force_disable and "Off" or ui.get(grenade_effect)
9053
9054 local smoke_count = setup_smokeinfo()
9055 local materials = setup_materials(models)
9056
9057 local smoke_fire = find_across(materials, "name", "particle/vistasmokev1/vistasmokev1_fire")
9058
9059 if smoke_count ~= smokes then
9060 smokes = smoke_count
9061
9062 if active ~= post_data[1] then
9063 setup_var({
9064 reference = ref, time = 7,
9065 on_call = true, end_call = false
9066 })
9067 end
9068 end
9069
9070 local n_data = active ~= "Off"
9071 local circle = active == post_data[3]
9072
9073 for k, v in pairs(materials) do
9074 local old_val = n_data
9075
9076 if v.name == models[5] and circle then
9077 n_data = false
9078 end
9079
9080 v.data:set_material_var_flag(28, n_data)
9081 v.data:set_material_var_flag(3, n_data)
9082 v.data:set_material_var_flag(2, n_data and circle)
9083
9084 n_data = old_val
9085 end
9086
9087 if smoke_fire ~= nil then
9088 smoke_fire.data:set_material_var_flag(2, n_data and active ~= post_data[3])
9089 end
9090end
9091
9092client.set_event_callback("net_update_end", net_update)
9093client.set_event_callback("shutdown", function()
9094 net_update(true)
9095
9096 if ui.get(grenade_effect) ~= post_data[1] then
9097 ui.set(ref, true)
9098 end
9099end)
9100
9101--viewmodel lua
9102
9103--------------------------------------------------------------------------------
9104-- Caching common functions
9105--------------------------------------------------------------------------------
9106local client_set_event_callback, ui_get, ui_new_checkbox, ui_new_slider, ui_set_callback, ui_set_visible = client.set_event_callback, ui.get, ui.new_checkbox, ui.new_slider, ui.set_callback, ui.set_visible
9107
9108--------------------------------------------------------------------------------
9109-- Constants and variables
9110--------------------------------------------------------------------------------
9111local cvar_fov = cvar.viewmodel_fov
9112local cvar_offset_x = cvar.viewmodel_offset_x
9113local cvar_offset_y = cvar.viewmodel_offset_y
9114local cvar_offset_z = cvar.viewmodel_offset_z
9115
9116local default_fov = 680
9117local default_offset_x = 25
9118local default_offset_y = 0
9119local default_offset_z = -15
9120
9121--------------------------------------------------------------------------------
9122-- Viewmodel functions
9123--------------------------------------------------------------------------------
9124local function set_viewmodel(fov, x, y, z)
9125 cvar_fov:set_raw_float(fov * 0.1)
9126 cvar_offset_x:set_raw_float(x * 0.1)
9127 cvar_offset_y:set_raw_float(y * 0.1)
9128 cvar_offset_z:set_raw_float(z * 0.1)
9129end
9130
9131--------------------------------------------------------------------------------
9132-- Menu
9133--------------------------------------------------------------------------------
9134local viewmodel_changer = ui_new_checkbox("LUA", "B", "Viewmodel changer")
9135local viewmodel_fov = ui_new_slider("LUA", "B", "Offset fov", -1800, 1800, default_fov, true, nil, 0.1)
9136local viewmodel_offset_x = ui_new_slider("LUA", "B", "Offset x", -1800, 1800, default_offset_x, true, nil, 0.1)
9137local viewmodel_offset_y = ui_new_slider("LUA", "B", "Offset y", -1800, 1800, default_offset_y, true, nil, 0.1)
9138local viewmodel_offset_z = ui_new_slider("LUA", "B", "Offset z", -1800, 1800, default_offset_z, true, nil, 0.1)
9139
9140local function handle_viewmodel()
9141 local offset_fov = ui_get(viewmodel_fov)
9142 local offset_x = ui_get(viewmodel_offset_x)
9143 local offset_y = ui_get(viewmodel_offset_y)
9144 local offset_z = ui_get(viewmodel_offset_z)
9145 set_viewmodel(offset_fov, offset_x, offset_y, offset_z)
9146end
9147
9148ui_set_callback(viewmodel_fov, handle_viewmodel)
9149ui_set_callback(viewmodel_offset_x, handle_viewmodel)
9150ui_set_callback(viewmodel_offset_y, handle_viewmodel)
9151ui_set_callback(viewmodel_offset_z, handle_viewmodel)
9152
9153local function handle_menu()
9154 local state = ui_get(viewmodel_changer)
9155 ui_set_visible(viewmodel_fov, state)
9156 ui_set_visible(viewmodel_offset_x, state)
9157 ui_set_visible(viewmodel_offset_y, state)
9158 ui_set_visible(viewmodel_offset_z, state)
9159 if not state then
9160 set_viewmodel(default_fov, default_offset_x, default_offset_y, default_offset_z)
9161 else
9162 handle_viewmodel()
9163 end
9164end
9165
9166handle_menu()
9167ui_set_callback(viewmodel_changer, handle_menu)
9168
9169--------------------------------------------------------------------------------
9170-- Event handling
9171--------------------------------------------------------------------------------
9172local function shutdown()
9173 set_viewmodel(default_fov, default_offset_x, default_offset_y, default_offset_z)
9174end
9175
9176client_set_event_callback("shutdown", shutdown)
9177
9178--Zeus range
9179
9180--local variables for API. Automatically generated by https://github.com/simpleavaster/gslua/blob/master/authors/sapphyrus/generate_api.lua
9181local client_latency, client_log, client_draw_rectangle, client_draw_circle_outline, client_userid_to_entindex, client_draw_gradient, client_set_event_callback, client_screen_size, client_eye_position, client_color_log = client.latency, client.log, client.draw_rectangle, client.draw_circle_outline, client.userid_to_entindex, client.draw_gradient, client.set_event_callback, client.screen_size, client.eye_position, client.color_log
9182local client_draw_circle, client_draw_text, client_visible, client_exec, client_delay_call, client_trace_line, client_world_to_screen, client_draw_hitboxes = client.draw_circle, client.draw_text, client.visible, client.exec, client.delay_call, client.trace_line, client.world_to_screen, client.draw_hitboxes
9183local client_get_cvar, client_draw_line, client_camera_angles, client_draw_debug_text, client_random_int, client_random_float = client.get_cvar, client.draw_line, client.camera_angles, client.draw_debug_text, client.random_int, client.random_float
9184local entity_get_local_player, entity_is_enemy, entity_get_player_name, entity_get_all, entity_set_prop, entity_get_player_weapon, entity_hitbox_position, entity_get_prop, entity_get_players, entity_get_classname = entity.get_local_player, entity.is_enemy, entity.get_player_name, entity.get_all, entity.set_prop, entity.get_player_weapon, entity.hitbox_position, entity.get_prop, entity.get_players, entity.get_classname
9185local globals_mapname, globals_tickcount, globals_realtime, globals_absoluteframetime, globals_tickinterval, globals_curtime, globals_frametime, globals_maxplayers = globals.mapname, globals.tickcount, globals.realtime, globals.absoluteframetime, globals.tickinterval, globals.curtime, globals.frametime, globals.maxplayers
9186local ui_new_slider, ui_new_combobox, ui_reference, ui_set_visible, ui_new_color_picker, ui_set_callback, ui_set, ui_new_checkbox, ui_new_hotkey, ui_new_button, ui_new_multiselect, ui_get = ui.new_slider, ui.new_combobox, ui.reference, ui.set_visible, ui.new_color_picker, ui.set_callback, ui.set, ui.new_checkbox, ui.new_hotkey, ui.new_button, ui.new_multiselect, ui.get
9187local math_ceil, math_tan, math_correctRadians, math_fact, math_log10, math_randomseed, math_cos, math_sinh, math_random, math_huge, math_pi, math_max, math_atan2, math_ldexp, math_floor, math_sqrt, math_deg, math_atan = math.ceil, math.tan, math.correctRadians, math.fact, math.log10, math.randomseed, math.cos, math.sinh, math.random, math.huge, math.pi, math.max, math.atan2, math.ldexp, math.floor, math.sqrt, math.deg, math.atan
9188local math_fmod, math_acos, math_pow, math_abs, math_min, math_sin, math_frexp, math_log, math_tanh, math_exp, math_modf, math_cosh, math_asin, math_rad = math.fmod, math.acos, math.pow, math.abs, math.min, math.sin, math.frexp, math.log, math.tanh, math.exp, math.modf, math.cosh, math.asin, math.rad
9189local table_maxn, table_foreach, table_sort, table_remove, table_foreachi, table_move, table_getn, table_concat, table_insert = table.maxn, table.foreach, table.sort, table.remove, table.foreachi, table.move, table.getn, table.concat, table.insert
9190local string_find, string_format, string_rep, string_gsub, string_len, string_gmatch, string_dump, string_match, string_reverse, string_byte, string_char, string_upper, string_lower, string_sub = string.find, string.format, string.rep, string.gsub, string.len, string.gmatch, string.dump, string.match, string.reverse, string.byte, string.char, string.upper, string.lower, string.sub
9191--end of local variables
9192
9193local function draw_circle_3d(ctx, x, y, z, radius, r, g, b, a, accuracy)
9194 local accuracy = accuracy or 3
9195 local screen_x_line_old, screen_y_line_old
9196 for rot=0, 360,accuracy do
9197 local rot_temp = math_rad(rot)
9198 local lineX, lineY, lineZ = radius * math_cos(rot_temp) + x, radius * math_sin(rot_temp) + y, z
9199 local screen_x_line, screen_y_line = client.world_to_screen(ctx, lineX, lineY, lineZ)
9200 if screen_x_line ~=nil and screen_x_line_old ~= nil then
9201 client_draw_line(ctx, screen_x_line, screen_y_line, screen_x_line_old, screen_y_line_old, r, g, b, a)
9202 end
9203 screen_x_line_old, screen_y_line_old = screen_x_line, screen_y_line
9204 end
9205end
9206
9207local function hsv_to_rgb(h, s, v, a)
9208 local r, g, b
9209
9210 local i = math_floor(h * 6);
9211 local f = h * 6 - i;
9212 local p = v * (1 - s);
9213 local q = v * (1 - f * s);
9214 local t = v * (1 - (1 - f) * s);
9215
9216 i = i % 6
9217
9218 if i == 0 then r, g, b = v, t, p
9219 elseif i == 1 then r, g, b = q, v, p
9220 elseif i == 2 then r, g, b = p, v, t
9221 elseif i == 3 then r, g, b = p, q, v
9222 elseif i == 4 then r, g, b = t, p, v
9223 elseif i == 5 then r, g, b = v, p, q
9224 end
9225
9226 return r * 255, g * 255, b * 255, a * 255
9227end
9228
9229local enabled_reference = ui.new_checkbox("VISUALS", "Other ESP", "Visualize Taser range")
9230
9231local had_taser = false
9232local weapon_name_prev = nil
9233local last_switch = 0
9234local accuracy = 2.5
9235
9236local function on_paint(ctx)
9237 if not ui_get(enabled_reference) then
9238 return
9239 end
9240
9241 local local_player = entity_get_local_player()
9242 local curtime = globals_curtime()
9243
9244 local weapon = entity_get_player_weapon(local_player)
9245 local weapon_name = entity_get_classname(weapon)
9246
9247 if weapon_name ~= weapon_name_prev then
9248 if weapon_name ~= "CWeaponTaser" and weapon_name_prev == "CWeaponTaser" then
9249 had_taser = true
9250 else
9251 had_taser = false
9252 end
9253 last_switch = curtime
9254 end
9255
9256 local ranges
9257 local ranges_opacities
9258 if weapon_name == "CWeaponTaser" or had_taser then
9259 ranges = {183-16}
9260 ranges_opacities = {1}
9261 --elseif weapon_name == "CKnife" then
9262 -- ranges = {32, 48}
9263 -- ranges_opacities = {1, 0.2}
9264 end
9265
9266 if ranges == nil then
9267 return
9268 end
9269
9270 local local_x, local_y, local_z = entity_get_prop(local_player, "m_vecOrigin")
9271 local vo_z = entity_get_prop(local_player, "m_vecViewOffset[2]")-4
9272
9273 local fade_multiplier
9274 if curtime - last_switch < 0.3 then
9275 fade_multiplier = (curtime - last_switch) * 1/0.3
9276 else
9277 fade_multiplier = 1
9278 end
9279
9280 if weapon_name ~= "CWeaponTaser" and had_taser then
9281 fade_multiplier = 1 - fade_multiplier
9282 end
9283
9284 for i=1, #ranges do
9285 local range = ranges[i]
9286 local opacity_multiplier = ranges_opacities[i] * fade_multiplier
9287
9288 local previous_world_x, previous_world_y
9289
9290 for rot=0, 360, accuracy do
9291 local rot_temp = math_rad(rot)
9292 local temp_x, temp_y, temp_z = local_x + range * math_cos(rot_temp), local_y + range * math_sin(rot_temp), local_z
9293 local fraction = client_trace_line(local_player, local_x, local_y, local_z+vo_z, temp_x, temp_y, local_z+vo_z)
9294
9295 local fraction_x, fraction_y = local_x+(temp_x-local_x)*fraction, local_y+(temp_y-local_y)*fraction
9296 local world_x, world_y = client_world_to_screen(ctx, fraction_x, fraction_y, temp_z+vo_z)
9297
9298 local hue_extra = globals_realtime() % 8 / 8
9299 local r, g, b = hsv_to_rgb(rot/360+hue_extra, 1, 1, 255)
9300
9301 local fraction_multiplier = 1
9302 if fraction > 0.9 then
9303 fraction_multiplier = 0.6
9304 end
9305
9306 if world_x ~= nil and previous_world_x ~= nil then
9307 client_draw_line(ctx, world_x, world_y, previous_world_x, previous_world_y, r, g, b, 255*opacity_multiplier*fraction_multiplier)
9308 end
9309 previous_world_x, previous_world_y = world_x, world_y
9310 end
9311 end
9312
9313 weapon_name_prev = weapon_name
9314end
9315
9316client.set_event_callback("paint", on_paint)
9317
9318--to finish off use zeus havoc warning lua and config and helper lua and config to finally complete the process.
9319
9320--made by convict for can's configs.