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.
[CODE]function SWEP:Deploy()
if CLIENT then
self.Owner:ConCommand("say i have so much swag omg")
end
return true
end[/CODE]
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.
[code]
function SWEP:Deploy( )
if SERVER then
self:CallOnClient( "Deploy", "" )
else
end
return true
end[/code]
[url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index527b.html[/url]
On the wiki it says it's shared LUA.
The wiki is wrong.
[QUOTE=Kogitsune;43378096]Deploy and Holster are server only hooks.
[code]
function SWEP:Deploy( )
if SERVER then
self:CallOnClient( "Deploy", "" )
else
end
return true
end[/code][/QUOTE]
Once again, only in single player. They get called on the client in multiplayer for prediction.
[QUOTE=Robotboy655;43378183]Once again, only in single player. They get called on the client in multiplayer for prediction.[/QUOTE]
No it isn't.
[code]function SWEP:Deploy( )
MsgN( "Hey!" )
return true
end[/code]
[img]http://puu.sh/65ypW.png[/img]
[QUOTE=Kogitsune;43378524]No it isn't.
[code]function SWEP:Deploy( )
MsgN( "Hey!" )
return true
end[/code]
[img]http://puu.sh/65ypW.png[/img][/QUOTE]
Not sure how you're doing it but:
[img]http://vinh.peniscorp.com/2014-01-01_14-32-48.png[/img]
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.
[QUOTE=Kogitsune;43378524]No it isn't.
[code]function SWEP:Deploy( )
MsgN( "Hey!" )
return true
end[/code]
[img]http://puu.sh/65ypW.png[/img][/QUOTE]
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.
Sorry, you need to Log In to post a reply to this thread.