QuestionHelpAdding a table to my aimbot

Posts 1–7 of 7 · Page 1 of 1
Adding a table to my aimbot
For efficiency reasons, I want to add a table to my aimbot. I currently am using basic ones but I want to create a table, insert every player online into it, and then find the closest one and aim. I have a working aimbot script me and my friend came up with but we're stuck on how to integrate thistable w/o major changing or breaking the code. We're kind a new to Lua. Here's the code..

Code:
hook.Add( "Think", "ThinkAboutIt", function()
    if GetConVarNumber(rook.."Aimbot") == 1 then
		if input.IsButtonDown(12) then
			local closest = nil
			local NearestTarget = 0
			for k, v in pairs( player.GetAll() ) do
				local Target = ( Vector( v:GetPos() ):Distance( Vector( LocalPlayer():GetPos() ) ) )
				if Target ~= 0 then 
					if Target < NearestTarget or NearestTarget == 0 then
						NearestTarget = Target
                        if NearestTarget == Target then
                            closest = v
                        end
					end
					if closest == nil then end
					if closest:LookupBone("ValveBiped.Bip01_Head1") == nil then
						LocalPlayer():SetEyeAngles( (closest:EyePos()-LocalPlayer():GetShootPos()):Angle() )
					else 
						local closesthead = closest:LookupBone("ValveBiped.Bip01_Head1")
						local closestheadpos,closestheadang = closest:GetBonePosition(closesthead)
						LocalPlayer():SetEyeAngles((closestheadpos - LocalPlayer():GetShootPos()):Angle())
					end
				end
			end
        end
	end
end)
I'm pretty proud of what we've got so far, but we really need help with this one :P
mpgh . net/forum/showthread.php?t=680412
"script me and my friend came up with"

yeah good one
Quote Originally Posted by meggerman View Post
mpgh . net/forum/showthread.php?t=680412
"script me and my friend came up with"

yeah good one
Ours just uses the word "closest" too, that does not make it the same thing lmao. Look at how ours works. Do you know lua or just Ctrl+F for one word?
A table won't make this run any faster, it'd be exactly the same but without a function call. This tells you how the important parts work, you could learn a thing or 2 from it.
Quote Originally Posted by Cyaegha View Post
A table won't make this run any faster, it'd be exactly the same but without a function call. This tells you how the important parts work, you could learn a thing or 2 from it.
The table is mostly to clean things, and also I want to make it not target friends/teammates, but I can only do that by removing by value in a table or ending the whole function. The EOF makes it target nobody, so I feel I need to implement a table. Thanks for the resources but alas, it won't help me in adding a table.
Quote Originally Posted by JayFromSubway View Post
The table is mostly to clean things, and also I want to make it not target friends/teammates, but I can only do that by removing by value in a table or ending the whole function. The EOF makes it target nobody, so I feel I need to implement a table. Thanks for the resources but alas, it won't help me in adding a table.
You don't need to add a table. Just add "if (condition) then continue end" in the for loop.
Quote Originally Posted by Cyaegha View Post
You don't need to add a table. Just add "if (condition) then continue end" in the for loop.
I am genuinely embarrassed I didn't think of a continue loop...just used to "wiki'ing everything" lol. Thanks!

//Solved
Posts 1–7 of 7 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?