#include "g_local.h"
#include "../../ui/menudef.h"
Include dependency graph for g_cmds.c:

Go to the source code of this file.
|
|
Definition at line 837 of file g_cmds.c. Referenced by BotSayTeamOrderAlways(), and G_Say(). |
|
||||||||||||
|
Definition at line 483 of file g_cmds.c. References gclient_t, clientPersistant_t::netname, gclient_s::pers, S_COLOR_WHITE, gclient_s::sess, clientSession_t::sessionTeam, TEAM_SPECTATOR, trap_SendServerCommand(), and va(). Referenced by ClientConnect(), G_InitSessionData(), and SetTeam(). 00484 {
00485 if ( client->sess.sessionTeam == TEAM_RED ) {
00486 trap_SendServerCommand( -1, va("cp \"%s" S_COLOR_WHITE " joined the red team.\n\"",
00487 client->pers.netname) );
00488 } else if ( client->sess.sessionTeam == TEAM_BLUE ) {
00489 trap_SendServerCommand( -1, va("cp \"%s" S_COLOR_WHITE " joined the blue team.\n\"",
00490 client->pers.netname));
00491 } else if ( client->sess.sessionTeam == TEAM_SPECTATOR && oldTeam != TEAM_SPECTATOR ) {
00492 trap_SendServerCommand( -1, va("cp \"%s" S_COLOR_WHITE " joined the spectators.\n\"",
00493 client->pers.netname));
00494 } else if ( client->sess.sessionTeam == TEAM_FREE ) {
00495 trap_SendServerCommand( -1, va("cp \"%s" S_COLOR_WHITE " joined the battle.\n\"",
00496 client->pers.netname));
00497 }
00498 }
|
Here is the call graph for this function:

|
|
Definition at line 109 of file g_cmds.c. References g_cheats, g_entities, gentity_t, gentity_s::health, vmCvar_t::integer, qboolean, trap_SendServerCommand(), and va(). Referenced by Cmd_Give_f(), Cmd_God_f(), Cmd_LevelShot_f(), Cmd_Noclip_f(), and Cmd_Notarget_f(). 00109 {
00110 if ( !g_cheats.integer ) {
00111 trap_SendServerCommand( ent-g_entities, va("print \"Cheats are not enabled on this server.\n\""));
00112 return qfalse;
00113 }
00114 if ( ent->health <= 0 ) {
00115 trap_SendServerCommand( ent-g_entities, va("print \"You must be alive to use this command.\n\""));
00116 return qfalse;
00117 }
00118 return qtrue;
00119 }
|
Here is the call graph for this function:

|
|
Definition at line 1598 of file g_cmds.c. References gentity_s::client, Cmd_CallTeamVote_f(), Cmd_CallVote_f(), Cmd_Follow_f(), Cmd_FollowCycle_f(), Cmd_GameCommand_f(), Cmd_Give_f(), Cmd_God_f(), Cmd_Kill_f(), Cmd_LevelShot_f(), Cmd_Noclip_f(), Cmd_Notarget_f(), Cmd_Say_f(), Cmd_Score_f(), Cmd_SetViewpos_f(), Cmd_Stats_f(), Cmd_Team_f(), Cmd_TeamTask_f(), Cmd_TeamVote_f(), Cmd_Tell_f(), Cmd_Voice_f(), Cmd_VoiceTaunt_f(), Cmd_VoiceTell_f(), Cmd_Vote_f(), Cmd_Where_f(), g_entities, gentity_t, level_locals_t::intermissiontime, level, Q_stricmp(), qfalse, qtrue, SAY_ALL, SAY_TEAM, trap_Argv(), trap_SendServerCommand(), and va(). Referenced by vmMain(). 01598 {
01599 gentity_t *ent;
01600 char cmd[MAX_TOKEN_CHARS];
01601
01602 ent = g_entities + clientNum;
01603 if ( !ent->client ) {
01604 return; // not fully in game yet
01605 }
01606
01607
01608 trap_Argv( 0, cmd, sizeof( cmd ) );
01609
01610 if (Q_stricmp (cmd, "say") == 0) {
01611 Cmd_Say_f (ent, SAY_ALL, qfalse);
01612 return;
01613 }
01614 if (Q_stricmp (cmd, "say_team") == 0) {
01615 Cmd_Say_f (ent, SAY_TEAM, qfalse);
01616 return;
01617 }
01618 if (Q_stricmp (cmd, "tell") == 0) {
01619 Cmd_Tell_f ( ent );
01620 return;
01621 }
01622 if (Q_stricmp (cmd, "vsay") == 0) {
01623 Cmd_Voice_f (ent, SAY_ALL, qfalse, qfalse);
01624 return;
01625 }
01626 if (Q_stricmp (cmd, "vsay_team") == 0) {
01627 Cmd_Voice_f (ent, SAY_TEAM, qfalse, qfalse);
01628 return;
01629 }
01630 if (Q_stricmp (cmd, "vtell") == 0) {
01631 Cmd_VoiceTell_f ( ent, qfalse );
01632 return;
01633 }
01634 if (Q_stricmp (cmd, "vosay") == 0) {
01635 Cmd_Voice_f (ent, SAY_ALL, qfalse, qtrue);
01636 return;
01637 }
01638 if (Q_stricmp (cmd, "vosay_team") == 0) {
01639 Cmd_Voice_f (ent, SAY_TEAM, qfalse, qtrue);
01640 return;
01641 }
01642 if (Q_stricmp (cmd, "votell") == 0) {
01643 Cmd_VoiceTell_f ( ent, qtrue );
01644 return;
01645 }
01646 if (Q_stricmp (cmd, "vtaunt") == 0) {
01647 Cmd_VoiceTaunt_f ( ent );
01648 return;
01649 }
01650 if (Q_stricmp (cmd, "score") == 0) {
01651 Cmd_Score_f (ent);
01652 return;
01653 }
01654
01655 // ignore all other commands when at intermission
01656 if (level.intermissiontime) {
01657 Cmd_Say_f (ent, qfalse, qtrue);
01658 return;
01659 }
01660
01661 if (Q_stricmp (cmd, "give") == 0)
01662 Cmd_Give_f (ent);
01663 else if (Q_stricmp (cmd, "god") == 0)
01664 Cmd_God_f (ent);
01665 else if (Q_stricmp (cmd, "notarget") == 0)
01666 Cmd_Notarget_f (ent);
01667 else if (Q_stricmp (cmd, "noclip") == 0)
01668 Cmd_Noclip_f (ent);
01669 else if (Q_stricmp (cmd, "kill") == 0)
01670 Cmd_Kill_f (ent);
01671 else if (Q_stricmp (cmd, "teamtask") == 0)
01672 Cmd_TeamTask_f (ent);
01673 else if (Q_stricmp (cmd, "levelshot") == 0)
01674 Cmd_LevelShot_f (ent);
01675 else if (Q_stricmp (cmd, "follow") == 0)
01676 Cmd_Follow_f (ent);
01677 else if (Q_stricmp (cmd, "follownext") == 0)
01678 Cmd_FollowCycle_f (ent, 1);
01679 else if (Q_stricmp (cmd, "followprev") == 0)
01680 Cmd_FollowCycle_f (ent, -1);
01681 else if (Q_stricmp (cmd, "team") == 0)
01682 Cmd_Team_f (ent);
01683 else if (Q_stricmp (cmd, "where") == 0)
01684 Cmd_Where_f (ent);
01685 else if (Q_stricmp (cmd, "callvote") == 0)
01686 Cmd_CallVote_f (ent);
01687 else if (Q_stricmp (cmd, "vote") == 0)
01688 Cmd_Vote_f (ent);
01689 else if (Q_stricmp (cmd, "callteamvote") == 0)
01690 Cmd_CallTeamVote_f (ent);
01691 else if (Q_stricmp (cmd, "teamvote") == 0)
01692 Cmd_TeamVote_f (ent);
01693 else if (Q_stricmp (cmd, "gc") == 0)
01694 Cmd_GameCommand_f( ent );
01695 else if (Q_stricmp (cmd, "setviewpos") == 0)
01696 Cmd_SetViewpos_f( ent );
01697 else if (Q_stricmp (cmd, "stats") == 0)
01698 Cmd_Stats_f( ent );
01699 else
01700 trap_SendServerCommand( clientNum, va("print \"unknown cmd %s\n\"", cmd ) );
01701 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 185 of file g_cmds.c. References atoi, cl, level_locals_t::clients, g_entities, gclient_t, gentity_t, level, level_locals_t::maxclients, s, SanitizeString(), strcmp(), trap_SendServerCommand(), and va(). Referenced by Cmd_Follow_f(). 00185 {
00186 gclient_t *cl;
00187 int idnum;
00188 char s2[MAX_STRING_CHARS];
00189 char n2[MAX_STRING_CHARS];
00190
00191 // numeric values are just slot numbers
00192 if (s[0] >= '0' && s[0] <= '9') {
00193 idnum = atoi( s );
00194 if ( idnum < 0 || idnum >= level.maxclients ) {
00195 trap_SendServerCommand( to-g_entities, va("print \"Bad client slot: %i\n\"", idnum));
00196 return -1;
00197 }
00198
00199 cl = &level.clients[idnum];
00200 if ( cl->pers.connected != CON_CONNECTED ) {
00201 trap_SendServerCommand( to-g_entities, va("print \"Client %i is not active\n\"", idnum));
00202 return -1;
00203 }
00204 return idnum;
00205 }
00206
00207 // check for a name match
00208 SanitizeString( s, s2 );
00209 for ( idnum=0,cl=level.clients ; idnum < level.maxclients ; idnum++,cl++ ) {
00210 if ( cl->pers.connected != CON_CONNECTED ) {
00211 continue;
00212 }
00213 SanitizeString( cl->pers.netname, n2 );
00214 if ( !strcmp( n2, s2 ) ) {
00215 return idnum;
00216 }
00217 }
00218
00219 trap_SendServerCommand( to-g_entities, va("print \"User %s is not on the server\n\"", s));
00220 return -1;
00221 }
|
Here is the call graph for this function:

|
|
Definition at line 1367 of file g_cmds.c. References atoi, gentity_s::client, playerState_s::clientNum, level_locals_t::clients, Com_sprintf(), clientPersistant_t::connected, CS_TEAMVOTE_NO, CS_TEAMVOTE_STRING, CS_TEAMVOTE_TIME, CS_TEAMVOTE_YES, playerState_s::eFlags, g_allowVote, g_entities, gentity_t, i, vmCvar_t::integer, gentity_s::inuse, level, level_locals_t::maxclients, clientPersistant_t::netname, gclient_s::pers, gclient_s::ps, Q_CleanStr(), Q_stricmp(), Q_strncpyz(), gclient_s::sess, clientSession_t::sessionTeam, strcat(), strchr(), strlen(), clientPersistant_t::teamVoteCount, level_locals_t::teamVoteNo, level_locals_t::teamVoteString, level_locals_t::teamVoteTime, level_locals_t::teamVoteYes, level_locals_t::time, trap_Argc(), trap_Argv(), trap_SendServerCommand(), trap_SetConfigstring(), and va(). Referenced by ClientCommand(). 01367 {
01368 int i, team, cs_offset;
01369 char arg1[MAX_STRING_TOKENS];
01370 char arg2[MAX_STRING_TOKENS];
01371
01372 team = ent->client->sess.sessionTeam;
01373 if ( team == TEAM_RED )
01374 cs_offset = 0;
01375 else if ( team == TEAM_BLUE )
01376 cs_offset = 1;
01377 else
01378 return;
01379
01380 if ( !g_allowVote.integer ) {
01381 trap_SendServerCommand( ent-g_entities, "print \"Voting not allowed here.\n\"" );
01382 return;
01383 }
01384
01385 if ( level.teamVoteTime[cs_offset] ) {
01386 trap_SendServerCommand( ent-g_entities, "print \"A team vote is already in progress.\n\"" );
01387 return;
01388 }
01389 if ( ent->client->pers.teamVoteCount >= MAX_VOTE_COUNT ) {
01390 trap_SendServerCommand( ent-g_entities, "print \"You have called the maximum number of team votes.\n\"" );
01391 return;
01392 }
01393 if ( ent->client->sess.sessionTeam == TEAM_SPECTATOR ) {
01394 trap_SendServerCommand( ent-g_entities, "print \"Not allowed to call a vote as spectator.\n\"" );
01395 return;
01396 }
01397
01398 // make sure it is a valid command to vote on
01399 trap_Argv( 1, arg1, sizeof( arg1 ) );
01400 arg2[0] = '\0';
01401 for ( i = 2; i < trap_Argc(); i++ ) {
01402 if (i > 2)
01403 strcat(arg2, " ");
01404 trap_Argv( i, &arg2[strlen(arg2)], sizeof( arg2 ) - strlen(arg2) );
01405 }
01406
01407 if( strchr( arg1, ';' ) || strchr( arg2, ';' ) ) {
01408 trap_SendServerCommand( ent-g_entities, "print \"Invalid vote string.\n\"" );
01409 return;
01410 }
01411
01412 if ( !Q_stricmp( arg1, "leader" ) ) {
01413 char netname[MAX_NETNAME], leader[MAX_NETNAME];
01414
01415 if ( !arg2[0] ) {
01416 i = ent->client->ps.clientNum;
01417 }
01418 else {
01419 // numeric values are just slot numbers
01420 for (i = 0; i < 3; i++) {
01421 if ( !arg2[i] || arg2[i] < '0' || arg2[i] > '9' )
01422 break;
01423 }
01424 if ( i >= 3 || !arg2[i]) {
01425 i = atoi( arg2 );
01426 if ( i < 0 || i >= level.maxclients ) {
01427 trap_SendServerCommand( ent-g_entities, va("print \"Bad client slot: %i\n\"", i) );
01428 return;
01429 }
01430
01431 if ( !g_entities[i].inuse ) {
01432 trap_SendServerCommand( ent-g_entities, va("print \"Client %i is not active\n\"", i) );
01433 return;
01434 }
01435 }
01436 else {
01437 Q_strncpyz(leader, arg2, sizeof(leader));
01438 Q_CleanStr(leader);
01439 for ( i = 0 ; i < level.maxclients ; i++ ) {
01440 if ( level.clients[i].pers.connected == CON_DISCONNECTED )
01441 continue;
01442 if (level.clients[i].sess.sessionTeam != team)
01443 continue;
01444 Q_strncpyz(netname, level.clients[i].pers.netname, sizeof(netname));
01445 Q_CleanStr(netname);
01446 if ( !Q_stricmp(netname, leader) ) {
01447 break;
01448 }
01449 }
01450 if ( i >= level.maxclients ) {
01451 trap_SendServerCommand( ent-g_entities, va("print \"%s is not a valid player on your team.\n\"", arg2) );
01452 return;
01453 }
01454 }
01455 }
01456 Com_sprintf(arg2, sizeof(arg2), "%d", i);
01457 } else {
01458 trap_SendServerCommand( ent-g_entities, "print \"Invalid vote string.\n\"" );
01459 trap_SendServerCommand( ent-g_entities, "print \"Team vote commands are: leader <player>.\n\"" );
01460 return;
01461 }
01462
01463 Com_sprintf( level.teamVoteString[cs_offset], sizeof( level.teamVoteString[cs_offset] ), "%s %s", arg1, arg2 );
01464
01465 for ( i = 0 ; i < level.maxclients ; i++ ) {
01466 if ( level.clients[i].pers.connected == CON_DISCONNECTED )
01467 continue;
01468 if (level.clients[i].sess.sessionTeam == team)
01469 trap_SendServerCommand( i, va("print \"%s called a team vote.\n\"", ent->client->pers.netname ) );
01470 }
01471
01472 // start the voting, the caller autoamtically votes yes
01473 level.teamVoteTime[cs_offset] = level.time;
01474 level.teamVoteYes[cs_offset] = 1;
01475 level.teamVoteNo[cs_offset] = 0;
01476
01477 for ( i = 0 ; i < level.maxclients ; i++ ) {
01478 if (level.clients[i].sess.sessionTeam == team)
01479 level.clients[i].ps.eFlags &= ~EF_TEAMVOTED;
01480 }
01481 ent->client->ps.eFlags |= EF_TEAMVOTED;
01482
01483 trap_SetConfigstring( CS_TEAMVOTE_TIME + cs_offset, va("%i", level.teamVoteTime[cs_offset] ) );
01484 trap_SetConfigstring( CS_TEAMVOTE_STRING + cs_offset, level.teamVoteString[cs_offset] );
01485 trap_SetConfigstring( CS_TEAMVOTE_YES + cs_offset, va("%i", level.teamVoteYes[cs_offset] ) );
01486 trap_SetConfigstring( CS_TEAMVOTE_NO + cs_offset, va("%i", level.teamVoteNo[cs_offset] ) );
01487 }
|
Here is the call graph for this function:

|
|
Definition at line 1215 of file g_cmds.c. References atoi, gentity_s::client, level_locals_t::clients, Com_sprintf(), CS_VOTE_NO, CS_VOTE_STRING, CS_VOTE_TIME, CS_VOTE_YES, playerState_s::eFlags, EXEC_APPEND, g_allowVote, g_entities, gameNames, gentity_t, GT_SINGLE_PLAYER, i, vmCvar_t::integer, level, level_locals_t::maxclients, clientPersistant_t::netname, gclient_s::pers, gclient_s::ps, Q_stricmp(), s, gclient_s::sess, clientSession_t::sessionTeam, strchr(), level_locals_t::time, trap_Argv(), trap_Cvar_VariableStringBuffer(), trap_SendConsoleCommand(), trap_SendServerCommand(), trap_SetConfigstring(), va(), clientPersistant_t::voteCount, level_locals_t::voteDisplayString, level_locals_t::voteExecuteTime, level_locals_t::voteNo, level_locals_t::voteString, level_locals_t::voteTime, and level_locals_t::voteYes. Referenced by ClientCommand(). 01215 {
01216 int i;
01217 char arg1[MAX_STRING_TOKENS];
01218 char arg2[MAX_STRING_TOKENS];
01219
01220 if ( !g_allowVote.integer ) {
01221 trap_SendServerCommand( ent-g_entities, "print \"Voting not allowed here.\n\"" );
01222 return;
01223 }
01224
01225 if ( level.voteTime ) {
01226 trap_SendServerCommand( ent-g_entities, "print \"A vote is already in progress.\n\"" );
01227 return;
01228 }
01229 if ( ent->client->pers.voteCount >= MAX_VOTE_COUNT ) {
01230 trap_SendServerCommand( ent-g_entities, "print \"You have called the maximum number of votes.\n\"" );
01231 return;
01232 }
01233 if ( ent->client->sess.sessionTeam == TEAM_SPECTATOR ) {
01234 trap_SendServerCommand( ent-g_entities, "print \"Not allowed to call a vote as spectator.\n\"" );
01235 return;
01236 }
01237
01238 // make sure it is a valid command to vote on
01239 trap_Argv( 1, arg1, sizeof( arg1 ) );
01240 trap_Argv( 2, arg2, sizeof( arg2 ) );
01241
01242 if( strchr( arg1, ';' ) || strchr( arg2, ';' ) ) {
01243 trap_SendServerCommand( ent-g_entities, "print \"Invalid vote string.\n\"" );
01244 return;
01245 }
01246
01247 if ( !Q_stricmp( arg1, "map_restart" ) ) {
01248 } else if ( !Q_stricmp( arg1, "nextmap" ) ) {
01249 } else if ( !Q_stricmp( arg1, "map" ) ) {
01250 } else if ( !Q_stricmp( arg1, "g_gametype" ) ) {
01251 } else if ( !Q_stricmp( arg1, "kick" ) ) {
01252 } else if ( !Q_stricmp( arg1, "clientkick" ) ) {
01253 } else if ( !Q_stricmp( arg1, "g_doWarmup" ) ) {
01254 } else if ( !Q_stricmp( arg1, "timelimit" ) ) {
01255 } else if ( !Q_stricmp( arg1, "fraglimit" ) ) {
01256 } else {
01257 trap_SendServerCommand( ent-g_entities, "print \"Invalid vote string.\n\"" );
01258 trap_SendServerCommand( ent-g_entities, "print \"Vote commands are: map_restart, nextmap, map <mapname>, g_gametype <n>, kick <player>, clientkick <clientnum>, g_doWarmup, timelimit <time>, fraglimit <frags>.\n\"" );
01259 return;
01260 }
01261
01262 // if there is still a vote to be executed
01263 if ( level.voteExecuteTime ) {
01264 level.voteExecuteTime = 0;
01265 trap_SendConsoleCommand( EXEC_APPEND, va("%s\n", level.voteString ) );
01266 }
01267
01268 // special case for g_gametype, check for bad values
01269 if ( !Q_stricmp( arg1, "g_gametype" ) ) {
01270 i = atoi( arg2 );
01271 if( i == GT_SINGLE_PLAYER || i < GT_FFA || i >= GT_MAX_GAME_TYPE) {
01272 trap_SendServerCommand( ent-g_entities, "print \"Invalid gametype.\n\"" );
01273 return;
01274 }
01275
01276 Com_sprintf( level.voteString, sizeof( level.voteString ), "%s %d", arg1, i );
01277 Com_sprintf( level.voteDisplayString, sizeof( level.voteDisplayString ), "%s %s", arg1, gameNames[i] );
01278 } else if ( !Q_stricmp( arg1, "map" ) ) {
01279 // special case for map changes, we want to reset the nextmap setting
01280 // this allows a player to change maps, but not upset the map rotation
01281 char s[MAX_STRING_CHARS];
01282
01283 trap_Cvar_VariableStringBuffer( "nextmap", s, sizeof(s) );
01284 if (*s) {
01285 Com_sprintf( level.voteString, sizeof( level.voteString ), "%s %s; set nextmap \"%s\"", arg1, arg2, s );
01286 } else {
01287 Com_sprintf( level.voteString, sizeof( level.voteString ), "%s %s", arg1, arg2 );
01288 }
01289 Com_sprintf( level.voteDisplayString, sizeof( level.voteDisplayString ), "%s", level.voteString );
01290 } else if ( !Q_stricmp( arg1, "nextmap" ) ) {
01291 char s[MAX_STRING_CHARS];
01292
01293 trap_Cvar_VariableStringBuffer( "nextmap", s, sizeof(s) );
01294 if (!*s) {
01295 trap_SendServerCommand( ent-g_entities, "print \"nextmap not set.\n\"" );
01296 return;
01297 }
01298 Com_sprintf( level.voteString, sizeof( level.voteString ), "vstr nextmap");
01299 Com_sprintf( level.voteDisplayString, sizeof( level.voteDisplayString ), "%s", level.voteString );
01300 } else {
01301 Com_sprintf( level.voteString, sizeof( level.voteString ), "%s \"%s\"", arg1, arg2 );
01302 Com_sprintf( level.voteDisplayString, sizeof( level.voteDisplayString ), "%s", level.voteString );
01303 }
01304
01305 trap_SendServerCommand( -1, va("print \"%s called a vote.\n\"", ent->client->pers.netname ) );
01306
01307 // start the voting, the caller autoamtically votes yes
01308 level.voteTime = level.time;
01309 level.voteYes = 1;
01310 level.voteNo = 0;
01311
01312 for ( i = 0 ; i < level.maxclients ; i++ ) {
01313 level.clients[i].ps.eFlags &= ~EF_VOTED;
01314 }
01315 ent->client->ps.eFlags |= EF_VOTED;
01316
01317 trap_SetConfigstring( CS_VOTE_TIME, va("%i", level.voteTime ) );
01318 trap_SetConfigstring( CS_VOTE_STRING, level.voteDisplayString );
01319 trap_SetConfigstring( CS_VOTE_YES, va("%i", level.voteYes ) );
01320 trap_SetConfigstring( CS_VOTE_NO, va("%i", level.voteNo ) );
01321 }
|
Here is the call graph for this function:

|
|
Definition at line 707 of file g_cmds.c. References gentity_s::client, ClientNumberFromString(), level_locals_t::clients, g_gametype, gentity_t, i, level, clientSession_t::losses, gclient_s::sess, clientSession_t::sessionTeam, SetTeam(), clientSession_t::spectatorClient, clientSession_t::spectatorState, StopFollowing(), trap_Argc(), and trap_Argv(). Referenced by ClientCommand(). 00707 {
00708 int i;
00709 char arg[MAX_TOKEN_CHARS];
00710
00711 if ( trap_Argc() != 2 ) {
00712 if ( ent->client->sess.spectatorState == SPECTATOR_FOLLOW ) {
00713 StopFollowing( ent );
00714 }
00715 return;
00716 }
00717
00718 trap_Argv( 1, arg, sizeof( arg ) );
00719 i = ClientNumberFromString( ent, arg );
00720 if ( i == -1 ) {
00721 return;
00722 }
00723
00724 // can't follow self
00725 if ( &level.clients[ i ] == ent->client ) {
00726 return;
00727 }
00728
00729 // can't follow another spectator
00730 if ( level.clients[ i ].sess.sessionTeam == TEAM_SPECTATOR ) {
00731 return;
00732 }
00733
00734 // if they are playing a tournement game, count as a loss
00735 if ( (g_gametype.integer == GT_TOURNAMENT )
00736 && ent->client->sess.sessionTeam == TEAM_FREE ) {
00737 ent->client->sess.losses++;
00738 }
00739
00740 // first set them to spectator
00741 if ( ent->client->sess.sessionTeam != TEAM_SPECTATOR ) {
00742 SetTeam( ent, "spectator" );
00743 }
00744
00745 ent->client->sess.spectatorState = SPECTATOR_FOLLOW;
00746 ent->client->sess.spectatorClient = i;
00747 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 754 of file g_cmds.c. References gentity_s::client, level_locals_t::clients, clientPersistant_t::connected, G_Error(), g_gametype, gentity_t, level, clientSession_t::losses, level_locals_t::maxclients, gclient_s::pers, gclient_s::sess, clientSession_t::sessionTeam, SetTeam(), clientSession_t::spectatorClient, and clientSession_t::spectatorState. Referenced by ClientCommand(), and SpectatorThink(). 00754 {
00755 int clientnum;
00756 int original;
00757
00758 // if they are playing a tournement game, count as a loss
00759 if ( (g_gametype.integer == GT_TOURNAMENT )
00760 && ent->client->sess.sessionTeam == TEAM_FREE ) {
00761 ent->client->sess.losses++;
00762 }
00763 // first set them to spectator
00764 if ( ent->client->sess.spectatorState == SPECTATOR_NOT ) {
00765 SetTeam( ent, "spectator" );
00766 }
00767
00768 if ( dir != 1 && dir != -1 ) {
00769 G_Error( "Cmd_FollowCycle_f: bad dir %i", dir );
00770 }
00771
00772 clientnum = ent->client->sess.spectatorClient;
00773 original = clientnum;
00774 do {
00775 clientnum += dir;
00776 if ( clientnum >= level.maxclients ) {
00777 clientnum = 0;
00778 }
00779 if ( clientnum < 0 ) {
00780 clientnum = level.maxclients - 1;
00781 }
00782
00783 // can only follow connected clients
00784 if ( level.clients[ clientnum ].pers.connected != CON_CONNECTED ) {
00785 continue;
00786 }
00787
00788 // can't follow another spectator
00789 if ( level.clients[ clientnum ].sess.sessionTeam == TEAM_SPECTATOR ) {
00790 continue;
00791 }
00792
00793 // this is good, we can use it
00794 ent->client->sess.spectatorClient = clientnum;
00795 ent->client->sess.spectatorState = SPECTATOR_FOLLOW;
00796 return;
00797 } while ( clientnum != original );
00798
00799 // leave it where it was
00800 }
|
Here is the call graph for this function:

|
|
Definition at line 1170 of file g_cmds.c. References atoi, g_entities, G_Say(), gc_orders, gentity_t, order, SAY_TELL, and trap_Argv(). Referenced by ClientCommand(). 01170 {
01171 int player;
01172 int order;
01173 char str[MAX_TOKEN_CHARS];
01174
01175 trap_Argv( 1, str, sizeof( str ) );
01176 player = atoi( str );
01177 trap_Argv( 2, str, sizeof( str ) );
01178 order = atoi( str );
01179
01180 if ( player < 0 || player >= MAX_CLIENTS ) {
01181 return;
01182 }
01183 if ( order < 0 || order > sizeof(gc_orders)/sizeof(char *) ) {
01184 return;
01185 }
01186 G_Say( ent, &g_entities[player], SAY_TELL, gc_orders[order] );
01187 G_Say( ent, ent, SAY_TELL, gc_orders[order] );
01188 }
|
Here is the call graph for this function:

|
|
Definition at line 230 of file g_cmds.c. References playerState_s::ammo, BG_FindItem(), CheatsOk(), gitem_s::classname, gentity_s::classname, gentity_s::client, ConcatArgs(), entityShared_t::currentOrigin, FinishSpawningItem(), G_FreeEntity(), G_Spawn(), G_SpawnItem(), gentity_t, gitem_t, gentity_s::health, i, gentity_s::inuse, memset(), name, entityState_s::origin, playerState_s::persistant, gclient_s::ps, Q_stricmp(), qboolean, gentity_s::r, gentity_s::s, playerState_s::stats, Touch_Item(), and VectorCopy. Referenced by ClientCommand(). 00231 {
00232 char *name;
00233 gitem_t *it;
00234 int i;
00235 qboolean give_all;
00236 gentity_t *it_ent;
00237 trace_t trace;
00238
00239 if ( !CheatsOk( ent ) ) {
00240 return;
00241 }
00242
00243 name = ConcatArgs( 1 );
00244
00245 if (Q_stricmp(name, "all") == 0)
00246 give_all = qtrue;
00247 else
00248 give_all = qfalse;
00249
00250 if (give_all || Q_stricmp( name, "health") == 0)
00251 {
00252 ent->health = ent->client->ps.stats[STAT_MAX_HEALTH];
00253 if (!give_all)
00254 return;
00255 }
00256
00257 if (give_all || Q_stricmp(name, "weapons") == 0)
00258 {
00259 ent->client->ps.stats[STAT_WEAPONS] = (1 << WP_NUM_WEAPONS) - 1 -
00260 ( 1 << WP_GRAPPLING_HOOK ) - ( 1 << WP_NONE );
00261 if (!give_all)
00262 return;
00263 }
00264
00265 if (give_all || Q_stricmp(name, "ammo") == 0)
00266 {
00267 for ( i = 0 ; i < MAX_WEAPONS ; i++ ) {
00268 ent->client->ps.ammo[i] = 999;
00269 }
00270 if (!give_all)
00271 return;
00272 }
00273
00274 if (give_all || Q_stricmp(name, "armor") == 0)
00275 {
00276 ent->client->ps.stats[STAT_ARMOR] = 200;
00277
00278 if (!give_all)
00279 return;
00280 }
00281
00282 if (Q_stricmp(name, "excellent") == 0) {
00283 ent->client->ps.persistant[PERS_EXCELLENT_COUNT]++;
00284 return;
00285 }
00286 if (Q_stricmp(name, "impressive") == 0) {
00287 ent->client->ps.persistant[PERS_IMPRESSIVE_COUNT]++;
00288 return;
00289 }
00290 if (Q_stricmp(name, "gauntletaward") == 0) {
00291 ent->client->ps.persistant[PERS_GAUNTLET_FRAG_COUNT]++;
00292 return;
00293 }
00294 if (Q_stricmp(name, "defend") == 0) {
00295 ent->client->ps.persistant[PERS_DEFEND_COUNT]++;
00296 return;
00297 }
00298 if (Q_stricmp(name, "assist") == 0) {
00299 ent->client->ps.persistant[PERS_ASSIST_COUNT]++;
00300 return;
00301 }
00302
00303 // spawn a specific item right on the player
00304 if ( !give_all ) {
00305 it = BG_FindItem (name);
00306 if (!it) {
00307 return;
00308 }
00309
00310 it_ent = G_Spawn();
00311 VectorCopy( ent->r.currentOrigin, it_ent->s.origin );
00312 it_ent->classname = it->classname;
00313 G_SpawnItem (it_ent, it);
00314 FinishSpawningItem(it_ent );
00315 memset( &trace, 0, sizeof( trace ) );
00316 Touch_Item (it_ent, ent, &trace);
00317 if (it_ent->inuse) {
00318 G_FreeEntity( it_ent );
00319 }
00320 }
00321 }
|
Here is the call graph for this function:

|
|
Definition at line 333 of file g_cmds.c. References CheatsOk(), gentity_s::flags, g_entities, gentity_t, trap_SendServerCommand(), and va(). Referenced by ClientCommand(). 00334 {
00335 char *msg;
00336
00337 if ( !CheatsOk( ent ) ) {
00338 return;
00339 }
00340
00341 ent->flags ^= FL_GODMODE;
00342 if (!(ent->flags & FL_GODMODE) )
00343 msg = "godmode OFF\n";
00344 else
00345 msg = "godmode ON\n";
00346
00347 trap_SendServerCommand( ent-g_entities, va("print \"%s\"", msg));
00348 }
|
Here is the call graph for this function:
