Hi, does anyone knows a way (in lua) to change hl2 weapons (crowbar, crossbow, ar2 ...) crosshair?
I tried with weapons.GetStored but i din't manage to make it work. Maybe this was the good idea but i did it wrong. Anyone has an idea please? Thanks a lot
PS : If possible, I would like to avoid creating new SWEP for each hl2 weapons ...
[QUOTE=m0nZee;50432148]tf2 weapons (crowbar, crossbow, ar2 ...)[/QUOTE]
What? Those aren't TF2 weapons, they're Half Life 2 weapons.
Haha didn't notice Yep thanks, I edited my post. A bit tired :/
:snip: didn't read you wanted to change the crosshair, sorry :P
very basic example:
[lua]--prevent the default crosshair from rendering
hook.Add( "HUDShouldDraw", "CH_HUDShouldDraw", function( name )
if name == "CHudCrosshair" then return false end
end )
local crosshair = Material( "vgui/crosshairs/default.vtf" ) --material to use for the crosshair, not necessary if you don't use a material
--draw new crosshair from material
hook.Add( "HUDPaint", "CH_HUDPaint", function()
surface.SetDrawColor( 255, 255, 255, 255 )
surface.SetMaterial( crosshair )
surface.DrawTexturedRect( ScrW() * 0.5 - ScrH() * 0.015, ScrH() * 0.485, ScrH() * 0.03, ScrH() * 0.03 )
end )[/lua]
Sorry, you need to Log In to post a reply to this thread.