Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local db = database.read('ADDONS_D') 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 ui_get = ui.get
- local package_searchpath = package.searchpath
- local get_local_player = entity.get_local_player
- local function file_exists(filename)
- return package_searchpath("", filename) == filename
- end
- local function sound_exists(name)
- return file_exists("./csgo/sound/" .. name)
- end
- local sounds = {
- ["Aimware"] = "cod.wav",
- ["Bell"] = "bell.wav",
- ["Fatality"] = "fatality.wav",
- ["Bubble"] = "bubble.wav",
- ["Hentai 1"] = "hentai1.wav",
- ["Hentai 2"] = "hitsound.wav",
- }
- local sound_names = {}
- for k,v in pairs(sounds) do
- if sound_exists(v) then
- table.insert(sound_names, k)
- end
- end
- table.sort(sound_names)
- if #sound_names <= 0 then
- return error('hitmarker.lua > there is no sounds "\\csgo\\sound"')
- end
- local menu = ui_lib.new("AA", "Fake lag")
- local lable = ui.new_label("AA", "Fake lag", "=======================")
- local enabled_ref = menu:checkbox("Alternate hit marker sound")
- local sound_ref = menu:combobox("\n hitsound_override", sound_names)
- local sound_vol = menu:slider("Volume multiplier \n hitsound_vol_multiplier", 1, 50, 10, true, "x", 0.1)
- local lable1 = ui.new_label("AA", "Fake lag", "=======================")
- client.set_event_callback("player_hurt", function(e)
- if not enabled_ref:get() or e.attacker == nil then
- return
- end
- local me = entity.get_local_player()
- local userid = client.userid_to_entindex(e.userid)
- local attacker = client.userid_to_entindex(e.attacker)
- local vol = sound_vol:get() / 10
- for k, v in pairs(sounds) do
- if attacker == me and userid ~= me and k == sound_ref:get() and sound_exists(v) then
- local command = "playvol " .. v .. " "
- if vol <= 1 then
- client.exec(command .. vol)
- else
- local m_vol = math.floor(vol + 0.9)
- for i=1, m_vol do
- local volume = 1
- if m_vol ~= vol and i==m_vol then
- volume = vol-math.floor(vol)
- end
- client.exec(command .. volume)
- end
- end
- return
- end
- end
- end)
- ---------------------------------------------------------
- ---------------------------------------------------------
- client.set_event_callback("paint_ui", function()
- if scripts_reloaded then
- enabled_ref:set(db.enabled_ref)
- sound_ref:set(db.sound_ref)
- sound_vol:set(db.sound_vol)
- scripts_reloaded = false
- else
- db.enabled_ref = enabled_ref:get()
- db.sound_ref = sound_ref:get()
- db.sound_vol = sound_vol:get()
- database.write('ADDONS_D', db)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement