Quake3World.com Forums
     Programming Discussion
        Get Client Number on ioquake3


Post new topicReply to topic
Login | Profile | | FAQ | Search | IRC




Print view Previous topic | Next topic 
Topic Starter Topic: Get Client Number on ioquake3

The Afflicted
The Afflicted

Joined: 16 Feb 2000
Posts: 751
PostPosted: 05-16-2010 07:03 PM           Profile Send private message  E-mail  Edit post Reply with quote


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!




Top
                 

The Afflicted
The Afflicted

Joined: 16 Feb 2000
Posts: 751
PostPosted: 05-16-2010 07:07 PM           Profile Send private message  E-mail  Edit post Reply with quote


Secondly, is there any API Documentation for ioquake3 or q3 source in general?




Top
                 

Mentor
Mentor

Joined: 12 Mar 2005
Posts: 3957
PostPosted: 05-17-2010 12:11 AM           Profile Send private message  E-mail  Edit post Reply with quote


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'.




Top
                 

The Afflicted
The Afflicted

Joined: 16 Feb 2000
Posts: 751
PostPosted: 05-17-2010 02:20 PM           Profile Send private message  E-mail  Edit post Reply with quote


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.




Top
                 

The Afflicted
The Afflicted

Joined: 16 Feb 2000
Posts: 751
PostPosted: 05-18-2010 01:43 PM           Profile Send private message  E-mail  Edit post Reply with quote


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

Code:
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);




Top
                 
Quake3World.com | Forum Index | Programming Discussion


Post new topic Reply to topic


cron
Quake3World.com
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group