Get Client Number on ioquake3

Locked
Pyrite
Posts: 10
Joined: Wed Feb 16, 2000 8:00 am

Get Client Number on ioquake3

Post by Pyrite »

I haven't posted on these forums in a long long time. Greetz to Energon, Seg and raw if yall are still around.

I recently started hacking some ioquake3 server builds. Pretty new to q3 source and all. When you enter the status command via rcon, it has the clientNumber as the first or second column. In the sv_ccmds.c file, I'd like to be able to get the clientNumber of the user issuing the command. Not sure how?

I was told Misantropia was the total code god around here now. Nice to meet you!
Pyrite
Posts: 10
Joined: Wed Feb 16, 2000 8:00 am

Re: Get Client Number on ioquake3

Post by Pyrite »

Secondly, is there any API Documentation for ioquake3 or q3 source in general?
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Re: Get Client Number on ioquake3

Post by ^misantropia^ »

Hi Pyrite, welcome. raw is the only one from your list who still posts here (and very infrequently at that).

Getting the client that issued a rcon command is rather difficult because the commands are sent in connectionless mode (that's why you can use external tools to manage your server). The best you can do is try to match the IP address to a client in SVC_RemoteCommand() in server/sv_main.c but that'll only work half of the time.

You can generate API documentation with a tool like doxygen but I mostly use Eclipse's outline mode and 'Jump to declaration'.
Pyrite
Posts: 10
Joined: Wed Feb 16, 2000 8:00 am

Re: Get Client Number on ioquake3

Post by Pyrite »

Thanks. I think you are right. To solve my problem for now, I just have the admin pass their own client number as a argument (they can obtain it themselves using status).

Now I just need to figure out the best way to move that client into spectator.
Pyrite
Posts: 10
Joined: Wed Feb 16, 2000 8:00 am

Re: Get Client Number on ioquake3

Post by Pyrite »

I tried what I thought would work, but didn't. May be someone can shed some light?

Code: Select all

int idnum; // contains the person you want to force to spec's client id number.
char forceToSpec[25]; // command to force them to spec utilizing forceteam command.

cl = &svs.clients[idnum];

// Force the Moderator into Spectator
sprintf(forceToSpec, "forceteam %d spectator", idnum);
SV_SendServerCommand(cl, "%s", forceToSpec);

Locked