by Spike » Sun Sep 01, 2013 12:35 am
clc_stringcmd is your clientcommand client-to-server message, containing a string.
think of it as a reverse stuffcmd. instead of the server asking the client to do things, it is the client asking the server to do things (like change its name). obviously, you don't have full console access with it, but the ssqc is allowed to see/block/intercept/change the text of the command.
if you do not define that function, the engine will internally treat it as if you defined it as:
void(string s) SV_ParseClientCommand =
{
clientcommand(self, s);
};
which basically causes the engine to use its normal clientcommand handler to handle the command.
as the command is just a string, you need to tokenize (ie: split up into tokens) the command string (aka: s) in order to see the first token and thus what the command is actually asking the ssqc/server to do.
tokenize says how many tokens there were, while argv gives you the text of each token.
you can actually call clientcommand from anywhere, so clientcommand(self, "say hello world"); will of course make the server think that the client wanted to say hello to the world.
so you can use it to block colour changes by noticing that its a colour change command and just ignoring it. and you can directly change player colours by using clientcommands instead of stuffcmds - basically have the server update colours instantly instead of bouncing the command off the client and hoping it doesn't try cheating.
remember, you can always stuffcmd(player, "alias hello \"cmd hello\"\n"); then when the user types 'hello' at the console, it fires off a client command to the server and the ssqc can handle it. this works in all clients, even vanilla, both nq and qw. actually handling it properly in the ssqc is where you need the extension.
.