 # 3rd Person CrossHairs

Well i tried making my own crosshairs for my 3rd person script but it didn’t work. So i figure i’ll ask someone else for some help. I’m sure this will be really easy for an experienced scripter heres my lua for my calc view.
[lua]function MyCalcView(ply, pos, angles, fov)
local view = {}
view.origin = pos-(angles:Forward()*50)-(angles:Right()*25)
view.angles = angles
view.fov = fov

``````return view
``````

end

hook.Add(“CalcView”, “MyCalcView”, MyCalcView)
hook.Add(“ShouldDrawLocalPlayer”, “MyHax ShouldDrawLocalPlayer”, function(ply)
return true
end)
[/lua]

[lua]
hook.Add(“HUDPaint”,“Crosshair”,function()
–gets the center of the screen
local p = (LocalPlayer():EyeAngles():Forward() * 2500):ToScreen()
local x,y = p.x, p.y

–set the drawcolor
surface.SetDrawColor( 0, 255, 0, 255 )

local gap = 5
local length = gap + 15

–draw the crosshair
surface.DrawLine( x - length, y, x - gap, y )
surface.DrawLine( x + length, y, x + gap, y )
surface.DrawLine( x, y - length, x, y - gap )
surface.DrawLine( x, y + length, x, y + gap )

end )
[/lua]

something like that.

Wasn’t this helpful: http://www.facepunch.com/showthread.php?p=21720535#post21720535

I posted a whole script there D:

It was but i tried messing with it and i had no luck =/ also your code makes a cross that just kind of is there if move around but is sluggish and in the wrong place by a lot.

[lua]
hook.Add(“HUDPaint”,“Crosshair”,function()
local p = LocalPlayer():GetEyeTrace().HitPos:ToScreen()
local x,y = p.x, p.y

``````--set the drawcolor
surface.SetDrawColor( 0, 255, 0, 255 )

local gap = 5
local length = gap + 15

--draw the crosshair
surface.DrawLine( x - length, y, x - gap, y )
surface.DrawLine( x + length, y, x + gap, y )
surface.DrawLine( x, y - length, x, y - gap )
surface.DrawLine( x, y + length, x, y + gap )
``````

end )
[/lua]

Remember kids always use trace lines.

works great thanks!