SWEP:Deploy not working on client?

Okay so I’m trying to get my SWEP to play a sound when it’s deployed ONLY for the owner of the weapon (one holding it). So far heres my code which doesn’t work at all.


function SWEP:Deploy()
	if CLIENT then
		self.Owner:ConCommand("say i have so much swag omg")
	end
	return true
end

So, if I change ‘CLIENT’ to ‘SERVER’ then it works but other than that, nope not at all.

Any help would be appreciated!

It doesn’t in singleplayer.

This is on a multiplayer server so should be working.

Deploy and Holster are server only hooks.



function SWEP:Deploy( )
  if SERVER then
    self:CallOnClient( "Deploy", "" )
  else

  end
  return true
end

On the wiki it says it’s shared LUA.

The wiki is wrong.

Once again, only in single player. They get called on the client in multiplayer for prediction.

No it isn’t.


function SWEP:Deploy( )
	MsgN( "Hey!" )
	return true
end

http://puu.sh/65ypW.png

Not sure how you’re doing it but:

http://vinh.peniscorp.com/2014-01-01_14-32-48.png

Also Holster is definitely shared as well since you can return false in it to prevent switching to another weapon. If it was serverside only it would be impossible to do that with proper prediction.

I’ve also seen it not being called on the client.

You got it straight from the spawnmenu, that’s why it’s only called once, switch to another weapon and then back to it and it’ll work fine.