· 6 years ago · Dec 15, 2019, 11:56 AM
1-- local variables for API functions. any changes to the line below will be lost on re-generation
2local client_camera_angles, client_latency, client_screen_size, client_set_event_callback, entity_get_local_player, entity_get_player_resource, entity_get_player_weapon, entity_get_prop, entity_hitbox_position, entity_is_alive, globals_chokedcommands, globals_curtime, globals_tickcount, globals_tickinterval, math_abs, math_ceil, math_floor, math_max, math_min, renderer_gradient, renderer_indicator, renderer_load_svg, renderer_measure_text, renderer_rectangle, renderer_text, renderer_texture, table_insert, tonumber, unpack, pairs, type = client.camera_angles, client.latency, client.screen_size, client.set_event_callback, entity.get_local_player, entity.get_player_resource, entity.get_player_weapon, entity.get_prop, entity.hitbox_position, entity.is_alive, globals.chokedcommands, globals.curtime, globals.tickcount, globals.tickinterval, math.abs, math.ceil, math.floor, math.max, math.min, renderer.gradient, renderer.indicator, renderer.load_svg, renderer.measure_text, renderer.rectangle, renderer.text, renderer.texture, table.insert, tonumber, unpack, pairs, type
3
4local 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;if E then end end end;table.insert(l,{q,r,A,B})return q,r,A,B end;return a end)()
5local ui_lib = (function() local function a(b,c,d,e)c=c or""d=d or 1;e=e or#b;local f=""for g=d,e do f=f..c..tostring(b[g])end;return f end;local function h(b,i)for g=1,#b do if b[g]==i then return true end end;return false end;local function j(k,...)if not k then error(a({...}),3)end end;local function l(b)local m,n=false,false;for o,k in pairs(b)do if type(o)=="number"then m=true else n=true end end;return m,n end;local p=globals.realtime()local q={}local r={}local s={}local function t(b)local u=false;for o,k in pairs(b)do if getmetatable(k)==s then u=true end end;return u end;local function v(k,w)return k~=q[w].default end;local function x(k)return#k>0 end;function s.__index(w,o)if q[w]~=nil and type(o)=="string"and o:sub(1,1)~="_"then return q[w][o]or r[o]end end;function s.__call(w,...)local y={...}if globals.realtime()==p and#y==1 and type(y[1])=="table"then local z={}local A=y[1]local B=false;local C=false;local D={}for o,k in pairs(A)do if type(o)~="number"then D[o]=k;C=true end end;if A[1]~=nil and(type(A[1])~="table"or not t(A[1]))then D[1]=A[1]B=true;if type(D[1])~="table"then D[1]={D[1]}end end;if C then table.insert(z,D)end;for g=B and 2 or 1,#A do if t(A[g])then table.insert(z,A[g])end end;for g=1,#z do local E=z[g]local k;if E[1]~=nil then k=E[1]end;for o,F in pairs(E)do if o~=1 then w:add_children(F,k,o)end end end;return w end;if#y==0 then return w:get()else local G,H=pcall(ui.set,y[1].reference,select(2,unpack(y)))end end;function s.__tostring(w)return w.tab.." - "..w.container.." - "..w.name end;function r.new(I,J,K,L,...)local y={...}local M,N;local O;if type(I)=="function"and I~=ui.reference then for o,k in pairs(ui)do if k==I and o:sub(1,4)=="new_"then O=o:sub(5,-1)end end;M=I(J,K,L,unpack(y))N=I==ui.reference else M=I;N=true end;if O==nil then local k={pcall(ui.get,M)}if k[1]==false then O="button"else k={select(2,unpack(k))}if#k==1 then local P=type(k[1])if P=="string"then local G=pcall(ui.set,M,nil)ui.set(M,k[1])O=G and"textbox"or"combobox"elseif P=="number"then local G=pcall(ui.set,M,-9999999999999999)ui.set(M,k[1])O=G and"listbox"or"slider"elseif P=="boolean"then O="checkbox"elseif P=="table"then O="multiselect"end elseif#k>=2 and type(k[1])=="boolean"and type(k[2])=="number"then O="hotkey"elseif#k==4 then if type(k[1])=="number"and type(k[2])=="number"and type(k[3])=="number"and type(k[4])=="number"then O="color_picker"end end end end;local Q;if N==false and O~=nil then if O=="slider"then Q=y[3]or y[1]elseif O=="combobox"then Q=y[1][1]elseif O=="checkbox"then Q=false end end;local w={}q[w]={tab=J,container=K,name=L,reference=M,type=O,default=Q,visible=true,ui_callback=nil,callbacks={},is_gamesense_reference=N,children_values={},children_callbacks={}}if N==false and O~=nil then if O=="slider"then q[w].min=y[1]q[w].max=y[2]elseif O=="combobox"or O=="multiselect"or O=="listbox"then q[w].values=y[1]end end;return setmetatable(w,s)end;function r:set(...)local R={...}local S=q[self]local T={pcall(ui.set,S.reference,unpack(R))}end;function r:get()local S=q[self]return ui.get(S.reference)end;function r:contains(k)local S=q[self]if S.type=="multiselect"then return h(ui.get(S.reference),k)elseif S.type=="combobox"then return ui.get(S.reference)==k else error(string.format("Invalid type %s for contains",S.type),2)end end;function r:as_keys()local S=q[self]if S.type=="multiselect"then local k=ui.get(S.reference)local f={}for g=1,#k do f[k[g]]=true end;return f elseif S.type=="combobox"then return{[ui.get(S.reference)]=true}else error(string.format("Invalid type %s for as_keys",S.type),2)end end;function r:set_visible(U)local S=q[self]ui.set_visible(S.reference,U)S.visible=U end;function r:set_default(k)q[self].default=k;self:set(k)end;function r:add_children(V,W,o)local S=q[self]local X=type(W)=="function"if W==nil then W=true;if S.type=="boolean"then W=true elseif S.type=="combobox"then X=true;W=v elseif S.type=="multiselect"then X=true;W=x end end;if getmetatable(V)==s then V={V}end;for Y,F in pairs(V)do if X then q[F].parent_visible_callback=W else q[F].parent_visible_value=W end;self[o or F.reference]=F end;r._process_callbacks(self)end;function r:add_callback(Z)local S=q[self]table.insert(S.callbacks,Z)r._process_callbacks(self)end;function r:_process_callbacks()local S=q[self]if S.ui_callback==nil then local Z=function(M,_)local k=self:get()local a0=S.combo_elements;if a0~=nil and#a0>0 then local a1;for g=1,#a0 do local a2=a0[g]if#a2>0 then local a3={}for g=1,#a2 do if h(k,a2[g])then table.insert(a3,a2[g])end end;if#a3>1 then a1=a1 or k;for g=#a3,1,-1 do if h(S.value_prev,a3[g])and#a3>1 then table.remove(a3,g)end end;local a4=a3[1]for g=#a1,1,-1 do if a1[g]~=a4 and h(a2,a1[g])then table.remove(a1,g)end end elseif#a3==0 and not(a2.required==false)then a1=a1 or k;if S.value_prev~=nil then for g=1,#S.value_prev do if h(a2,S.value_prev[g])then table.insert(a1,S.value_prev[g])break end end end end end end;if a1~=nil then self:set(a1)end;S.value_prev=k;k=a1 or k end;for o,F in pairs(self)do local a5=q[F]local a6=false;if S.visible then if a5.parent_visible_callback~=nil then a6=a5.parent_visible_callback(k,self,F)elseif S.type=="multiselect"then local a7=type(a5.parent_visible_value)for g=1,#k do if a7 and h(a5.parent_visible_value,k[g])or a5.parent_visible_value==k[g]then a6=true;break end end elseif type(a5.parent_visible_value)=="table"then a6=a5.parent_visible_value[k]or h(a5.parent_visible_value,k)else a6=k==a5.parent_visible_value end end;ui.set_visible(a5.reference,a6)a5.visible=a6;if a5.ui_callback~=nil then a5.ui_callback(F)end end;for g=1,#S.callbacks do S.callbacks[g]()end end;ui.set_callback(S.reference,Z)S.ui_callback=Z end;S.ui_callback()end;local a8={}local a9={__index=function(Y,o)if a8[o]then return a8[o]end;local aa=o;if aa:sub(1,4)~="new_"then aa="new_"..aa end;if ui[aa]~=nil then local ab=ui[aa]return function(self,L,...)local y={...}local a0={}local ac=aa:sub(5,-1)local ad="Cannot create a "..ac..": "local w;if ab==ui.new_textbox and L==nil then L="\n"end;L=(self.prefix or"")..L..(self.suffix or"")if ab==ui.new_slider then local ae,af,ag,ah,ai,aj,ak=unpack(y)if type(ag)=="table"then local al=ag;ag=al.default;ah=al.show_tooltip;ai=al.unit;aj=al.scale;ak=al.tooltips end;if ag~=nil then end;if ai~=nil then end;ag=ag or nil;ah=ah or true;ai=ai or nil;aj=aj or 1;ak=ak or nil;w=r.new(ui.new_slider,self.tab,self.container,L,ae,af,ag,ah,ai,aj,ak)elseif ab==ui.new_combobox or ab==ui.new_multiselect or ab==ui.new_listbox then local am={...}if#am==1 and type(am[1])=="table"then am=am[1]end;if ab==ui.new_multiselect then local an={}for g=1,#am do local I=am[g]if type(I)=="table"then table.insert(a0,I)for ao=1,#I do table.insert(an,I[ao])end else table.insert(an,I)end end;am=an end;for g=1,#am do local I=am[g]end;if ab==ui.new_multiselect then w=r.new(ui.new_multiselect,self.tab,self.container,L,am)end elseif ab==ui.new_hotkey then if y[1]==nil then y[1]=false end;local ap=unpack(y)elseif ab==ui.new_button then local Z=unpack(y)elseif ab==ui.new_color_picker then local aq,ar,as,at=unpack(y)end;if w==nil then w=r.new(ab,self.tab,self.container,L,...)end;self[q[w].reference]=w;if#a0>0 then q[w].combo_elements=a0;local au={}for g=1,#a0 do if not a0[g].required==false then table.insert(au,a0[g][1])end end;w:set(au)q[w].value_prev=au;r._process_callbacks(w)end;return w end end end}local av={RAGE={"Aimbot","Other"},AA={"Anti-aimbot angles","Fake lag","Other"},LEGIT={"Weapon type","Aimbot","Triggerbot","Other"},VISUALS={"Player ESP","Other ESP","Colored models","Effects"},MISC={"Miscellaneous","Settings","Lua","Other"},SKINS={"Weapon skin","Knife options","Glove options"},PLAYERS={"Players","Adjustments"},LUA={"A","B"}}for J,aw in pairs(av)do av[J]={}for g=1,#aw do av[J][aw[g]:lower()]=true end end;function a8.new(J,K)J=J:upper()return setmetatable({tab=J,container=K,items={}},a9)end;function a8.reference(J,K,L)if L==nil and type(J)=="table"and getmetatable(J)==a9 then L=K;J,K=J.tab,J.container end;local ax={pcall(ui.reference,J,K,L)}local ay={select(2,unpack(ax))}local az={}for g=1,#ay do local M=ay[g]local w=r.new(M,J,K,L)table.insert(az,w)end;return unpack(az)end;function a8:create(b)return b end;return setmetatable(a8,{__call=function(Y,...)return a8.new(...)end,__index=function(Y,aA)return r[aA]or ui[aA]end}) end)()
6
7local bool_items = {
8 ["Double tap"] = {
9 references = {({ui_lib.reference("RAGE", "Other", "Double tap")})[1], ({ui_lib.reference("RAGE", "Other", "Double tap")})[2]},
10 text = "DT"
11 },
12 ["Safe point"] = {
13 references = {({ui_lib.reference("RAGE", "Aimbot", "Force safe point")})[1]},
14 text = "SP"
15 },
16 ["Freestanding"] = {
17 references = {({ui_lib.reference("AA", "Anti-aimbot angles", "Freestanding")})[1], ({ui_lib.reference("AA", "Anti-aimbot angles", "Freestanding")})[2]},
18 text = "FS"
19 },
20 ["Anti-aim correction override"] = {
21 references = {(ui_lib.reference("RAGE", "Other", "Anti-aim correction override"))},
22 text = "OR"
23 }
24}
25
26local function rectangle_outline(x, y, w, h, r, g, b, a, s)
27 s = s or 1
28 renderer_rectangle(x, y, w, s, r, g, b, a) -- top
29 renderer_rectangle(x, y+h-s, w, s, r, g, b, a) -- bottom
30 renderer_rectangle(x, y+s, s, h-s*2, r, g, b, a) -- left
31 renderer_rectangle(x+w-s, y+s, s, h-s*2, r, g, b, a) -- right
32end
33
34local function table_contains(tbl, val)
35 for i=1,#tbl do
36 if tbl[i] == val then
37 return true
38 end
39 end
40 return false
41end
42
43local function normalize_yaw(angle)
44 angle = (angle % 360 + 360) % 360
45 return angle > 180 and angle - 360 or angle
46end
47
48local bar_min_width = 130
49local custom_items = {
50 {
51 name = "Fake lag",
52 title_text = "Fake lag",
53 get_text_width = function(self)
54 self.title_text_width = self.title_text_width or renderer_measure_text(nil, self.title_text)+4
55 return self.title_text_width
56 end,
57 get_size = function(self, text_width)
58 if self.maxusrcmdprocessticks_reference == nil then
59 self.maxusrcmdprocessticks_reference = ui_lib.reference("MISC", "Settings", "sv_maxusrcmdprocessticks")
60 end
61
62 self.chokedcommands_prev = self.chokedcommands
63 self.chokedcommands = globals_chokedcommands()
64 if self.chokedcommands_max == nil or self.chokedcommands > self.chokedcommands_max then
65 self.chokedcommands_max = self.chokedcommands
66 elseif self.chokedcommands == 0 and self.chokedcommands_prev ~= 0 then
67 self.chokedcommands_max = self.chokedcommands_prev
68 elseif self.chokedcommands == 0 and self.chokedcommands_prev_cmd == 0 then
69 self.chokedcommands_max = 0
70 end
71
72 if self.limit == nil or self.chokedcommands == 0 then
73 self.limit = self.maxusrcmdprocessticks_reference:get()-2
74 end
75
76 self.tickcount = globals_tickcount()
77 if self.tickcount ~= self.tickcount_prev then
78 self.last_cmd = globals_curtime()
79 self.chokedcommands_prev_cmd = self.chokedcommands_prev
80 self.tickcount_prev = self.tickcount
81 end
82
83 return text_width+bar_min_width, 10
84 end,
85 draw = function(self, x, y, w, h, align_right, text_width, r, g, b, a)
86 renderer_text(x, y, 255, 255, 255, 255, nil, 0, self.title_text)
87
88 local interp = (globals_curtime() - self.last_cmd) / globals_tickinterval()
89
90 local bar_x, bar_y, bar_w, bar_h = x+text_width+3, y+2, w-text_width-3, 7
91 local chokedcommands_interpolated = math_max(0, math_min(self.chokedcommands_max, self.chokedcommands + (interp < 1 and interp or 0)))
92
93 -- 4280ECCB
94 local r_top, g_top, b_top = math_max(0, math_min(255, r+4)), math_max(0, math_min(255, g+4)), math_max(0, math_min(255, b+4))
95 local r_bot, g_bot, b_bot = math_max(0, math_min(255, r-40)), math_max(0, math_min(255, g-40)), math_max(0, math_min(255, b-40))
96
97 local bar_width = math_floor(bar_w*math_max(0, math_min(1, self.chokedcommands_max / self.limit)))
98
99 renderer_rectangle(bar_x, bar_y, bar_w, bar_h, 14, 14, 14, 255)
100 renderer_gradient(bar_x+1, bar_y+1, math_max(bar_width-2, 0), bar_h-2, r_top, g_top, b_top, a*0.25, r_bot, g_bot, b_bot, a*0.25, false)
101 renderer_gradient(bar_x+1, bar_y+1, math_max(bar_width*math_max(0, math_min(1, chokedcommands_interpolated / self.chokedcommands_max))-2, 0), bar_h-2, r_top, g_top, b_top, a, r_bot, g_bot, b_bot, a, false)
102
103 renderer_gradient(bar_x+1+math_max(0, bar_width-2), bar_y+1, math_min(bar_w-2, bar_w-bar_width), bar_h-2, 52, 52, 52, a, 68, 68, 68, a, false)
104
105 -- rounded_bar(bar_x-1, bar_y-1, bar_w+2, bar_h+2, 0, 0, 0, 255)
106 -- rounded_bar(bar_x, bar_y, bar_w*(self.chokedcommands_max / self.limit)+3, bar_h, 255, 255, 255, 100)
107 -- rounded_bar(bar_x, bar_y, bar_w*(self.chokedcommands / self.limit)+3, bar_h, 255, 255, 255, 255)
108
109 if self.chokedcommands_max > 0 then
110 renderer_text(bar_x+math_min(bar_width-4, bar_w-7), y+4, 255, 255, 255, 255, "-", 0, self.chokedcommands_max)
111 end
112 end
113 },
114 {
115 name = "Body yaw",
116 title_text = "Body yaw",
117 get_text_width = function(self)
118 self.title_text_width = self.title_text_width or renderer_measure_text(nil, self.title_text)+4
119 return self.title_text_width
120 end,
121 get_size = function(self, text_width)
122 return text_width+bar_min_width, 10
123 end,
124 draw = function(self, x, y, w, h, align_right, text_width, r, g, b, a)
125 renderer_text(x, y, 255, 255, 255, 255, nil, 0, self.title_text)
126
127 local bar_x, bar_y, bar_w, bar_h = x+text_width+3, y+2, w-text_width-3, 7
128
129 local r_top, g_top, b_top = math_max(0, math_min(255, r+4)), math_max(0, math_min(255, g+4)), math_max(0, math_min(255, b+4))
130 local r_bot, g_bot, b_bot = math_max(0, math_min(255, r-40)), math_max(0, math_min(255, g-40)), math_max(0, math_min(255, b-40))
131
132 local local_player = entity_get_local_player()
133 if local_player ~= nil then
134 local body_yaw = math_max(-60, math_min(60, math_floor((entity_get_prop(local_player, "m_flPoseParameter", 11) or 0)*120-60+0.5)))
135
136 local percentage = (math_max(-60, math_min(60, body_yaw*1.06))+60) / 120
137
138 -- display reversed for backwards AAs
139 local _, camera_yaw = client_camera_angles()
140 local _, rot_yaw = entity_get_prop(local_player, "m_angAbsRotation")
141
142 if camera_yaw ~= nil and rot_yaw ~= nil and 60 < math_abs(normalize_yaw(camera_yaw-(rot_yaw+body_yaw))) then
143 percentage = 1-percentage
144 end
145
146 renderer_rectangle(bar_x, bar_y, bar_w, bar_h, 14, 14, 14, 255)
147 renderer_gradient(bar_x+1, bar_y+1, bar_w-2, bar_h-2, 52, 52, 52, a, 68, 68, 68, a, false)
148
149 local center = math_floor(bar_w/2+0.5)
150 if percentage > 0.5 then
151 renderer_rectangle(bar_x+center+1, bar_y+1, bar_w*(percentage-0.5)-2, bar_h-2, 14, 14, 14, 255)
152 renderer_gradient(bar_x+center+1, bar_y+1, bar_w*(percentage-0.5)-2, bar_h-2, r_top, g_top, b_top, a, r_bot, g_bot, b_bot, a, false)
153 else
154 local start = math_floor(bar_w*percentage)
155 renderer_rectangle(bar_x+1+start, bar_y+1, center-start, bar_h-2, 14, 14, 14, 255)
156 renderer_gradient(bar_x+1+start, bar_y+1, center-start, bar_h-2, r_top, g_top, b_top, a, r_bot, g_bot, b_bot, a, false)
157 end
158
159 renderer_gradient(bar_x+center, bar_y+1, 1, bar_h-2, 255, 255, 255, a, 140, 140, 140, a, false)
160
161 if body_yaw ~= 0 then
162 renderer_text(math_max(bar_x+4, math_min(bar_x+bar_w-6, bar_x+bar_w*percentage+0.5-(body_yaw < 0 and 2 or 0))), y+9, 255, 255, 255, 255, "c-", 0, body_yaw) --string.format("%.3f", entity_get_prop(local_player, "m_flPoseParameter", 11)*120-60)
163 end
164 end
165 end
166 },
167 {
168 name = "Head height",
169 title_text = "Head height",
170 get_text_width = function(self)
171 self.title_text_width = self.title_text_width or renderer_measure_text(nil, self.title_text)+4
172 return self.title_text_width
173 end,
174 get_size = function(self, text_width)
175 return text_width+bar_min_width, 10
176 end,
177 draw = function(self, x, y, w, h, align_right, text_width, r, g, b, a)
178 renderer_text(x, y, 255, 255, 255, 255, nil, 0, self.title_text)
179 local bar_x, bar_y, bar_w, bar_h = x+text_width+3, y+2, w-text_width-3, 7
180
181 local local_player = entity_get_local_player()
182 local _, _, o_z = entity_get_prop(local_player, "m_vecAbsOrigin")
183 local _, _, h_z = entity_hitbox_position(local_player, 0)
184
185 if o_z ~= nil and h_z ~= nil then
186 if h_z ~= self.h_z_prev then
187 self.h_z_prev = self.h_z
188 self.duckamount = entity_get_prop(local_player, "m_flDuckAmount") or 0
189 end
190
191 local delta = h_z - o_z + (self.duckamount or 0)*12
192 local max_height = 70
193 local min_height = 55
194
195 local percentage = math_max(0, math_min(1, 1-(delta-min_height)/(max_height-min_height)))
196
197 -- slider bar
198 local r_top, g_top, b_top = math_max(0, math_min(255, r+4)), math_max(0, math_min(255, g+4)), math_max(0, math_min(255, b+4))
199 local r_bot, g_bot, b_bot = math_max(0, math_min(255, r-40)), math_max(0, math_min(255, g-40)), math_max(0, math_min(255, b-40))
200
201 local bar_width = math_floor(bar_w*percentage)
202
203 renderer_rectangle(bar_x, bar_y, bar_w, bar_h, 14, 14, 14, 255)
204 renderer_gradient(bar_x+1, bar_y+1, bar_width-2, bar_h-2, r_top, g_top, b_top, a, r_bot, g_bot, b_bot, a, false)
205
206 renderer_gradient(bar_x+1+math_max(0, bar_width-2), bar_y+1, math_min(bar_w-2, bar_w-bar_width), bar_h-2, 52, 52, 52, a, 68, 68, 68, a, false)
207 end
208 end
209 },
210 {
211 name = "Ping spike + amount",
212 title_text = "Ping spike",
213 group = "Ping spike",
214 get_should_draw = function(self)
215 if self.reference == nil then
216 self.reference, self.hotkey_reference, self.amount_reference = ui_lib.reference("MISC", "Miscellaneous", "Ping spike")
217 end
218 local draw = self.reference:get() and self.hotkey_reference:get()
219 if draw then
220 self.ping_extra = tonumber(entity_get_prop(entity_get_player_resource(), "m_iPing", entity_get_local_player()) or 0)-client_latency()*1000-5
221 self.percentage = math_min(1, math_max(0, self.ping_extra / self.amount_reference:get()))
222 end
223 return draw
224 end,
225 get_text_width = function(self)
226 self.title_text_width = self.title_text_width or renderer_measure_text(nil, self.title_text)+4
227 return self.title_text_width
228 end,
229 get_size = function(self, text_width)
230 return text_width+bar_min_width, 10
231 end,
232 draw = function(self, x, y, w, h, align_right, text_width, r, g, b, a)
233 renderer_text(x, y, 255, 255, 255, 255, nil, 0, self.title_text)
234
235 local bar_x, bar_y, bar_w, bar_h = x+text_width+3, y+2, w-text_width-3, 7
236
237 -- slider bar
238 local r_top, g_top, b_top = math_max(0, math_min(255, r+4)), math_max(0, math_min(255, g+4)), math_max(0, math_min(255, b+4))
239 local r_bot, g_bot, b_bot = math_max(0, math_min(255, r-40)), math_max(0, math_min(255, g-40)), math_max(0, math_min(255, b-40))
240
241 local bar_width = math_floor(bar_w*(self.percentage))
242
243 renderer_rectangle(bar_x, bar_y, bar_w, bar_h, 14, 14, 14, 255)
244 renderer_gradient(bar_x+1, bar_y+1, bar_width-2, bar_h-2, r_top, g_top, b_top, a, r_bot, g_bot, b_bot, a, false)
245
246 renderer_gradient(bar_x+1+math_max(0, bar_width-2), bar_y+1, math_min(bar_w-2, bar_w-bar_width), bar_h-2, 52, 52, 52, a, 68, 68, 68, a, false)
247
248 -- rounded_bar(bar_x-1, bar_y-1, bar_w+2, bar_h+2, 0, 0, 0, 255)
249 -- rounded_bar(bar_x, bar_y, bar_w*(self.chokedcommands_max / self.limit)+3, bar_h, 255, 255, 255, 100)
250 -- rounded_bar(bar_x, bar_y, bar_w*(self.chokedcommands / self.limit)+3, bar_h, 255, 255, 255, 255)
251 end
252 },
253 {
254 name = "Fake duck + height",
255 title_text = "Fake duck",
256 group = "Fake duck",
257 get_should_draw = function(self)
258 if self.reference == nil then
259 self.reference = ui_lib.reference("RAGE", "Other", "Duck peek assist")
260 self.infinite_duck_reference = ui_lib.reference("Misc", "Movement", "Infinite duck")
261 end
262 local draw = self.reference:get() and self.infinite_duck_reference:get()
263 if draw then
264 self.tickcount = globals_tickcount()
265 if self.tickcount ~= self.tickcount_prev then
266 self.duckamount_prev_2 = self.duckamount_prev
267 self.duckamount_prev = self.duckamount
268 self.duckamount = entity_get_prop(entity_get_local_player(), "m_flDuckAmount") or 0
269 self.tickcount_prev = self.tickcount
270 end
271
272 if self.duckamount_max == nil or self.duckamount > self.duckamount_max then
273 self.duckamount_max = self.duckamount
274 elseif self.duckamount_prev ~= nil and self.duckamount_prev_2 ~= nil and self.duckamount_prev > self.duckamount and self.duckamount_prev > self.duckamount_prev_2 then
275 self.duckamount_max = self.duckamount_prev
276 elseif self.duckamount_prev == 0 and self.duckamount == 0 and self.duckamount_prev_2 == 0 then
277 self.duckamount_max = 0
278 end
279 else
280 self.duckamount_prev_2 = nil
281 self.duckamount_prev = nil
282 self.duckamount_max = nil
283 end
284 return draw
285 end,
286 get_text_width = function(self)
287 self.title_text_width = self.title_text_width or renderer_measure_text(nil, self.title_text)+4
288 return self.title_text_width
289 end,
290 get_size = function(self, text_width)
291 return text_width+bar_min_width, 10
292 end,
293 draw = function(self, x, y, w, h, align_right, text_width, r, g, b, a)
294 renderer_text(x, y, 255, 255, 255, 255, nil, 0, self.title_text)
295
296 local bar_x, bar_y, bar_w, bar_h = x+text_width+3, y+2, w-text_width-3, 7
297
298 -- slider bar
299 local r_top, g_top, b_top = math_max(0, math_min(255, r+4)), math_max(0, math_min(255, g+4)), math_max(0, math_min(255, b+4))
300 local r_bot, g_bot, b_bot = math_max(0, math_min(255, r-40)), math_max(0, math_min(255, g-40)), math_max(0, math_min(255, b-40))
301
302 local bar_width = math_floor(bar_w*math_max(0, math_min(1, self.duckamount_max)))
303
304 renderer_rectangle(bar_x, bar_y, bar_w, bar_h, 14, 14, 14, 255)
305 renderer_gradient(bar_x+1, bar_y+1, bar_width-2, bar_h-2, r_top, g_top, b_top, a*0.25, r_bot, g_bot, b_bot, a*0.25, false)
306 renderer_gradient(bar_x+1, bar_y+1, bar_w*(self.duckamount)-2, bar_h-2, r_top, g_top, b_top, a, r_bot, g_bot, b_bot, a, false)
307
308 renderer_gradient(bar_x+1+math_max(0, bar_width-2), bar_y+1, math_min(bar_w-2, bar_w-bar_width), bar_h-2, 52, 52, 52, a, 68, 68, 68, a, false)
309
310 -- rounded_bar(bar_x-1, bar_y-1, bar_w+2, bar_h+2, 0, 0, 0, 255)
311 -- rounded_bar(bar_x, bar_y, bar_w*(self.chokedcommands_max / self.limit)+3, bar_h, 255, 255, 255, 100)
312 -- rounded_bar(bar_x, bar_y, bar_w*(self.chokedcommands / self.limit)+3, bar_h, 255, 255, 255, 255)
313 end
314 },
315 {
316 name = "Ping spike",
317 title_text = "Ping spike",
318 group = "Ping spike",
319 get_should_draw = function(self)
320 if self.reference == nil then
321 self.reference, self.hotkey_reference, self.amount_reference = ui_lib.reference("MISC", "Miscellaneous", "Ping spike")
322 end
323 local draw = self.reference:get() and self.hotkey_reference:get()
324 return draw
325 end,
326 get_text_width = function(self)
327 self.title_text_width = self.title_text_width or renderer_measure_text(nil, self.title_text)+4
328 return self.title_text_width
329 end,
330 get_size = function(self)
331 return self.title_text_width+30, 10
332 end,
333 draw = function(self, x, y, w, h, align_right, text_width, r, g, b, a)
334 renderer_text(x, y, 255, 255, 255, 255, nil, 0, self.title_text)
335 renderer_text(x+w, y, 126, 195, 12, 255, "rb", 0, "[On]")
336 end
337 },
338 {
339 name = "Fake duck",
340 title_text = "Fake duck",
341 group = "Fake duck",
342 get_should_draw = function(self)
343 if self.reference == nil then
344 self.reference = ui_lib.reference("RAGE", "Other", "Duck peek assist")
345 self.infinite_duck_reference = ui_lib.reference("Misc", "Movement", "Infinite duck")
346 end
347 local draw = self.reference:get() and self.infinite_duck_reference:get()
348 return draw
349 end,
350 get_text_width = function(self)
351 self.title_text_width = self.title_text_width or renderer_measure_text(nil, self.title_text)+4
352 return self.title_text_width
353 end,
354 get_size = function(self)
355 return self.title_text_width+30, 10
356 end,
357 draw = function(self, x, y, w, h, align_right, text_width, r, g, b, a)
358 renderer_text(x, y, 255, 255, 255, 255, nil, 0, self.title_text)
359 renderer_text(x+w, y, 126, 195, 12, 255, "rb", 0, "[On]")
360 end
361 },
362 {
363 name = "Double tap",
364 title_text = "Double tap",
365 get_should_draw = function(self)
366 if self.reference == nil then
367 self.reference, self.hotkey_reference = ui_lib.reference("RAGE", "Other", "Double tap")
368 self.mode_reference = ui_lib.reference("RAGE", "Other", "Double tap mode")
369 end
370 return self.reference:get() and self.hotkey_reference:get()
371 end,
372 get_text_width = function(self)
373 self.title_text_width = self.title_text_width or renderer_measure_text(nil, self.title_text)+4
374 return self.title_text_width
375 end,
376 get_size = function(self)
377 self.right_text_width = math_max((renderer_measure_text("b", "[Offensive]")+4), (renderer_measure_text("b", "[Defensive]")+4))
378 return self.title_text_width+self.right_text_width, 10
379 end,
380 draw = function(self, x, y, w, h, align_right)
381 renderer_text(x, y, 255, 255, 255, 255, nil, 0, self.title_text)
382 local local_player = entity_get_local_player()
383 local weapon = entity_get_player_weapon(local_player)
384
385 local next_attack = math_max(entity_get_prop(weapon, "m_flNextPrimaryAttack") or 0, entity_get_prop(local_player, "m_flNextAttack") or 0)
386 local r, g, b, a = unpack(globals_curtime() > next_attack and {126, 195, 12} or {230, 230, 39})
387 renderer_text(x+w, y, r, g, b, 255, "rb", 0, "[", self.mode_reference:get(), "]")
388 end
389 },
390 {
391 name = "On-shot anti-aim",
392 title_text = "On-shot AA",
393 get_should_draw = function(self)
394 if self.reference == nil then
395 self.reference, self.hotkey_reference = ui_lib.reference("AA", "Other", "On shot anti-aim")
396 self.dt_reference, self.dt_hotkey_reference = ui_lib.reference("RAGE", "Other", "Double tap")
397 end
398 return self.reference:get() and self.hotkey_reference:get() and not (self.dt_reference:get() and self.dt_hotkey_reference:get())
399 end,
400 get_text_width = function(self)
401 self.title_text_width = self.title_text_width or renderer_measure_text(nil, self.title_text)+4
402 return self.title_text_width
403 end,
404 get_size = function(self)
405 return self.title_text_width+30, 10
406 end,
407 draw = function(self, x, y, w, h, align_right)
408 renderer_text(x, y, 255, 255, 255, 255, nil, 0, self.title_text)
409 renderer_text(x+w, y, 126, 195, 12, 255, "rb", 0, "[On]")
410 end
411 },
412 {
413 name = "Safe point",
414 title_text = "Safe point",
415 get_should_draw = function(self)
416 if self.reference == nil then
417 self.force_reference = ui_lib.reference("RAGE", "Aimbot", "Force safe point")
418 end
419 return self.force_reference:get()
420 end,
421 get_text_width = function(self)
422 self.title_text_width = self.title_text_width or renderer_measure_text(nil, self.title_text)+4
423 return self.title_text_width
424 end,
425 get_size = function(self)
426 return self.title_text_width+30, 10
427 end,
428 draw = function(self, x, y, w, h, align_right)
429 renderer_text(x, y, 255, 255, 255, 255, nil, 0, self.title_text)
430 renderer_text(x+w, y, 126, 195, 12, 255, "rb", 0, "[On]")
431 end
432 },
433 {
434 name = "Freestanding",
435 title_text = "Freestanding",
436 get_should_draw = function(self)
437 if self.reference == nil then
438 self.reference, self.hotkey_reference = ui_lib.reference("AA", "Anti-aimbot angles", "Freestanding")
439 end
440 return #self.reference:get() > 0 and self.hotkey_reference:get()
441 end,
442 get_text_width = function(self)
443 self.title_text_width = self.title_text_width or renderer_measure_text(nil, self.title_text)+4
444 return self.title_text_width
445 end,
446 get_size = function(self)
447 return self.title_text_width+30, 10
448 end,
449 draw = function(self, x, y, w, h, align_right)
450 renderer_text(x, y, 255, 255, 255, 255, nil, 0, self.title_text)
451 renderer_text(x+w, y, 126, 195, 12, 255, "rb", 0, "[On]")
452 end
453 },
454 {
455 name = "Slow motion",
456 title_text = "Slow motion",
457 get_should_draw = function(self)
458 if self.reference == nil then
459 self.reference, self.hotkey_reference = ui_lib.reference("AA", "Other", "Slow motion")
460 end
461 return self.reference:get() and self.hotkey_reference:get()
462 end,
463 get_text_width = function(self)
464 self.title_text_width = self.title_text_width or renderer_measure_text(nil, self.title_text)+4
465 return self.title_text_width
466 end,
467 get_size = function(self)
468 return self.title_text_width+30, 10
469 end,
470 draw = function(self, x, y, w, h, align_right)
471 renderer_text(x, y, 255, 255, 255, 255, nil, 0, self.title_text)
472 renderer_text(x+w, y, 126, 195, 12, 255, "rb", 0, "[On]")
473 end
474 },
475 {
476 name = "Anti-aim correction override",
477 title_text = "Override",
478 get_should_draw = function(self)
479 if self.reference == nil then
480 self.reference = ui_lib.reference("RAGE", "Other", "Anti-aim correction override")
481 end
482 return self.reference:get()
483 end,
484 get_text_width = function(self)
485 self.title_text_width = self.title_text_width or renderer_measure_text(nil, self.title_text)+4
486 return self.title_text_width
487 end,
488 get_size = function(self)
489 return self.title_text_width+30, 10
490 end,
491 draw = function(self, x, y, w, h, align_right)
492 renderer_text(x, y, 255, 255, 255, 255, nil, 0, self.title_text)
493 renderer_text(x+w, y, 126, 195, 12, 255, "rb", 0, "[On]")
494 end
495 },
496 {
497 name = "Force body aim",
498 title_text = "Force baim",
499 get_should_draw = function(self)
500 if self.reference == nil then
501 self.reference = ui_lib.reference("RAGE", "Other", "Force body aim")
502 end
503 return self.reference:get()
504 end,
505 get_text_width = function(self)
506 self.title_text_width = self.title_text_width or renderer_measure_text(nil, self.title_text)+4
507 return self.title_text_width
508 end,
509 get_size = function(self)
510 return self.title_text_width+30, 10
511 end,
512 draw = function(self, x, y, w, h, align_right)
513 renderer_text(x, y, 255, 255, 255, 255, nil, 0, self.title_text)
514 renderer_text(x+w, y, 126, 195, 12, 255, "rb", 0, "[On]")
515 end
516 }
517}
518local svg_patterns = {}
519
520local function table_get_keys(tbl)
521 local keys = {}
522 for key, _ in pairs(tbl) do
523 table_insert(keys, key)
524 end
525 return keys
526end
527
528local function gen_pattern(width, height)
529 local svg = [[
530<svg width="]] .. width .. [[" height="]] .. height .. [[" viewBox="0 0 ]] .. width .. [[ ]] .. height .. [[">
531<rect width="]] .. width .. [[" height="]] .. height .. [[" y="0" x="0" fill="#151515"/>
532#pattern
533</svg>
534]]
535 for x=0, width, 4 do
536 for y=0, height, 4 do
537 local pattern = [[
538<rect height="3" width="1" x="]] .. x+1 .. [[" y="]] .. y .. [[" fill="#0d0d0d"/>
539<rect height="1" width="1" x="]] .. x+3 .. [[" y="]] .. y .. [[" fill="#0d0d0d"/>
540<rect height="2" width="1" x="]] .. x+3 .. [[" y="]] .. y+2 .. [[" fill="#0d0d0d"/>
541]]
542 svg = svg:gsub("#pattern", pattern .. "#pattern")
543 end
544 end
545 svg = svg:gsub("#pattern\n", "")
546 return svg
547end
548
549local function draw_container(x, y, w, h, a, header, background_pattern)
550 a = a or 255
551 rectangle_outline(x, y, w, h, 18, 18, 18, a)
552 rectangle_outline(x+1, y+1, w-2, h-2, 62, 62, 62, a)
553 rectangle_outline(x+2, y+2, w-4, h-4, 44, 44, 44, a, 3)
554 rectangle_outline(x+5, y+5, w-10, h-10, 62, 62, 62, a)
555
556 if background_pattern then
557 local rw, ph, lxa, pw = w-12, h-12, 0
558
559 for i=6, 2, -1 do
560 pw = 2^i
561 if rw % pw < 7 then
562 break
563 end
564 end
565
566 for i=1, 2 do
567 if svg_patterns[pw] == nil or svg_patterns[pw][ph] == nil then
568 svg_patterns[pw] = svg_patterns[pw] or {}
569 svg_patterns[pw][ph] = renderer_load_svg(gen_pattern(pw, ph), pw, ph) or -1
570 end
571
572 if svg_patterns[pw][ph] ~= -1 then
573 for xa=0, rw-pw, pw do
574 renderer_texture(svg_patterns[pw][ph], x+6+xa+lxa, y+6, pw, ph, 255, 255, 255, a)
575 end
576 end
577
578 if rw % pw == 0 then break end
579 lxa, pw = rw - (rw % pw), rw % pw
580 rw = pw
581 end
582 else
583 renderer_rectangle(x+6, y+6, w-12, h-12, 25, 25, 25, a)
584 end
585
586 if header then
587 local x, y = x+7, y+7
588 local w1, w2 = math_floor((w-14)/2), math_ceil((w-14)/2)
589
590 for i=1, 2 do
591 renderer_gradient(x, y, w1, 1, 59, 175, 222, a, 202, 70, 205, a, true)
592 renderer_gradient(x+w1, y, w2, 1, 202, 70, 205, a, 201, 227, 58, a, true)
593 y, a = y+1, a*0.2
594 end
595 end
596end
597
598-- set up menu
599local custom_items_names, custom_items_groups = {}, {}
600
601local j=1
602for i=1, #custom_items do
603 local item = custom_items[i]
604 if item.group == nil then
605 table_insert(custom_items_names, item.name)
606 j = j + 1
607 else
608 if custom_items_groups[item.group] == nil then
609 custom_items_groups[item.group] = {i=j}
610 end
611 table_insert(custom_items_groups[item.group], item)
612 end
613end
614
615for _, group_items in pairs(custom_items_groups) do
616 local names = {}
617 for i=1, #group_items do
618 table_insert(names, group_items[i].name)
619 end
620 table_insert(custom_items_names, group_items.i, names)
621end
622
623local container = ui_lib.new("VISUALS", "Other ESP")
624local indicators = container:combobox("Indicators", {"Off", "Built-in", "Custom"}) {
625 {"Built-in",
626 additional = container:checkbox("Additional indicators") {
627 types = container:multiselect("\nAdditional indicator types", table_get_keys(bool_items))
628 },
629 move_up = container:slider("Move indicators", 0, 60, 0, true, "", 1, {[0] = "Off"})
630 },
631 {"Custom",
632 custom_types = container:multiselect("Indicator types", custom_items_names),
633 custom_color = container:color_picker("Indicator color", 240, 240, 240, 255)
634 }
635}
636indicators:set("Built-in")
637
638local dragging_indicators = dragging.new("indicators", 15, 420)
639
640client_set_event_callback("paint", function()
641 local indicators_value = indicators:get()
642
643 if indicators_value == "Built-in" then
644 local value = indicators.move_up:get()
645
646 if value > 0 then
647 for i=1, value do
648 renderer_indicator(255, 255, 255, 0, "A")
649 end
650 end
651
652 if indicators.additional:get() and entity_is_alive(entity_get_local_player()) and #indicators.additional.types:get() > 0 then
653 local x, y = 10
654 y = renderer_indicator(255, 255, 255, 0, "Additional indicators")
655
656 local active_bool_items = indicators.additional.types:get()
657 for i=1, #active_bool_items do
658 local item = bool_items[active_bool_items[i]]
659
660 if item then
661 local enabled = true
662 for i=1, #item.references do
663 local value = item.references[i]:get()
664 if not value or (type(value) == "table" and #value == 0) then
665 enabled = false
666 end
667 end
668
669 if item.width == nil or item.height == nil then
670 item.width, item.height = renderer_measure_text("+", item.text)
671 end
672
673 local r, g, b, a = unpack(enabled and {126, 195, 12, 255} or {255, 0, 0, 255})
674 renderer_text(x, y, r, g, b, a, "+", 0, item.text)
675
676 x = x + item.width + 8
677 end
678 end
679
680 if indicators.additional.types:contains("Fake lag") then
681 end
682 end
683 else
684 local y = 10
685 for i=1, 100 do
686 y = renderer_indicator(255, 255, 255, 0, "A")
687 if 0 > y then
688 break
689 end
690 end
691 end
692
693 if indicators_value == "Custom" and entity_is_alive(entity_get_local_player()) then
694 local screen_width, screen_height = client_screen_size()
695 local x, y = dragging_indicators:get()
696
697 local align_right = x > screen_width/2
698 local margin = 3
699 local types = indicators.custom_types:get()
700
701 local items_drawn, text_width = {}, 0
702 for i=1, #custom_items do
703 local item = custom_items[i]
704
705 if table_contains(types, item.name) then
706 if item.get_should_draw == nil or item:get_should_draw() then
707 table_insert(items_drawn, item)
708 end
709
710 local w_t = item:get_text_width()
711 text_width = math_max(text_width, w_t)
712 end
713 end
714
715 if #items_drawn > 0 then
716 local y_item, h_item = {}, {}
717 local width, height = 120, 10
718
719 for i=1, #items_drawn do
720 local item = items_drawn[i]
721 local w, h = item:get_size(text_width)
722
723 y_item[item], h_item[item] = y+height, h
724
725 width = math_max(width, w)
726 height = height + h + ((i == #items_drawn) and 0 or margin)
727 end
728 height = height + 12
729
730 dragging_indicators:drag(width, height)
731
732 draw_container(x, y, width, height, 255, true, true)
733 local r, g, b, a = indicators.custom_color:get()
734
735 local inner_x, inner_y, inner_w, inner_h = x+10, y+15, width-20, height-25
736 for i=1, #items_drawn do
737 local item = items_drawn[i]
738 item:draw(inner_x, y_item[item], inner_w, h_item[item], align_right, text_width, r, g, b, a)
739 end
740 end
741 end
742end)