General > Developers Corner
ULibCommandCalled not being called?
Stickly Man!:
--- Code: ---lua_run hook.Add( "ULibCommandCalled", "test", print )
> hook.Add( "ULibCommandCalled", "test", print )...
ulx slap sti
[NULL Entity] ulx slap table: 0x1b681f08
--- End code ---
Worked fine for me when I made a simple hook in the server console.
Note from the ULib docs that this hook only gets called on the SERVER, so perhaps double-check and make sure your code is running on the server and not on the client?
Adult:
--- Quote from: Stickly Man! on January 21, 2013, 04:53:08 PM ---
--- Code: ---lua_run hook.Add( "ULibCommandCalled", "test", print )
> hook.Add( "ULibCommandCalled", "test", print )...
ulx slap sti
[NULL Entity] ulx slap table: 0x1b681f08
--- End code ---
Worked fine for me when I made a simple hook in the server console.
Note from the ULib docs that this hook only gets called on the SERVER, so perhaps double-check and make sure your code is running on the server and not on the client?
--- End quote ---
Using this same command you did, I tried slapping myself several times. I noticed that the hook isn't called when the command is executed via chat, but it is when used in console.
Stickly Man!:
--- Code: ---ServerLog: [ULX] [ULX]Stickly Man! slapped Themself with 0 damage
[ULX]Stickly Man!: !slap sti
Player [1][[ULX]Stickly Man!] ulx slap table: 0x1de60388
[ULX]Stickly Man! slapped Themself with 0 damage
ServerLog: [ULX] [ULX]Stickly Man! slapped Themself with 0 damage
ulx slap sti
[NULL Entity] ulx slap table: 0x21ac4d68
(Console) slapped [ULX]Stickly Man! with 0 damage
ServerLog: [ULX] (Console) slapped [ULX]Stickly Man! with 0 damage
--- End code ---
Yup, it seems to work from client/server console, but not from chat. We'll see about getting that fixed. Does your code work when you use the command from console?
Adult:
Yes, it does.
Stickly Man!:
K, I just pushed a fix for this in ULib code! Test it and see if it works for you.
Also, you should note that this hook gets called when a user attempts the command from their console yet does not have access to the command (this doesn't seem to happen with the chat commands). So if you don't want the "You're in PVP Mode!" messages to show up when a user doesn't have access, you should add a ply:query( "ulx god" ) in your script.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version