[page=Start]
Alright! You've managed to click here. Good job!
Eheh. Anyways, this is a little (and I mean tiny) function to make you (the coder) able to force commands upon clients (little innocent people) to make them initiate a command whenever, whatever and where ever you put it.
[page=The Stuffcmd]
First, let's go to p_client.c, and right at the end, add this:
// this functions is used to send commands to the clients
void stuffcmd(edict_t *ent, char *s)
{
gi.WriteByte (11);
gi.WriteString (s);
gi.unicast (ent, true);
}
Now, go to G_local, and right after:
// common data blocks
moveinfo_t moveinfo;
monsterinfo_t monsterinfo;
add:
void (*stuffcmd)(edict_t *ent, char *s);
There ya go! Now, this can be used for example to force aliases upon entering the game, or to open a config on start, or anything.. just enter something like:
stuffcmd (ent, "cmd kill\n");
and it will kill the person whenever something is specified or whatever.
Use it sometime!
Paril
I think this works with HL2 as well, becuase the rc file has the stuffcmd at the end of it...
Probably.
NOTE: Stuffcmd is NOT recommended, as it will cause overflows.