Holdtype not working

I have a SWEP pack coming up in development, and everything so far is A-Okay, but a small problem has been formed.
The holdtype does not work.

I have the code



SWEP.HoldType = "melee"


In my shared.lua

I’ve been researching multiple threads, and none of them helped.

I also have tried these codes



function SWEP:Initialize()
	if (SERVER) then
		self:SetWeaponHoldType(self.HoldType)
	end
end

function SWEP:Initialize()
	if (CLIENT) then
		self:SetWeaponHoldType(self.HoldType)
	end
end


But they didn’t help, I still hold each weapon like a pistol.
So the question is, what am I doing wrong?

I have checked http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexaeaf.html
And it said

How do I call both at the same time, if that would work. Should I just merge them? Thanks for any tips you guys can come up with, this problem has happened before, and I have not fixed it.
:v:

I have a cl_init.lua, a shared.lua, and a init.lua, if it helps

If you have two identical function names you should stop that right now!
You are inside shared.lua you should only place code that runs on both anyway.


function SWEP:Initialize()
	self:SetWeaponHoldType(self.HoldType)
end

Thanks for trying, but I couldn’t get it to work : (
I made sure this didn’t overwrite the initialize in my shared.lua, but no luck.

I just tested with one of my sweps the following code


SWEP.HoldType = "melee"

-- ...
-- ...

function SWEP:Initialize()
	self:SetWeaponHoldType(self.HoldType)
end

It does not change first person, it only chances what it looks like in thirdperson or other players.
You can check by hosting a server

sv_cheats 1
thirdperson

IK all of that, but it still does not work, I think I may need a base or something, that is how my bro fixed it, but I was wondering if there was another route I could take,

Ok well good luck, sorry I couldn’t help you. the swep I tested on didn’t have a base, but it did use a hl2 pistol viewmodel and worldmodel.

Don’t be sorry, I’ll figure it out eventually, thanks for trying tho : )

anyone

bump, I really need this fixed

I’ve got a cl_init, and a init file, with that cause anything?

Post all of your code

NVM, fixed it, I had multiple initialize lines of code and I should’ve only had one.

[editline]19th December 2013[/editline]

self:SetWeaponHoldType(self.HoldType)
put that under initialize, THANKS NIGHTSTALKER