Changing HoldType

Hello

What I’m trying to do is change the holdtype when primaryattack in a SWEP I am making is called and then use a timer.Simple to return it to the old holdtype
When going into third person it looks perfect I can see the holdtype changing when primaryattack is used and then reverting back to “normal” after 5 seconds but no one else can see this.

[lua]
self:SetWeaponHoldType( “pistol” )
timer.Simple(5, function() self:SetWeaponHoldType( “normal” ) end)
[/lua]

That is how I am currently trying to do this

Any ideas anyone?

Any help would be appreciated.
Thanks

Make sure it’s actually ran on both sides

Yea it’s ran on both client and server side, that’s whats confusing me I see no reason why it shouldn’t work :s

sounds like the problem that madcows has/had.

you need to have states on your weapons (chuck it on the base if you have one)

run a think hook to check weapon states. for example if the state is 0, the hold type if normal. if its 1 it might be pistol.

loop through all players and check the validity of their active weapon. it might help to filter weapon classes so you dont get weapons like physguns and toolguns and other weapons.

use ply:SetWeaponHoldType(holdtypes[ply:GetActiveWeapon().State]); or something like that in the think hook.