Alright, so I have my over the shoulder code, everything works fine and dandy! Great, but theres one problem.
Lets say you aim with the crosshair at a players head, it won't shoot at the cross hair but a small distance away.
Anyway to fix this? Maybe change the crosshair position?
[url]http://www.garrysmod.org/downloads/?a=view&id=97455[/url]
I think this has one.
[lua]
function render_square()
local ply = LocalPlayer()
local trace = ply:GetEyeTrace()
local pos = trace.HitPos:ToScreen()
local gap = 5
local length = gap + 5
if ply:Alive() then
surface.SetDrawColor( 255, 0, 0, 255) --Red
--draw the crosshair
surface.DrawLine( pos.x - length, pos.y, pos.x - gap, pos.y )
surface.DrawLine( pos.x + length, pos.y, pos.x + gap, pos.y )
surface.DrawLine( pos.x, pos.y - length, pos.x, pos.y - gap )
surface.DrawLine( pos.x, pos.y + length, pos.x, pos.y + gap )
end
end
hook.Add( "HUDPaint", "square", render_square )
[/lua]
That works perfectly, but now I am trying to remove the original crosshair.
I tried, but that didn't work
[b][url=http://wiki.garrysmod.com/?title=Player.CrosshairDisable]Player.CrosshairDisable [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
[lua] function hidehud(name)
for k, v in pairs{"CHudCrosshair"} do
if name == v then return false end
end
end
hook.Add("HUDShouldDraw", "hidehud", hidehud)
[/lua]
[QUOTE=|King Flawless|;22949619]:words:[/QUOTE]
Well aren't you just handy to have around!
Thanks.
Sorry, you need to Log In to post a reply to this thread.