• hook.Call & hook.Add - not being called at all.
    3 replies, posted
I created a Derma Menu with hook.Call which is client side & a server side file that has all the hook.Add. The Menu(clientside): [code]function ph_tm_p1() local base = vgui.Create( "DFrame") //Menu Frame base:SetSize(176, 571) base:SetPos(1728, 208) base:SetTitle("Taunts") base:SetVisible( true ) base:SetDeleteOnClose(false) base:ShowCloseButton(false) base:SetDraggable(false) base:MakePopup() local b1 = vgui.Create("DButton", base) //Button1 b1:SetSize(150, 33) b1:SetPos(12,35) b1:SetText("Doh!") b1.DoClick = function() hook.Call( "taunt_b1" ) end end[/code] the hook server side: [code]function taunt_b1() ent.EmitSount("taunts/doh.wav",500,200) chat.AddText("Playing Doh!")//To verify it was actually called. end hook.Add( "taunt_b1", "taunt_b1", taunt_b1 )[/code] For some odd reason there's no call nor error in console or chat. Could you help out please?
Hooks are not networked like this. Use the net library (net.Start, net.SendToServer, net.Receive) or, if you really must, console commands. [url]http://wiki.garrysmod.com/page/Net_Library_Usage[/url]
[QUOTE=Willox;46201463]Hooks are not networked like this. Use the net library (net.Start, net.SendToServer, net.Receive) or, if you really must, console commands. [url]http://wiki.garrysmod.com/page/Net_Library_Usage[/url][/QUOTE] Well I read on the wiki page you gave me, got one question. the net.SendToServer & net.Receive works both ways? (Client sends to Server & Server sends to Client)
[QUOTE=VashBaldeus;46201753]Well I read on the wiki page you gave me, got one question. the net.SendToServer & net.Receive works both ways? (Client sends to Server & Server sends to Client)[/QUOTE] It pretty much works that way, just mess with the examples given a bit and see how you can modify them to your needs.
Sorry, you need to Log In to post a reply to this thread.