HelpQuick LUA Help

Posts 1–13 of 13 · Page 1 of 1
Quick LUA Help
Hey, I'm somewhat new to lua, and I've been making my own hack over the past few days with help from a couple friends and I've usually been able to fix my own errors, but this one has got me stumped, I've been trying to make a very basic aimbot into an aimkey, so whenever I click enable aimkey in my menu, and hold F, it would do as an aimbot would. The problem I'm having is this: [gDaap Bypasser] [ERROR] Error loading Lua code into buffer (Syntax Error)[lua/includes/init.lua:541: '<name>' expected near 'if']
line 541 is the if target:IsPlayer() line. but since I'm quite new I don't know how to fix this. Thanks for your time everyone!

Code:
function aimkey() 
	if input.IsKeyDown(KEY_F) then
	local ply = LocalPlayer() 
	local trace = util.GetPlayerTrace( ply ) 
	local traceRes = util.TraceLine( trace ) 
	if traceRes.HitNonWorld then 
		local target = traceRes.
		if target:IsPlayer() then 
			local targethead = target:LookupBone("ValveBiped.Bip01_Head1")
			local targetheadpos,targetheadang = target:GetBonePosition(targethead)
			ply:SetEyeAngles((targetheadpos - ply:GetShootPos()):Angle())
				end
			end
		end
	end
end
hook.Add("Think","aimbot",aimbot)
local function aimkeyON()
    print("Hold F for Aimbot")
    chat.AddText( Color( 255, 127, 0), "Hold F for Aimbot")
    hook.Add("Think","ak",aimKey)
end
concommand.Add("trekt_aimkey_enable",aimkeyON)
local function aimkeyOFF()
	print("AimKey Disabled"
	chat.AddText( Color( 255, 127, 0), "AimKey Disabled"
    hook.Remove("Think","ak")
end
concommand.Add("trekt_aimkey_disable",aimkeyOFF)
Quote Originally Posted by razor_' View Post
or maybe you could just look at this first <link>

also use code tags
After studying the aimbot I had a couple questions, Please bare with me here as I am pretty novice at lua, but trying to learn.

1. What would I have to change to make it work in my menu
2. No one has ever really explained simply how/when to use args, I've always had help with them, but i've decided to come here instead of asking my friends.
yeah well this is terrible, but whatever help the idiots
most likely this is what i would do
Code:
local aimkey = CreateClientConVar("aimkey", 0, true, false)
then you can delete your other 2 functions and make a better aimbot, also please dont use gdaap
Quote Originally Posted by x0ger_ View Post
yeah well this is terrible, but whatever help the idiots
most likely this is what i would do
Code:
local aimkey = CreateClientConVar("aimkey", 0, true, false)
then you can delete your other 2 functions and make a better aimbot, also please dont use gdaap
Spare me.. As i've mentioned twice before i'm extremely new to lua, so hop off

//dicktoolong
nice meme dude, anyway something like this: http ://pastebin. com/3zeAGSwU
download hac booty and reference from there: http ://fastdl.unitedhosts. org/hac/
Quote Originally Posted by ryanlaucek View Post
Hey, I'm somewhat new to lua, and I've been making my own hack over the past few days with help from a couple friends and I've usually been able to fix my own errors, but this one has got me stumped, I've been trying to make a very basic aimbot into an aimkey, so whenever I click enable aimkey in my menu, and hold F, it would do as an aimbot would. The problem I'm having is this: [gDaap Bypasser] [ERROR] Error loading Lua code into buffer (Syntax Error)[lua/includes/init.lua:541: '<name>' expected near 'if']
line 541 is the if target:IsPlayer() line. but since I'm quite new I don't know how to fix this. Thanks for your time everyone!

Code:
function aimkey() 
	if input.IsKeyDown(KEY_F) then
	local ply = LocalPlayer() 
	local trace = util.GetPlayerTrace( ply ) 
	local traceRes = util.TraceLine( trace ) 
	if traceRes.HitNonWorld then 
		local target = traceRes.
		if target:IsPlayer() then 
			local targethead = target:LookupBone("ValveBiped.Bip01_Head1")
			local targetheadpos,targetheadang = target:GetBonePosition(targethead)
			ply:SetEyeAngles((targetheadpos - ply:GetShootPos()):Angle())
				end
			end
		end
	end
end
hook.Add("Think","aimbot",aimbot)
local function aimkeyON()
    print("Hold F for Aimbot")
    chat.AddText( Color( 255, 127, 0), "Hold F for Aimbot")
    hook.Add("Think","ak",aimKey)
end
concommand.Add("trekt_aimkey_enable",aimkeyON)
local function aimkeyOFF()
	print("AimKey Disabled"
	chat.AddText( Color( 255, 127, 0), "AimKey Disabled"
    hook.Remove("Think","ak")
end
concommand.Add("trekt_aimkey_disable",aimkeyOFF)
Fixed your error here you go

Code:
function aimkey() 
	if input.IsKeyDown(KEY_F) then
	local ply = LocalPlayer() 
	local trace = util.GetPlayerTrace( ply ) 
	local traceRes = util.TraceLine( trace ) 
		if traceRes.HitNonWorld then 
			local target = traceRes.Entity
			if target:IsPlayer() then 
				local targethead = target:LookupBone("ValveBiped.Bip01_Head1")
				local targetheadpos,targetheadang = target:GetBonePosition(targethead)
				ply:SetEyeAngles((targetheadpos - ply:GetShootPos()):Angle())
			end
		end
	end
end
hook.Add("Think","ak",aimkey)

local function aimkeyON()
    print("Hold F for Aimbot")
    chat.AddText( Color( 255, 127, 0), "Hold F for Aimbot")
    hook.Add("Think","ak",aimKey)
end
concommand.Add("trekt_aimkey_enable",aimkeyON)
local function aimkeyOFF()
	print("AimKey Disabled")
	chat.AddText( Color( 255, 127, 0), "AimKey Disabled")
    hook.Remove("Think","ak")
end
concommand.Add("trekt_aimkey_disable",aimkeyOFF)
Quote Originally Posted by suchisgood View Post
Fixed your error here you go

Code:
function aimkey() 
	if input.IsKeyDown(KEY_F) then
	local ply = LocalPlayer() 
	local trace = util.GetPlayerTrace( ply ) 
	local traceRes = util.TraceLine( trace ) 
		if traceRes.HitNonWorld then 
			local target = traceRes.Entity
			if target:IsPlayer() then 
				local targethead = target:LookupBone("ValveBiped.Bip01_Head1")
				local targetheadpos,targetheadang = target:GetBonePosition(targethead)
				ply:SetEyeAngles((targetheadpos - ply:GetShootPos()):Angle())
			end
		end
	end
end
hook.Add("Think","ak",aimkey)

local function aimkeyON()
    print("Hold F for Aimbot")
    chat.AddText( Color( 255, 127, 0), "Hold F for Aimbot")
    hook.Add("Think","ak",aimKey)
end
concommand.Add("trekt_aimkey_enable",aimkeyON)
local function aimkeyOFF()
	print("AimKey Disabled")
	chat.AddText( Color( 255, 127, 0), "AimKey Disabled")
    hook.Remove("Think","ak")
end
concommand.Add("trekt_aimkey_disable",aimkeyOFF)
I only had to remove 1 end? :0
Quote Originally Posted by ryanlaucek View Post
I only had to remove 1 end? :0
Nope you was missing a ) at chat. and print, you was forgot to remove 1 end also traceRes. didn't have Entity on the end, I could go on, Quite alot of things you had wrong!
Quote Originally Posted by suchisgood View Post
Nope you was missing a ) at chat. and print, you was forgot to remove 1 end also traceRes. didn't have Entity on the end, I could go on, Quite alot of things you had wrong!
Thanks c: I'm making a hack with a derma menu with sliders and stuff, which is a bit out of my comfort zone, Would you be able to add me on steam and answer some questions if i have any?
Quote Originally Posted by ryanlaucek View Post
Thanks c: I'm making a hack with a derma menu with sliders and stuff, which is a bit out of my comfort zone, Would you be able to add me on steam and answer some questions if i have any?
Use mpgh, I'm sure some skids can help you, Aswell as a pro here!
Posts 1–13 of 13 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us