From: Rudolf Polzer Date: Mon, 24 Oct 2011 11:24:57 +0000 (+0200) Subject: add an example too X-Git-Tag: xonotic-v0.6.0~40^2~15 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0891b9e3b7ae8f35c7bf9a154534bf50b4f2d8b2;p=xonotic%2Fxonotic-data.pk3dir.git add an example too --- diff --git a/qcsrc/server/mutators/base.qh b/qcsrc/server/mutators/base.qh index a088e1c05..73b23bbd3 100644 --- a/qcsrc/server/mutators/base.qh +++ b/qcsrc/server/mutators/base.qh @@ -162,10 +162,29 @@ MUTATOR_HOOKABLE(PlayerUseKey); MUTATOR_HOOKABLE(SV_ParseClientCommand); // called when a client command is parsed - // NOTE: hooks MUST start with if(MUTATOR_RETURNVALUE) return MUTATOR_RETURNVALUE; + // NOTE: hooks MUST start with if(MUTATOR_RETURNVALUE) return 0; // NOTE: return 1 if you handled the command, return 0 to continue handling // NOTE: THESE HOOKS MUST NEVER EVER CALL tokenize() // INPUT string cmd_name; // command name - string cmd_string; // whole command, use only if you really have to float cmd_argc; // also, argv() can be used + string cmd_string; // whole command, use only if you really have to + /* + // example: + MUTATOR_HOOKFUNCTION(foo_SV_ParseClientCommand) + { + if(MUTATOR_RETURNVALUE) // command was already handled? + return 0; + if(cmd_name == "echocvar" && cmd_argc >= 2) + { + print(cvar_string(argv(1)), "\n"); + return 1; + } + if(cmd_name == "echostring" && cmd_argc >= 2) + { + print(substring(cmd_string, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), "\n"); + return 1; + } + return 0; + } + */