Look, I know I have asked a lot and I am being a lot more independent now. But one thing I can’t get my head around is changing the SetWeaponHoldType when Primary Attacking. If you are the person who was to attack then it would show your HoldType change in third person but if someone was to look at you then it wouldn’t show. Apparently I need to do something in init or cl_init. I just don’t know what… Has anyone actually figured this out yet?
You could use networking or usermessaging to make it all run clientside on all players, making it work
--Below is from the 'CS Base' found in DarkRP... If you find it too stupid ill make my own function SWEP:NewSetWeaponHoldType(holdtype) if SERVER then umsg.Start("umsg_HoldType") umsg.Entity(self) umsg.String(holdtype) umsg.End() end self:SetWeaponHoldType(holdtype) end if CLIENT then usermessage.Hook("umsg_HoldType", function(um) local wep = um:ReadEntity() local holdtype = um:ReadString() if not IsValid(wep) or not wep:IsWeapon() or not wep.SetWeaponHoldType then return end wep:SetWeaponHoldType(holdtype) end) end
I use that (from DarkRP) in my weapon base
Just call self:NewSetWeaponHoldType(“pistol”) when you need to change it
Make sure you update the state on both CLIENT and SERVER. It’s VERY easy to have an issue with sync if done incorrectly. Use IsFirstTimePredicted( ). So SERVER updates all players via net Broadcast / NW variable, and CLIENT does prediction for smooth transition.