Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local db = database.read('ADDONS_G') or {}
- local scripts_reloaded = true
- local 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)))j(G,string.format("Cannot set menu item values: '%s'",H))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 then if type(k[1])=="boolean"then O="hotkey"end 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))}j(T[1]==true,string.format("Cannot set menu item values: '%s'",T[2]))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:set_visible(U)local S=q[self]ui.set_visible(S.reference,U)S.visible=U end;function r:set_default(k)j(globals.realtime()==p,"Cannot set default menu item value inside callbacks. This must be done during script load.")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 j(getmetatable(F)==s,"Cannot add a child to menu item: Child must be a menu_item object. Make sure you are not using a UI reference.")j(F.reference~=self.reference,"Cannot parent a menu item to itself.")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]j(S.is_gamesense_reference==false,"Cannot create children of, parent, or add callbacks to built-in menu references.")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"")j(type(L)=="string"and L~="",ad,"Cannot create a menu item with a name that is not a string, or is empty.")if ab==ui.new_slider then local ae,af,ag,ah,ai,aj,ak=unpack(y)j(type(ae)=="number",ad,"the minimum value must be a number.")j(type(af)=="number",ad,"the maximum value must be a number.")j(ae<af,ad,"the minimum value must be lower than the maximum")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;j(type(ag)=="number"or type(ag)=="nil",ad,"the default value must be a number")if ag~=nil then j(ag>=ae and ag<=af,ad,"the default value must be between the minimum and maximum values.")end;j(type(ah)=="boolean"or type(ah)=="nil",ad,"the show_tooltip value must be a boolean")j(type(ai)=="string"or type(ai)=="nil",ad,"the unit must be a string or nil.")if ai~=nil then j(ai:len()>=0 and ai:len()<3,ad,"the unit must be 1 or 2 characters in length.")end;j(type(aj)=="number"or type(aj)=="nil",ad,"the scale must be a number or nil.")j(type(ak)=="table"or type(ak)=="nil",ad,"the tooltips must be a table or nil.")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]j(type(I)=="string"or type(I)=="number",ad,"menu element #",g," must be a string or number.")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)j(type(ap)=="boolean",ad,"the inline parameter is not a boolean value.")elseif ab==ui.new_button then local Z=unpack(y)j(type(Z)=="function",ad,"the callback value given is not a function.")elseif ab==ui.new_color_picker then local aq,ar,as,at=unpack(y)j(type(aq)=="number",ad,"its red channel value is not a number.")j(type(ar)=="number",ad,"its green channel value is not a number.")j(type(as)=="number",ad,"its blue channel value is not a number.")j(type(at)=="number",ad,"its alpha channel value is not a number.")j(aq>=0 and aq<=255,ad,"its red channel value is not between 0-255.")j(ar>=0 and ar<=255,ad,"its green channel value is not between 0-255.")j(as>=0 and as<=255,ad,"its blue channel value is not between 0-255.")j(at>=0 and at<=255,ad,"its alpha channel value is not between 0-255.")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 table.insert(au,a0[g][1])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","Movement"},SKINS={"Weapon skin","Knife options","Glove options"},PLAYERS={"Players","Adjustments"},CONFIG={"Lua", "Presets"},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(type(J)=="string"and J~="","Cannot create a menu item with a tab that is not a string, or is empty.")j(type(K)=="string"and K~="","Cannot create a menu item with a container that is not a string, or is empty.")J=J:upper()j(av[J]~=nil,string.format("Cannot create a menu with the tab name '%s' as it is not a valid tab.",J))j(av[J][K:lower()]~=nil,string.format("Cannot create a menu with the container name '%s' as it is not a valid name for the tab '%s'.",K,J))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)}j(ax[1]==true,"Cannot reference a Gamesense menu item: the menu item does not exist.")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}) end)()
- ---------------------------------------------------------
- ---------------------------------------------------------
- local ALPHA = 255
- local type = { "Off", "Basic", "Modern" }
- local 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)()
- local menuu = ui_lib("CONFIG", "Presets")
- local active = menuu:combobox("Hotkey list", type)
- local color_picker = ui.new_color_picker("CONFIG", "Presets", "Hotkey list color picker", 89, 119, 239, 165)
- local hotkeys_dragging = dragging.new("Hotkeys", 100, 200)
- local references = { }
- local hotkey_id = {
- "holding",
- "toggled",
- "disabled"
- }
- local function item_count(tab)
- if tab == nil then return 0 end
- if #tab == 0 then
- local val = 0
- for k in pairs(tab) do
- val = val + 1
- end
- return val
- end
- return #tab
- end
- local function create_item(tab, container, name, arg, cname)
- local collected = { }
- local reference = { ui.reference(tab, container, name) }
- for i=1, #reference do
- if i <= arg then
- collected[i] = reference[i]
- end
- end
- references[cname or name] = collected
- end
- local function paint_handler()
- local menu_active = active:get()
- if menu_active == type[1] then
- return
- end
- local stl = {
- [type[2]] = { 26, 11, 5 },
- [type[3]] = { 23, 3, 4 }
- }
- local m_items = { }
- local x_offset, y_offset = 0, stl[menu_active][1]
- for ref in pairs(references) do
- local current_ref = references[ref]
- local count = item_count(current_ref)
- local active = true
- local state = { ui.get(current_ref[count]) }
- if count > 1 then
- active = ui.get(current_ref[1])
- end
- if active and state[2] ~= 0 and (state[2] == 3 and not state[1] or state[2] ~= 3 and state[1]) then
- m_items[ref] = hotkey_id[state[2]]
- local ms = renderer.measure_text(nil, ref)
- if ms > x_offset then
- x_offset = ms
- end
- end
- end
- if ui.is_menu_open() then
- x_offset = 70
- m_items = {
- ["menu item"] = "state"
- }
- end
- if item_count(m_items) == 0 then
- return
- end
- -- do stuff
- local x, y = hotkeys_dragging:get()
- local w, h = 75 + x_offset, stl[menu_active][2] + (15*item_count(m_items))
- local r, g, b, a = ui.get(color_picker)
- local a = ALPHA > a and a or ALPHA
- local n = "hotkey list"
- if menu_active == type[3] then
- renderer.rectangle(x, y, w, 2, r, g, b, ALPHA)
- renderer.rectangle(x, y + 2, w, 18, 17, 17, 17, a)
- renderer.text(x - renderer.measure_text(nil, n) / 2 + w/2, y + 4, 255, 255, 255, 255, "", 0, n)
- else
- renderer.rectangle(x, y, w, 20, 0, 0, 0, a)
- renderer.text(x+5, y+3, 255, 255, 255, 255, "", 0, n)
- renderer.rectangle(x, y + 19, w, 2, r, g, b, ALPHA)
- renderer.rectangle(x, y + 20, w, h, 17, 17, 17, a)
- end
- for key, val in pairs(m_items) do
- local key_type = "[" .. val .. "]"
- renderer.text(x + stl[menu_active][3], y + y_offset, 255, 255, 255, 255, "", 0, key)
- renderer.text(x + w - renderer.measure_text(nil, key_type) - 5, y + y_offset, 255, 255, 255, 255, "", 0, key_type)
- y_offset = y_offset + 15
- end
- hotkeys_dragging:drag(w, h*2)
- end
- local create_custom_item = function(req, ref)
- local reference_if_exists = function(...)
- if pcall(ui.reference, ...) then
- return true
- end
- end
- local get_script_name = function()
- local funca, err = pcall(function() _G() end)
- return (not funca and (err:match("\\(.*):"):sub(1, -3)) or nil)
- end
- if not reference_if_exists(ref[1], ref[2], ref[3]) then
- if pcall(require, req) and reference_if_exists(ref[1], ref[2], ref[3]) then
- create_item(unpack(ref))
- else
- client.log(string.format('%s: Unable to reference - %s (%s.lua/ljbc)', get_script_name(), ref[3], req))
- end
- else
- create_item(unpack(ref))
- end
- end
- -- Creating menu items
- create_item("LEGIT", "Aimbot", "Enabled", 2, "Legit aimbot")
- create_item("LEGIT", "Triggerbot", "Enabled", 2, "Legit triggerbot")
- create_item("RAGE", "Aimbot", "Enabled", 2, "Rage aimbot")
- create_item("RAGE", "Aimbot", "Force safe point", 1, "Safe point")
- create_item("RAGE", "Other", "Quick stop", 2)
- create_item("RAGE", "Other", "Force body aim", 1)
- create_item("RAGE", "Other", "Duck peek assist", 1)
- create_item("RAGE", "Other", "Double tap", 2)
- create_item("RAGE", "Other", "Anti-aim correction override", 1, "Resolver override")
- create_item("AA", "Anti-aimbot angles", "Freestanding", 2)
- create_item("AA", "Other", "Slow motion", 2)
- create_item("AA", "Other", "On shot anti-aim", 2)
- create_item("MISC", "Movement", "Z-Hop", 2)
- create_item("MISC", "Movement", "Pre-speed", 2)
- create_item("MISC", "Movement", "Blockbot", 2)
- create_item("MISC", "Movement", "Jump at edge", 2)
- create_item("MISC", "Miscellaneous", "Last second defuse", 1)
- create_item("MISC", "Miscellaneous", "Free look", 1)
- create_item("MISC", "Miscellaneous", "Ping spike", 2)
- create_item("MISC", "Miscellaneous", "Automatic grenade release", 2, "Grenade release")
- create_item("VISUALS", "Player ESP", "Activation type", 1, "Visuals")
- -- create_custom_item("shitch", { "CONFIG", "Presets", "snitchmode", 1 })
- client.set_event_callback("paint", paint_handler)
- ---------------------------------------------------------
- ---------------------------------------------------------
- client.set_event_callback("paint_ui", function()
- if scripts_reloaded then
- active:set(db.active)
- scripts_reloaded = false
- else
- db.active = active:get()
- database.write('ADDONS_G', db)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement