· 5 years ago · Dec 12, 2020, 02:02 PM
1--#region Dependencies
2--#region Api
3local ClientUnsetEventCallback, ClientUserIDToEntIndex, ClientSetEventCallback, ClientScreenSize, ClientTraceBullet, ClienUnsetEventCallback, ClientColorLog, ClientReloadActiveScripts, ClientScaleDamage, ClientGetCvar, ClientCameraPosition, ClientCreateInterface, ClientRandomInt, ClientLatency, ClientSetClanTag, ClientFindSignature, ClientLog, ClientTimestamp, ClientDelayCall, ClientTraceLine, ClientRegisterEspFlag, ClientGetModelName, ClientSystemTime, ClientVisible, ClientExec, ClientKeyState, ClientSetCvar, ClientUnixTime, ClientErrorLog, ClientDrawDebugText, ClientUpdatePlayerList, ClientCameraAngles, ClientEyePosition, ClientDrawHitboxes, ClientRandomFloat = client.unset_event_callback, client.userid_to_entindex, client.set_event_callback, client.screen_size, client.trace_bullet, client.unset_event_callback, client.color_log, client.reload_active_scripts, client.scale_damage, client.get_cvar, client.camera_position, client.create_interface, client.random_int, client.latency, client.set_clan_tag, client.find_signature, client.log, client.timestamp, client.delay_call, client.trace_line, client.register_esp_flag, client.get_model_name, client.system_time, client.visible, client.exec, client.key_state, client.set_cvar, client.unix_time, client.error_log, client.draw_debug_text, client.update_player_list, client.camera_angles, client.eye_position, client.draw_hitboxes, client.random_float
4local EntityGetLocalPlayer, EntityIsEnemy, EntityGetBoundingBox, EntityGetAll, EntitySetProp, EntityIsAlive, EntityGetSteam64, EntityGetClassName, EntityGetPlayerResource, EntityGetESPData, EntityIsDormant, EntityGetPlayerName, EntityGetGameRules, EntityGetOrigin, EntityHitboxPosition, EntityGetPlayerWeapon, EntityGetPlayers, EntityGetProp = entity.get_local_player, entity.is_enemy, entity.get_bounding_box, entity.get_all, entity.set_prop, entity.is_alive, entity.get_steam64, entity.get_classname, entity.get_player_resource, entity.get_esp_data, entity.is_dormant, entity.get_player_name, entity.get_game_rules, entity.get_origin, entity.hitbox_position, entity.get_player_weapon, entity.get_players, entity.get_prop
5local GlobalsRealtime, GlobalsAbsoluteTimeframe, GlobalsChokedCommands, GlobalsOldCommandAck, GlobalsTickcount, GlobalsCommandAck, GlobalsLastOutgoingCommand, GlobalsCurtime, GlobalsMapname, GlobalsTickInterval, GlobalsFramecount, GlobalsFrametime, GlobalsMaxPlayers = globals.realtime, globals.absoluteframetime, globals.chokedcommands, globals.oldcommandack, globals.tickcount, globals.commandack, globals.lastoutgoingcommand, globals.curtime, globals.mapname, globals.tickinterval, globals.framecount, globals.frametime, globals.maxplayers
6local UINewSlider, UINewCombobox, UIReference, UISetVisible, UINewTextbox, UINewColorPicker, UINewCheckbox, UIMousePosition, UINewListbox, UINewMultiselect, UIMenuOpen, UINewHotkey, UISet, UIUpdate, UIMenuSize, UIName, UIMenuPosition, UISetCallback, UINewButton, UINewLabel, UINewString, UIGet = 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.update, ui.menu_size, ui.name, ui.menu_position, ui.set_callback, ui.new_button, ui.new_label, ui.new_string, ui.get
7local RendererGetTextSize, RendererDrawLocalizedText, RendererCircleOutline, RendererWorldToScreen, RendererLine, RendererDrawOutlinedRect, RendererLoadRGBA, RendererTexture, RendererDrawText, RendererTestFont, RendererGradient, RendererDrawFilledRect, RendererDrawFilledOutlinedRect, RendererLoadSVG, RendererLocalizeString, RendererSetMousePos, RendererLoadJPG, RendererUnlockCursor, renderer_load_png, renderer_draw_poly_line, RendererCreateFont, RendererTriangle, RendererRectangle, RendererGetMousePos, RendererText, RendererCircle, RendererIndicator, RendererDrawFilledGradientRect, RendererDrawLine, RendereMeasureText, RendererLoadTexture, RendererDrawOutlinedCircle, RendererLockCursor = renderer.get_text_size, renderer.draw_localized_text, renderer.circle_outline, renderer.world_to_screen, renderer.line, renderer.draw_outlined_rect, renderer.load_rgba, renderer.texture, renderer.draw_text, renderer.test_font, renderer.gradient, renderer.draw_filled_rect, renderer.draw_filled_outlined_rect, renderer.load_svg, renderer.localize_string, renderer.set_mouse_pos, renderer.load_jpg, renderer.unlock_cursor, renderer.load_png, renderer.draw_poly_line, renderer.create_font, renderer.triangle, renderer.rectangle, renderer.get_mouse_pos, renderer.text, renderer.circle, renderer.indicator, renderer.draw_filled_gradient_rect, renderer.draw_line, renderer.measure_text, renderer.load_texture, renderer.draw_outlined_circle, renderer.lock_cursor
8local MathCeil, MathTan, MathCos, MathSinh, MathPI, MathMax, MathAtan2, MathFloor, MathSqrt, MathDeg, MathAtan, MathFmod, MathAcos, MathPow, MathAbs, MathMin, MathSin, MathLog, MathExp, MathCosh, MathAsin, MathRad = 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
9local TableClear, TableSort, TableRemove, TableConcat, TableInsert, BitBand = table.clear, table.sort, table.remove, table.concat, table.insert, bit.band
10local StringFind, StringFormat, StringLen, StringGsub, StringGmatch, StringMatch, StringReverse, StringUpper, StringLower, StringSub = string.find, string.format, string.len, string.gsub, string.gmatch, string.match, string.reverse, string.upper, string.lower, string.sub
11--#endregion
12--#endregion
13
14--#region Variables & Constants
15local Menu = { "lua", "A" }
16
17local WeaponGroups, WeaponInfo = {}, {}
18local ActiveKey
19local CachedKey = "Global"
20
21local Labels = {
22 Damage = { [0] = "Auto" },
23 HitChance = { [0] = "Off" },
24 Multipoint = { [24] = "Auto" }
25}
26
27local Exceptions = {
28 "CKnife",
29 "CSmokeGrenade",
30 "CFlashbang",
31 "CHEGrenade",
32 "CDecoyGrenade",
33 "CIncendiaryGrenade",
34 "CMolotovGrenade",
35 "CC4"
36}
37
38local DoubletapKeyMode = "Toggle"
39local FreestandingKeyMode = "Toggle"
40
41local function GenerateLabels() for I = 1, 26 do Labels.Damage[100 + I] = StringFormat("HP + %s", I) end end
42GenerateLabels()
43--#endregion
44
45--#region Helpers & Utility
46
47local Helpers = {
48 Contains = function(tab, val)
49 for I=1, #tab do
50 if tab[I] == val then
51 return true
52 end
53 end
54
55 return false
56 end,
57 MultiExecute = function(func, list)
58 if func == nil then
59 return
60 end
61
62 for R, V in pairs(list) do
63 func(R, V)
64 end
65 end,
66 FixMultiselect = function(elem, value)
67 local Num = UIGet(elem)
68
69 if #Num == 0 then
70 UISet(elem, value)
71 end
72 end
73}
74
75local MathHelpers = {
76 DistanceTo = function(xyz1, xyz2)
77 local From = MathSqrt(xyz1[1]*xyz1[1]) + MathSqrt(xyz1[2]*xyz1[2]) + MathSqrt(xyz1[3]*xyz1[3])
78 local To = MathSqrt(xyz2[1]*xyz2[1]) + MathSqrt(xyz2[2]*xyz2[2]) + MathSqrt(xyz2[3]*xyz2[3])
79
80 return (From - To)
81 end,
82 UnitsToFeet = function(units)
83 local Meters = MathFloor((units * 0.0254) + 0.5)
84
85 return MathFloor((Meters * 3.281) + 0.5)
86 end,
87 OnGround = function(entindex)
88 return (BitBand(EntityGetProp(entindex, "m_fFlags"), 1) ~= 0)
89 end
90}
91
92local WeaponHelpers = {
93 GetWeaponGroups = function()
94 local N = 1
95 local TempTab = {}
96
97 for K, _ in pairs(WeaponGroups) do
98 TempTab[N] = K
99 N = N + 1
100 end
101
102 return TempTab
103 end,
104 GetWeaponKey = function(idx)
105 for K, V in pairs(WeaponGroups) do
106 if Helpers.Contains(V, idx) then
107 return K
108 end
109 end
110 return "Global"
111 end
112}
113--#endregion
114--#region Entity Functions
115local function HitboxVisible(entindex, secure)
116 if secure == nil or secure then
117 secure = 8;
118 else
119 secure = 18;
120 end
121
122
123 for i=0, secure do
124 local HitboxPos = { EntityHitboxPosition(entindex, i) }
125 if ClientVisible(HitboxPos[1], HitboxPos[2], HitboxPos[3]) then
126 return true
127 end
128 end
129
130 return false;
131end
132
133local function PlayerVisible()
134 local Players = EntityGetPlayers(true)
135
136 if #Players == 0 then
137 return
138 end
139
140 for i=1, #Players do
141 if(HitboxVisible(Players[i])) then
142 return true
143 end
144 end
145
146 return false
147end
148
149local function GetClosestEnemy()
150 local LocalOrigin = { EntityGetOrigin(EntityGetLocalPlayer()) }
151 local NearestDistance, NearestEntity
152 local Players = EntityGetPlayers(true)
153
154 if #Players == 0 then
155 return
156 end
157
158 for i=1, #Players do
159 local Player = Players[i]
160
161 local TargetOrigin = { EntityGetOrigin(Player) }
162 local DistanceToTarget = MathHelpers.DistanceTo(LocalOrigin, TargetOrigin)
163
164 if NearestDistance == nil or DistanceToTarget < NearestDistance then
165 NearestEntity = Player
166 NearestDistance = DistanceToTarget
167 end
168
169 if NearestDistance and NearestEntity then
170 return NearestEntity, MathHelpers.UnitsToFeet(NearestDistance)
171 end
172 end
173
174 return nil, 0
175end
176--#endregion
177--#region Menu & References
178local Ctrl = {
179 MasterSwitch = UINewCheckbox(Menu[1], Menu[2], "Adaptive weapons"),
180 MasterColor = UINewColorPicker(Menu[1], Menu[2], "global_clr", 255, 255, 255, 255),
181 NoscopeKey = UINewHotkey(Menu[1], Menu[2], "Noscope override key"),
182 DamageKey = UINewHotkey(Menu[1], Menu[2], "Damage override key"),
183 CurrentWeapon
184}
185
186local Multipoint, _, MpStrenght = UIReference("rage", "Aimbot", "Multi-point")
187
188local Reference = {
189 Selection = UIReference("rage", "Aimbot", "Target selection"),
190 Hitbox = UIReference("rage", "Aimbot", "Target hitbox"),
191 Multipoint = Multipoint,
192 MultipointScale = UIReference("rage", "Aimbot", "Multi-point scale"),
193 PreferSafe = UIReference("rage", "Aimbot", "Prefer safe point"),
194 AvoidHitbox = UIReference("rage", "Aimbot", "Avoid unsafe hitboxes"),
195 HitChance = UIReference("rage", "Aimbot", "Minimum hit chance"),
196 Damage = UIReference("rage", "Aimbot", "Minimum damage"),
197 Boost = UIReference("rage", "Other", "Accuracy boost"),
198 Delay = UIReference("rage", "Other", "Delay shot"),
199 Stop = UIReference("rage", "Other", "Quick stop"),
200 StopOptions = UIReference("rage", "Other", "Quick stop options"),
201 BaimPeek = UIReference("rage", "Other", "Force body aim on peek"),
202 Baim = UIReference("rage", "Other", "Prefer body aim"),
203 BaimDisablers = UIReference("rage", "Other", "Prefer body aim disablers"),
204 Doubletap = UIReference("rage", "Other", "Double tap"),
205 DoubletapStop = UIReference("rage", "Other", "Double tap quick stop"),
206 AutoScope = UIReference("rage", "Aimbot", "Automatic scope"),
207 AutoPenetration = UIReference("rage", "Aimbot", "Automatic penetration"),
208 SilentAim = UIReference("rage", "Aimbot", "Silent aim"),
209 AutoFire = UIReference("rage", "Aimbot", "Automatic fire")
210}
211
212local FakeDuckRef = UIReference("rage", "Other", "Duck peek assist")
213local DoubletapRef = { UIReference("rage", "Other", "Double tap") }
214local QuickPeekRef = { UIReference("rage", "Other", "Quick peek assist") }
215local FreestandingRef = { UIReference("aa", "Anti-aimbot angles", "Freestanding") }
216
217local function GenerateWeaponControls()
218 for Name in pairs(WeaponGroups) do
219 WeaponInfo[Name] = {
220 Enabled = UINewCheckbox(Menu[1], Menu[2], StringFormat("[%s] Enabled", Name)),
221 Selection = UINewCombobox(Menu[1], Menu[2], StringFormat("[%s] Target selection", Name), {"Cycle","Cycle (2x)", "Near crosshair", "Highest damage", "Lowest ping", "Best K/result ratio", "Best hit chance"}),
222 Hitbox = UINewMultiselect(Menu[1], Menu[2], StringFormat("[%s] Target hitbox", Name), {"Head", "Chest", "Stomach", "Arms", "Legs", "Feet"}),
223 Multipoint = UINewMultiselect(Menu[1], Menu[2], StringFormat("[%s] Multi-point", Name), {"Head", "Chest", "Stomach", "Arms", "Legs", "Feet"}),
224 MultipointScale = UINewSlider(Menu[1], Menu[2], StringFormat("[%s] Multi-point scale", Name), 24, 100, 65, true, "%", 1, Labels.Multipoint),
225 PreferSafe = UINewCheckbox(Menu[1], Menu[2], StringFormat("[%s] Prefer safe point", Name)),
226 AvoidHitbox = UINewCheckbox(Menu[1], Menu[2], StringFormat("[%s] Avoid unsafe hitboxes", Name), {"Head", "Chest", "Stomach", "Arms", "Legs"}),
227 HitChance = UINewSlider(Menu[1], Menu[2], StringFormat("[%s] Minimum hit chance", Name), 0, 100, 60, true, "%", 1, Labels.HitChance),
228 Damage = UINewSlider(Menu[1], Menu[2], StringFormat("[%s] Minimum damage", Name), 0, 124, 20, true, "\n", 1, Labels.Damage),
229 Visible = UINewSlider(Menu[1], Menu[2], StringFormat("[%s] Visible damage", Name), 0, 124, 20, true, "\n", 1, Labels.Damage),
230 DamageOverride = UINewSlider(Menu[1], Menu[2], StringFormat("[%s] Override damage", Name), 0, 124, 20, true, "\n", 1, Labels.Damage),
231 AutoFire = UINewCheckbox(Menu[1], Menu[2], StringFormat("[%s] Automatic fire", Name)),
232 AutoPenetration = UINewCheckbox(Menu[1], Menu[2], StringFormat("[%s] Automatic penetration", Name)),
233 AutoScope = UINewCheckbox(Menu[1], Menu[2], StringFormat("[%s] Automatic scope", Name)),
234 HitChanceNoscope = UINewSlider(Menu[1], Menu[2], StringFormat("[%s] Minimum noscope hit chance", Name), 0, 100, 60, true, "%", 1, Labels.HitChance),
235 InAir = UINewCheckbox(Menu[1], Menu[2], StringFormat("[%s] Hit chance in air", Name)),
236 InAirHitChance = UINewSlider(Menu[1], Menu[2], StringFormat("[%s] Air hit chance", Name), 0, 100, 30, true, "%", 1, Labels.HitChance),
237 Boost = UINewCombobox(Menu[1], Menu[2], StringFormat("[%s] Accuracy boost", Name), { "Off", "Low", "Medium", "High", "Maximum" }),
238 Delay = UINewCheckbox(Menu[1], Menu[2], StringFormat("[%s] Delay shot", Name)),
239 Stop = UINewCheckbox(Menu[1], Menu[2], StringFormat("[%s] Quick stop", Name)),
240 StopOptions = UINewMultiselect(Menu[1], Menu[2], StringFormat("[%s] Quick stop options", Name), { "Early", "Slow motion", "Fake duck", "Duck", "Move between shots", "Ignore molotov" }),
241 BaimPeek = UINewCheckbox(Menu[1], Menu[2], StringFormat("[%s] Force body aim on peek", Name)),
242 Baim = UINewCheckbox(Menu[1], Menu[2], StringFormat("[%s] Prefer body aim", Name)),
243 BaimDisablers = UINewMultiselect(Menu[1], Menu[2], StringFormat("[%s] Prefer body aim disablers", Name), { "Low inaccuracy","Target shot fired","Target resolved","Safe point headshot","Low damage" }),
244 Doubletap = UINewCheckbox(Menu[1], Menu[2], StringFormat("[%s] Double tap", Name)),
245 DoubletapStop = UINewMultiselect(Menu[1], Menu[2], StringFormat("[%s] Double tap quick stop", Name), { "Slow motion", "Duck", "Move between shots" }),
246 Noscope = UINewCheckbox(Menu[1], Menu[2], StringFormat("[%s] Noscope", Name)),
247 NoscopeDistance = UINewSlider(Menu[1], Menu[2], StringFormat("[%s] Noscope distance", Name), 0, 100, 40, true, "ft"),
248 }
249 end
250end
251--#endregion
252--#region Main Functions
253local function DoNoscope(key)
254 local Me = EntityGetLocalPlayer()
255
256 local WpnDist = UIGet(WeaponInfo[key].NoscopeDistance)
257 local Data = { GetClosestEnemy() }
258 local IsScoped = EntityGetProp(Me, "m_bIsScoped") ~= 0 and true or false
259
260 if Data[1] ~= nil and Data[2] < WpnDist and not IsScoped then
261 return true
262 end
263
264 return false
265end
266
267local function UpdateSettings(key)
268 local Active = WeaponInfo[key]
269
270 local Run = function()
271 for Name, Ref in pairs(Reference) do
272 if Name ~= nil and Active[Name] ~= nil then
273 UISet(Ref, UIGet(Active[Name]))
274 end
275
276 if Name == "Damage" then
277 local FinalDamage = UIGet(Active.Damage)
278 local DamageKey = UIGet(Ctrl.DamageKey)
279
280 if UIGet(FakeDuckRef) and not DamageKey then
281 FinalDamage = FinalDamage
282 elseif PlayerVisible() and UIGet(Active.Visible) ~= UIGet(Active.Damage) and not DamageKey then
283 FinalDamage = UIGet(Active.Visible)
284 elseif DamageKey then
285 FinalDamage = UIGet(Active.DamageOverride)
286 end
287
288 UISet(Ref, FinalDamage)
289 end
290
291 if UIGet(Active.Noscope) then
292 if UIGet(Ctrl.NoscopeKey) then
293 UISet(Reference.AutoScope, true)
294 else
295 local Result = DoNoscope(key)
296 if DoNoscope(key) then
297 UISet(Reference.AutoScope, UIGet(Active.AutoScope))
298 end
299 end
300 else
301 UISet(Reference.AutoScope, UIGet(Active.AutoScope))
302 end
303
304 if Name == "HitChance" then
305 local FinalHitChance = UIGet(Active.HitChance)
306
307 if UIGet(Active.InAir) and not MathHelpers.OnGround(EntityGetLocalPlayer()) then
308 FinalHitChance = UIGet(Active.InAirHitChance)
309 elseif UIGet(Active.Noscope) then
310 FinalHitChance = UIGet(Active.HitChanceNoscope)
311 end
312
313 UISet(Ref, FinalHitChance)
314 end
315 end
316 end
317
318 Run()
319end
320--#endregion
321--#region Menu Callbacks
322local function BindCallback(list, callback, elem)
323 for K in pairs(list) do
324 if type(list[K] == "table" and list[K][elem] ~= nil) then
325 UISetCallback(list[K][elem], callback)
326 end
327 end
328end
329
330local function MenuCallback(e, call)
331 local SetupMenu = function(list, current, visible)
332 for K in pairs(list) do
333 local Mode = list[K]
334 local Active = K == current
335
336 if type(Mode) == 'table' then
337 for J in pairs(Mode) do
338
339 local SetElement = true
340
341 if not next(UIGet(Mode.Multipoint)) and (Active and J == "MultipointScale") then
342 SetElement = false
343 end
344
345 if not UIGet(Mode.Baim) and (Active and J == "BaimDisablers") then
346 SetElement = false
347 end
348
349 if not UIGet(Mode.InAir) and (Active and J == "InAirHitChance") then
350 SetElement = false
351 end
352
353 if not UIGet(Mode.Stop) and (Active and J == "StopOptions") then
354 SetElement = false
355 end
356
357 if not UIGet(Mode.Noscope) and (Active and J == "NoscopeDistance") then
358 SetElement = false
359 end
360
361 if not UIGet(Mode.Doubletap) and (Active and J == "DoubletapStop") then
362 SetElement = false
363 end
364
365 Helpers.FixMultiselect(Mode.Hitbox, "Head")
366 Helpers.FixMultiselect(Mode.Multipoint, "Head")
367
368 UISetVisible(Mode[J], Active and visible and SetElement)
369 end
370 end
371 end
372 end
373
374 local State = not UIGet(Ctrl.MasterSwitch)
375
376 if e == nil then
377 State = true
378 end
379
380 if call == nil then
381 SetupMenu(WeaponInfo, UIGet(Ctrl.CurrentWeapon), not State)
382 end
383
384 Helpers.MultiExecute(UISetVisible, {
385 [Ctrl.MasterColor] = not State,
386 [Ctrl.DamageKey] = not State,
387 [Ctrl.NoscopeKey] = not State,
388 [Ctrl.CurrentWeapon] = not State
389 })
390end
391--#endregion
392--#region Callbacks
393local function OnRunning(c)
394 local LocalPlayer = EntityGetLocalPlayer()
395
396 if LocalPlayer == nil or not EntityIsAlive(LocalPlayer) then return end
397
398 local LocalPlayerWpn = EntityGetPlayerWeapon(LocalPlayer)
399 local LocalPlayerWpnClassname = EntityGetClassName(LocalPlayerWpn)
400
401 for i=0, #Exceptions do
402 if LocalPlayerWpnClassname == Exceptions[i] then return end
403 end
404
405 local LocalPlayerWpnIdx = BitBand(65535, EntityGetProp(LocalPlayerWpn, "m_iItemDefinitionIndex"))
406 ActiveKey = WeaponHelpers.GetWeaponKey(LocalPlayerWpnIdx)
407
408 if ActiveKey ~= CachedKey then
409 UISet(Ctrl.CurrentWeapon, ActiveKey)
410 CachedKey = ActiveKey
411 end
412
413 if not UIGet(WeaponInfo[ActiveKey].Enabled) then
414 ActiveKey = "Global"
415 end
416
417 UpdateSettings(ActiveKey)
418end
419
420local function OnPaint()
421 local LocalPlayer = EntityGetLocalPlayer()
422
423 if LocalPlayer == nil or not EntityIsAlive(LocalPlayer) then return end
424 if ActiveKey == nil then return end
425
426 local Doubletapping = UIGet(DoubletapRef[1]) and UIGet(DoubletapRef[2]) and UIGet(WeaponInfo[ActiveKey].Enabled)
427 local DamageOverride = UIGet(Ctrl.DamageKey) and UIGet(WeaponInfo[ActiveKey].Enabled)
428 local NoScoping = UIGet(Reference.AutoScope)
429
430 local X, Y = ClientScreenSize()
431 local XC, YC = X/2, Y/2
432
433 local R, G, B, A = UIGet(Ctrl.MasterColor)
434 local YOffset = 13
435
436 if NoScoping == false then
437 RendererText(XC, YC + YOffset, R, G, B, A, "cb", 400, "NOSCOPE")
438 YOffset = YOffset + 11
439 end
440
441 -- if DamageOverride then
442 -- RendererText(XC, YC + YOffset, R, G, B, A, "cb", 400, "DMG " .. UIGet(Reference.Damage))
443 -- YOffset = YOffset + 11
444 -- end
445end
446--#endregion
447--#region Initialize
448local function SetupWeaponGroup(name, ...)
449 WeaponGroups[name] = WeaponGroups[name] or {}
450
451 for _, WpnIdx in pairs({...}) do
452 TableInsert(WeaponGroups[name], WpnIdx)
453 end
454end
455
456local function SetupWeaponGroups()
457 SetupWeaponGroup("Global")
458 SetupWeaponGroup("Auto", 11, 38)
459 SetupWeaponGroup("AWP", 9)
460 SetupWeaponGroup("Scout", 40)
461 SetupWeaponGroup("Deagle", 1)
462 SetupWeaponGroup("Revolver", 64)
463 SetupWeaponGroup("Taser", 31)
464 SetupWeaponGroup("Pistol", 2, 3, 4, 30, 32, 36, 61, 63)
465 SetupWeaponGroup("Rifle", 7, 8, 10, 13, 16, 39, 60)
466 SetupWeaponGroup("SMG", 17, 19, 23, 24, 26, 33, 34)
467 SetupWeaponGroup("Machine guns", 14, 28)
468 SetupWeaponGroup("Shotgun", 25, 27, 29, 35)
469
470 Ctrl.CurrentWeapon = UINewCombobox(Menu[1], Menu[2], "Weapon group", WeaponHelpers.GetWeaponGroups())
471 GenerateWeaponControls()
472end
473SetupWeaponGroups()
474
475local function Toggle()
476 local State = UIGet(Ctrl.MasterSwitch)
477 MenuCallback(true, true)
478
479 local UpdateCallback = State and ClientSetEventCallback or ClientUnsetEventCallback
480 UpdateCallback("setup_command", OnRunning)
481 UpdateCallback("paint", OnPaint)
482end
483
484MenuCallback(Ctrl.MasterSwitch)
485BindCallback(WeaponInfo, MenuCallback, "Multipoint")
486BindCallback(WeaponInfo, MenuCallback, "InAir")
487BindCallback(WeaponInfo, MenuCallback, "Baim")
488BindCallback(WeaponInfo, MenuCallback, "Stop")
489BindCallback(WeaponInfo, MenuCallback, "Doubletap")
490BindCallback(WeaponInfo, MenuCallback, "Noscope")
491
492UISetCallback(Ctrl.MasterSwitch, Toggle)
493UISetCallback(Ctrl.CurrentWeapon, MenuCallback)
494--#endregion