Page 1 of 1

Command with multiple arguments

Posted: Sat Jan 08, 2011 1:24 pm
by Eraser
I'm looking for a way to allow for a command that accepts multiple arguments.

I've found in the code that handles the "give" command (in g_cmds.c) that they do this:
char *name
name = ConcatArgs( 1 );

to get the argument supplied with the give command, but there seems to be no way of accepting multiple arguments.
I thought of making the command so that arguments are comma seperated or space seperated or something and then to split that string or use some sort of substring subroutine, but ofcourse there seems to be no such functionality in the Q3 codebase and ofcourse string.h can't be used :)

Anyone know how to do this?

Re: Command with multiple arguments

Posted: Sat Jan 08, 2011 3:16 pm
by ^misantropia^
We're talking about server commands here, right? You can get the argument count with trap_Argc() and the arguments themselves with trap_Argv().