I've been trying to get my sweps to look holstered in 3rd person by setting their holdtype to normal when secondary attack is pressed. this is what I have so far.
[lua]
function holsterWep() --this is always true for testing purposes
return true
end
function SWEP:SecondaryAttack()
if holsterWep() == true then
self:SetWeaponHoldType( "normal" )
end
end
[/lua]
Problem is, nothing happens. I have a sneaking suspicion that hold type can only be set on initialization. If so, is there anyway around that?
It has to be done on both the server and the client. When playing singleplayer, if I remember correctly, a few weapon hooks such as PrimaryAttack and SecondaryAttack are not called clientside as they should be.
Try it on a listen server, if it works, then you'll need to force your weapon to call SecondaryAttack clientside if SinglePlayer() is true.
This will be helpful:
[b][url=http://wiki.garrysmod.com/?title=Weapon.CallOnClient]Weapon.CallOnClient [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
[b][url=http://wiki.garrysmod.com/?title=G.SinglePlayer]G.SinglePlayer [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
Holy crap, it works on multiplayer, thanks! I never thought it would matter that I was testing on singleplayer. Since I only plan to use it on my server, can I just leave it as is? Or will that cause other problems?
Nah, don't bother fixing it for singleplayer if it works fine on your server, it shouldn't cause any problem.
Thanks again!
Sorry, you need to Log In to post a reply to this thread.