Command with multiple arguments

Locked
User avatar
Eraser
Posts: 19177
Joined: Fri Dec 01, 2000 8:00 am

Command with multiple arguments

Post 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?
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Re: Command with multiple arguments

Post 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().
Locked