Quake 2 is another classic from id software.While not modded quite as much as it's predecessor or Q3A, it is still a blast to play and the mod's on offer are bundles of fun. Just step into Quake 2 Rocket Arena, armed with the new and almighty rocket and rail gun and you will be gibbing for hours on end.If you dig fast paced action, then load up the good ole Quake 2, fire up a mod or two and have some fun!

Post tutorial Report RSS The Stuffcmd

This is a tiny code that is used to force a command upon a client! This should be used in some way to prevent bugs..

Posted by on - Basic Server Side Coding

[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

Post comment Comments
amckern
amckern - - 359 comments

I think this works with HL2 as well, becuase the rc file has the stuffcmd at the end of it...

Reply Good karma Bad karma+1 vote
Paril Author
Paril - - 24 comments

Probably.

NOTE: Stuffcmd is NOT recommended, as it will cause overflows.

Reply Good karma+1 vote
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: