1 #ifndef CLIENT_MUTATORS_EVENTS_H
2 #define CLIENT_MUTATORS_EVENTS_H
4 #include "../../common/mutators/base.qh"
13 * Called when a client command is parsed
14 * NOTE: hooks MUST start with if (MUTATOR_RETURNVALUE) return false;
15 * NOTE: return true if you handled the command, return false to continue handling
16 * NOTE: THESE HOOKS MUST NEVER EVER CALL tokenize()
18 * MUTATOR_HOOKFUNCTION(foo, CSQC_ConsoleCommand) {
19 * if (MUTATOR_RETURNVALUE) return false; // command was already handled
20 * if (cmd_name == "echocvar" && cmd_argc >= 2) {
21 * print(cvar_string(argv(1)), "\n");
24 * if (cmd_name == "echostring" && cmd_argc >= 2) {
25 * print(substring(cmd_string, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), "\n");
31 #define EV_CSQC_ConsoleCommand(i, o) \
32 /** command name */ i(string, cmd_name) \
33 /** also, argv() can be used */ i(int, cmd_argc) \
34 /** whole command, use only if you really have to */ i(string, cmd_string) \
36 MUTATOR_HOOKABLE(CSQC_ConsoleCommand, EV_CSQC_ConsoleCommand);
38 /* Called when the crosshair is being updated */
39 MUTATOR_HOOKABLE(UpdateCrosshair, EV_NO_ARGS);