Ulysses
General => Developers Corner => Topic started by: dankpepe on June 18, 2016, 11:15:02 PM
-
How does ulx ignore the PlayerSay hook for commands? For example, why can people still type in admin chat while muted?
-
Either hook priority, or they're using the ulx * console commands as opposed to their chat counterparts.
-
Additionally, admin chat isn't standard chat. I'd have to dig into our code, but it's likely that once @ is used, it would never get to the playersay hook anyway.
Essentially, we never return chat text in the first place.
-
What JamminR said, ulx asay uses no hooks, as a matter of fact, and sends a message to only those allowed to see it and the person who used it. Can't remember if they used fancyLog or fancyLogAdmin, though.
-
That makes sense. Do you know how ulx detects if you type something without using the PlayerSay hook?
-
It's all in the code. It doesn't detect hooks or skip them or anything, it simply doesn't use them.
-
How does ulx know to execute a command when someone types a command in chat without using hooks?
-
It's in the command. When you define a ulx.command at the bottom of the code, you can assign a command line which, when you use in the chat, it will execute that command.
-
It's in the command. When you define a ulx.command at the bottom of the code, you can assign a command line which, when you use in the chat, it will execute that command.
You're misinterpreting things.
ulx.command registers a new command, telling UL(x|ib) that you want x to happen when y is said or z is run in the console. HOWEVER, this does not mean hooks aren't used internally. They are, in fact, used. (https://github.com/TeamUlysses/ulib/blob/81044e2a65790d264a45e9bbc54cbe1cb615b64c/lua/ulib/server/concommand.lua#L73)
This hook is registered with HOOK_HIGH priority. The hook responsible for gimps and mutes (https://github.com/TeamUlysses/ulx/blob/0db8007ceb4a49e22c2bb191d1e16d423851f21e/lua/ulx/modules/sh/chat.lua#L220) is registered with HOOK_LOW priority. Therefore, the PlayerSay hook that checks for commands takes the highest precedence (if I understand ULib's improved hook system correctly).
-
Ah, what I was thinking was you don't need to specifically specify a hook when making the command.
-
Yes, you understand it correctly Bytewave. We didn't want admins panicking if they muted/gimped themselves and then couldn't run the commands they were used to (from chat).