Vacbroza

Untitled

Oct 24th, 2020
558
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local a={}a.__index=a;function Vector3(b,c,d)if type(b)~="number"then b=0.0 end;if type(c)~="number"then c=0.0 end;if type(d)~="number"then d=0.0 end;b=b or 0.0;c=c or 0.0;d=d or 0.0;return setmetatable({x=b,y=c,z=d},a)end;function a.__eq(e,f)return e.x==f.x and e.y==f.y and e.z==f.z end;function a.__unm(e)return Vector3(-e.x,-e.y,-e.z)end;function a.__add(e,f)local g=type(e)local h=type(f)if g=="table"and h=="table"then return Vector3(e.x+f.x,e.y+f.y,e.z+f.z)elseif g=="table"and h=="number"then return Vector3(e.x+f,e.y+f,e.z+f)elseif g=="number"and h=="table"then return Vector3(e+f.x,e+f.y,e+f.z)end end;function a.__sub(e,f)local g=type(e)local h=type(f)if g=="table"and h=="table"then return Vector3(e.x-f.x,e.y-f.y,e.z-f.z)elseif g=="table"and h=="number"then return Vector3(e.x-f,e.y-f,e.z-f)elseif g=="number"and h=="table"then return Vector3(e-f.x,e-f.y,e-f.z)end end;function a.__mul(e,f)local g=type(e)local h=type(f)if g=="table"and h=="table"then return Vector3(e.x*f.x,e.y*f.y,e.z*f.z)elseif g=="table"and h=="number"then return Vector3(e.x*f,e.y*f,e.z*f)elseif g=="number"and h=="table"then return Vector3(e*f.x,e*f.y,e*f.z)end end;function a.__div(e,f)local g=type(e)local h=type(f)if g=="table"and h=="table"then return Vector3(e.x/f.x,e.y/f.y,e.z/f.z)elseif g=="table"and h=="number"then return Vector3(e.x/f,e.y/f,e.z/f)elseif g=="number"and h=="table"then return Vector3(e/f.x,e/f.y,e/f.z)end end;function a.__tostring(e)return"("..e.x..", "..e.y..", "..e.z..")"end;function a:clear()self.x=0.0;self.y=0.0;self.z=0.0 end;function a:unpack()return self.x,self.y,self.z end;function a:length_2d_sqr()return self.x*self.x+self.y*self.y end;function a:length_sqr()return self.x*self.x+self.y*self.y+self.z*self.z end;function a:length_2d()return math.sqrt(self:length_2d_sqr())end;function a:length()return math.sqrt(self:length_sqr())end;function a:dot(i)return self.x*i.x+self.y*i.y+self.z*i.z end;function a:cross(i)return Vector3(self.y*i.z-self.z*i.y,self.z*i.x-self.x*i.z,self.x*i.y-self.y*i.x)end;function a:dist_to(i)return(i-self):length()end;function a:is_zero(j)j=j or 0.001;if self.x<j and self.x>-j and self.y<j and self.y>-j and self.z<j and self.z>-j then return true end;return false end;function a:normalize()local k=self:length()if k<=0.0 then return 0.0 end;self.x=self.x/k;self.y=self.y/k;self.z=self.z/k;return k end;function a:normalize_no_len()local k=self:length()if k<=0.0 then return end;self.x=self.x/k;self.y=self.y/k;self.z=self.z/k end;function a:normalized()local k=self:length()if k<=0.0 then return Vector3()end;return Vector3(self.x/k,self.y/k,self.z/k)end;function clamp(l,m,n)if l<m then return m elseif l>n then return n end;return l end;function normalize_angle(o)local p;local q;q=tostring(o)if q=="nan"or q=="inf"then return 0.0 end;if o>=-180.0 and o<=180.0 then return o end;p=math.fmod(math.fmod(o+360.0,360.0),360.0)if p>180.0 then p=p-360.0 end;return p end;function vector_to_angle(r)local k;local s;local t;k=r:length()if k>0.0 then s=math.deg(math.atan(-r.z,k))t=math.deg(math.atan(r.y,r.x))else if r.x>0.0 then s=270.0 else s=90.0 end;t=0.0 end;return Vector3(s,t,0.0)end;function angle_forward(o)local u=math.sin(math.rad(o.x))local v=math.cos(math.rad(o.x))local w=math.sin(math.rad(o.y))local x=math.cos(math.rad(o.y))return Vector3(v*x,v*w,-u)end;function angle_right(o)local u=math.sin(math.rad(o.x))local v=math.cos(math.rad(o.x))local w=math.sin(math.rad(o.y))local x=math.cos(math.rad(o.y))local y=math.sin(math.rad(o.z))local z=math.cos(math.rad(o.z))return Vector3(-1.0*y*u*x+-1.0*z*-w,-1.0*y*u*w+-1.0*z*x,-1.0*y*v)end;function angle_up(o)local u=math.sin(math.rad(o.x))local v=math.cos(math.rad(o.x))local w=math.sin(math.rad(o.y))local x=math.cos(math.rad(o.y))local y=math.sin(math.rad(o.z))local z=math.cos(math.rad(o.z))return Vector3(z*u*x+-y*-w,z*u*w+-y*x,z*v)end;function get_FOV(A,B,C)local D;local E;local F;local G;E=angle_forward(A)F=(C-B):normalized()G=math.acos(E:dot(F)/F:length())return math.max(0.0,math.deg(G))end;local H=entity.get_prop;local I=ui.get;local J=entity.get_local_player;local K=entity.get_players;local L=entity.get_player_weapon;local M=entity.is_enemy;local N=entity.is_alive;local O=entity.is_dormant;local P=math.atan2;local Q=math.deg;local R=math.sqrt;local S,T=Vector3(0,0,0),Vector3(0,0,0)local U,V,W=0,0,0;local X=10;local Y=80;local function Z(_,a0,a1,a2,a3,a4)local a5,a6,a7;local a8,a9,aa;if a2==nil then a8,a9,aa=_,a0,a1;a5,a6,a7=client.eye_position()if a5==nil then return end else a5,a6,a7=_,a0,a1;a8,a9,aa=a2,a3,a4 end;local ab,ac,ad=a8-a5,a9-a6,aa-a7;if ab==0 and ac==0 then return 0,ad>0 and 270 or 90 else local t=Q(P(ac,ab))local ae=R(ab*ab+ac*ac)local s=Q(P(-ad,ae))return s,t end end;local af=ui.new_checkbox("VISUALS","Other ESP","Hit ESP")local ag=ui.new_combobox("VISUALS","Other ESP","\nHit ESP options",{"Only hit","Always"})local function ah(ai)ui.set_visible(ag,I(af))if not I(af)then return end;local aj=I(ag)local ak=aj=="Always"local al=J()if al==nil or not entity.is_alive(al)then return end;local am=Vector3(H(al,"m_vecAbsOrigin"))if am.x==nil then return end;local an=Vector3(client.eye_position())if an.x==nil then return end;if S==nil or T==nil then return end;local ao=K(true)if W>0 then local ap,aq=renderer.world_to_screen(an.x,an.y,an.z)if ap~=nil then renderer.text(ap,aq-25,255,0,0,255,"bc",0,"HIT")end;return end;local ar,as=renderer.world_to_screen(S.x,S.y,S.z)local at,au=renderer.world_to_screen(T.x,T.y,T.z)if ar~=nil and as~=nil then if U>0 then renderer.text(ar,as-25,255,165,0,255,"bc",0,"L "..U)elseif ak==true then renderer.text(ar,as-25,0,255,0,255,"bc",0,"L")end end;if at~=nil and ar~=nil then if V>0 then renderer.text(at,au-25,255,165,0,255,"bc",0,"R "..V)elseif ak==true then renderer.text(at,au-25,0,255,0,255,"bc",0,"R")end end end;local function av(ai)if not I(af)then return end;U,V,W=0,0,0;local al=J()if al==nil or not entity.is_alive(al)then return end;local am=Vector3(H(al,"m_vecAbsOrigin"))if am.x==nil then return end;local an=Vector3(client.eye_position())if an.x==nil then return end;local ao=K(true)local aw=nil;local s,t,ax=client.camera_angles()local ay=Vector3(0,t,0)local G=180;for az=1,#ao do local aA=ao[az]if M(aA)and N(aA)and not O(aA)then local aB=Vector3(entity.get_prop(aA,"m_vecOrigin"))local aC=get_FOV(ay,am,aB)if aC<G then G=aC;aw=aA end end end;local aB=Vector3(entity.get_prop(aw,"m_vecOrigin"))local aD,aE=Z(am.x,am.y,am.z,aB.x,aB.y,aB.z)ay=Vector3(aD,aE,0)if aw~=nil then local aF=Vector3(entity.get_prop(aw,"m_vecViewOffset"))local aG=aB+aF;local aH,aI,aJ=0,0;local aK,aL=X,X;local aM=-angle_right(ay)local aN=angle_right(ay)S=an+aM*aK;T=an+aN*aL;local aO,aP,aQ=entity.hitbox_position(al,0)aJ,W=client.trace_bullet(aw,aG.x,aG.y,aG.z,aO,aP,aQ)if W>0 then return end;while U<1 and aK<Y do S=an+aM*aK;aH,U=client.trace_bullet(aw,aG.x,aG.y,aG.z,S.x,S.y,S.z)aK=aK+X end;while V<1 and aL<Y do T=an+aN*aL;aI,V=client.trace_bullet(aw,aG.x,aG.y,aG.z,T.x,T.y,T.z)aL=aL+X end end end;client.set_event_callback("run_command",av)client.set_event_callback("paint",ah)
RAW Paste Data