• Print

Author Topic: Hook not getting called...I think  (Read 4275 times)

0 Members and 1 Guest are viewing this topic.

Offline Zmaster

  • Full Member
  • ***
  • Posts: 235
  • Karma: 25
Hook not getting called...I think
« on: November 04, 2014, 11:41:01 am »
I have a hook in a lua file that is supposed to get called whenever a player runs ShowTeam (F2 by default)
However, the function isn't running when I press F2
I checked to make sure that my F2 is binded correctly, and it is


I get no errors
I'm pretty sure the function isn't the problem, since I made a concommand for the function as well and that works fine
This is the hook code and the concommand code
Code: Lua
  1. hook.Add( "ShowTeam", "BindForSH", OpenServerHopperPage )
  2. concommand.Add( SHConsoleCommand, OpenServerHopperPage )

My hook is being run serverside and the console command is client side
The function is in a if (CLIENT) then
Could that be why it isn't working?

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Re: Hook not getting called...I think
« Reply #1 on: November 05, 2014, 06:40:00 am »
The hook itself is serverside, so no, clientside functions won't be called from a serverside hook (although it should output an error if the function can't be found?).
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.

Offline Zmaster

  • Full Member
  • ***
  • Posts: 235
  • Karma: 25
Re: Hook not getting called...I think
« Reply #2 on: November 05, 2014, 07:29:43 am »
Yea there was no error
I'll relook over the code when I get home to see if I missed anything

Offline Zmaster

  • Full Member
  • ***
  • Posts: 235
  • Karma: 25
Re: Hook not getting called...I think
« Reply #3 on: November 05, 2014, 02:14:32 pm »
Not seeing any typos or anything wrong
This is what the code looks like after zooming out a bit and hiding some so that I could fit this into one image
I moved the ShowTeam hook to the clientside code and still didn't get any errors

  • Print