local util = util local vgui = vgui local table = table local math = math local string = string local surface = surface local draw = draw local meta = FindMetaTable("Entity") local botBot = {} local getall = player.GetAll() local val1, val2, val3 = 0, 0, 0 local temp = 0 local autoshoot = 0 local aim = false local plyers = {} local bhop = false botBot.aim_enabled = CreateClientConVar( 'botBot_aim_enabled', 1, true, false ) botBot.aim_npc = CreateClientConVar( 'botBot_aim_targetnpcs', 0, true, false ) botBot.aim_maxdist = CreateClientConVar( 'botBot_aim_maxdist', 16340, true, false ) botBot.aim_autoshoot = CreateClientConVar( 'botBot_aim_autoshoot', 0, true, false ) botBot.aim_targetsteamfriends = CreateClientConVar( 'botBot_aim_targetsteamfriends', 1, true, false ) botBot.aim_targetadmins = CreateClientConVar( 'botBot_aim_targetadmins', 1, true, false ) botBot.aim_aimposition = CreateClientConVar( 'botBot_aim_aimposition', 1, true, false ) for k, v in pairs( getall ) do if v == LocalPlayer() then table.remove( getall, k ) end end local targs = {} timer.Create( "npccheck", 1, 0, function() npctargs = {} for k,v in pairs( ents.GetAll() ) do if v != LocalPlayer() and v:IsNPC() then table.insert( npctargs, v ) end end end ) local function FindPlayerByName( name ) for k,v in pairs( player.GetAll() ) do if string.find( v:Name(), name, 1, true ) then return v end end end function meta:GetVisible( self ) local trace = {} if self:IsPlayer() then trace = {start = LocalPlayer():GetShootPos(),endpos = self:HeadPos(),filter = {LocalPlayer(), self}} elseif self:IsNPC() then trace = {start = LocalPlayer():GetShootPos(),endpos = self:LocalToWorld(self:OBBCenter()),filter = {LocalPlayer(), self}} end local tr = util.TraceLine(trace) if tr.Fraction == 1 then return true else return false end end local meta = FindMetaTable("Entity") function meta:GetAlive( self ) local ret = false if self:IsValid() then if self:IsPlayer() then if self:Alive() then ret = true end elseif self:IsNPC() then if self:GetMoveType()!=0 then ret = true end end end return ret end function meta:GetBones() local ret = {} if self:IsPlayer() then ret = { h = self:GetBonePosition( self:LookupBone('ValveBiped.Bip01_Head1') ):ToScreen(), p = self:GetBonePosition( self:LookupBone('ValveBiped.Bip01_Spine') ):ToScreen(), r_t = self:GetBonePosition( self:LookupBone('ValveBiped.Bip01_R_Thigh') ):ToScreen(), r_c = self:GetBonePosition( self:LookupBone('ValveBiped.Bip01_R_Calf') ):ToScreen(), r_f = self:GetBonePosition( self:LookupBone('ValveBiped.Bip01_R_Foot') ):ToScreen(), r_ua = self:GetBonePosition( self:LookupBone('ValveBiped.Bip01_R_UpperArm') ):ToScreen(), r_fa = self:GetBonePosition( self:LookupBone('ValveBiped.Bip01_R_Forearm') ):ToScreen(), r_h = self:GetBonePosition( self:LookupBone('ValveBiped.Bip01_R_Hand') ):ToScreen(), l_t = self:GetBonePosition( self:LookupBone('ValveBiped.Bip01_L_Thigh') ):ToScreen(), l_c = self:GetBonePosition( self:LookupBone('ValveBiped.Bip01_L_Calf') ):ToScreen(), l_f = self:GetBonePosition( self:LookupBone('ValveBiped.Bip01_L_Foot') ):ToScreen(), l_ua = self:GetBonePosition( self:LookupBone('ValveBiped.Bip01_L_UpperArm') ):ToScreen(), l_fa = self:GetBonePosition( self:LookupBone('ValveBiped.Bip01_L_Forearm') ):ToScreen(), l_h = self:GetBonePosition( self:LookupBone('ValveBiped.Bip01_L_Hand') ):ToScreen(), n = self:GetBonePosition( self:LookupBone('ValveBiped.Bip01_Neck1') ):ToScreen() } end return ret end local function GetTargets() botBot.targets = {} for _,ent in pairs( ents.GetAll() ) do if ( ent:IsPlayer() ) and ( ent != LocalPlayer() ) then if botBot.esp_tar_ply:GetInt() == 1 and ent:IsPlayer() then table.insert( botBot.targets, ent ) elseif botBot.esp_tar_npc:GetInt() == 1 and ent:IsNPC() then table.insert( botBot.targets, ent ) end end end end function meta:HeadPos( self ) if self:IsPlayer() then local hbone = self:LookupBone('ValveBiped.Bip01_Head1') return self:GetBonePosition(hbone) else return self:GetPos() end end /*---------------------*\ --------#[Aimbot]#------- \*---------------------*/ local function FindTarget( pos ) if table.Count( table.Add( player.GetAll(), npctargs ) ) > 1 then local distance = math.huge local plys = {} local alltargs = {} if botBot.aim_npc:GetInt() == 1 then alltargs = table.Add( targs, npctargs ) else alltargs = targs end for k,v in pairs( alltargs ) do if v:GetAlive() and plys[k] != LocalPlayer() then local curdist = v:GetPos():Distance( pos ) if curdist < distance then table.insert( plys, v ) distance = curdist end end end for i = #plys, 1, -1 do if plys[i]:GetVisible() then if botBot.aim_targetsteamfriends:GetInt() == 0 then if plys[i]:GetFriendStatus() ~= "friend" then return plys[i] end elseif botBot.aim_targetadmins:GetInt() == 0 then if not plys[i]:IsAdmin() and not plys[i]:IsSuperAdmin() then return plys[i] end else return plys[i] end end end else return nil end end local function EntCheck( ent ) if !ent:IsValid() then return false end if !ent:IsPlayer() and !ent:IsNPC() then return false end if util.PointContents( ent:EyePos() ) == CONTENTS_SOLID then return false end return true end local function RandString() return tostring( math.Round( math.random( 52, 148) / math.random( 5, 100), math.random( 3, 14) ) ) end local function GetIndexInTable( var, tab ) for k,v in pairs( tab ) do if var == v then return k end end return false end concommand.Add( "+botbot_aim", function() aim = true end ) hook.Add( "CreateMove", "cmove", function( UCMD ) if aim == true and botBot.aim_enabled:GetInt() == 1 then local val, targ = pcall( FindTarget, LocalPlayer():GetPos() ) local val2, val3 = pcall( EntCheck, targ ) if val == true and val2 == true and val3 == true and #targs > 0 then local vec if botBot.aim_aimposition:GetInt() == 0 then vec = targ:HeadPos() elseif botBot.aim_aimposition:GetInt() == 1 then vec = targ:GetPos() + Vector( 0, 0, 40 ) else vec = targ:GetPos() end local targpos = ( vec - LocalPlayer():GetShootPos() ):Normalize():Angle() UCMD:SetViewAngles( targpos ) if botBot.aim_autoshoot:GetInt() == 1 and autoshoot == 0 then RunConsoleCommand( "+attack" ) autoshoot = 1 end elseif autoshoot == 1 then RunConsoleCommand( "-attack" ) autoshoot = 0 end end end ) concommand.Add( "-botbot_aim", function() aim = false if autoshoot == 1 then RunConsoleCommand( "-attack" ) autoshoot = 0 end end )