/* ================= CG_ServerMenu_f ================= */ static void CG_ServerMenu_f( void ) { if( !cg.demoPlayback ) { if( trap_Argc( ) == 2 ) CG_Menu( atoi( CG_Argv( 1 ) ), 0 ); else if( trap_Argc( ) == 3 ) CG_Menu( atoi( CG_Argv( 1 ) ), atoi( CG_Argv( 2 ) ) ); } }
/* ================= CG_ServerCommand The string has been tokenized and can be retrieved with Cmd_Argc() / Cmd_Argv() ================= */ static void CG_ServerCommand( void ) { const char *cmd; char text[ MAX_SAY_TEXT ]; cmd = CG_Argv( 0 ); if ( !cmd[ 0 ] ) { // server claimed the command return; } if ( !strcmp( cmd, "cp" ) ) { CG_CenterPrint( CG_Argv( 1 ), SCREEN_HEIGHT * 0.30, BIGCHAR_WIDTH ); return; } if ( !strcmp( cmd, "cs" ) ) { CG_ConfigStringModified(); return; } if ( !strcmp( cmd, "print" ) ) { CG_Printf( "%s", CG_Argv( 1 ) ); return; } if ( !strcmp( cmd, "chat" ) ) { if ( !cg_teamChatsOnly.integer ) { trap_S_StartLocalSound( cgs.media.talkSound, CHAN_LOCAL_SOUND ); Q_strncpyz( text, CG_Argv( 1 ), MAX_SAY_TEXT ); CG_RemoveChatEscapeChar( text ); CG_Printf( "%s\n", text ); } return; } if ( !strcmp( cmd, "tchat" ) ) { if ( cg.snap->ps.stats[ STAT_PTEAM ] == PTE_ALIENS ) { trap_S_StartLocalSound( cgs.media.alienTalkSound, CHAN_LOCAL_SOUND ); } else if ( cg.snap->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) { trap_S_StartLocalSound( cgs.media.humanTalkSound, CHAN_LOCAL_SOUND ); } else { trap_S_StartLocalSound( cgs.media.talkSound, CHAN_LOCAL_SOUND ); } Q_strncpyz( text, CG_Argv( 1 ), MAX_SAY_TEXT ); CG_RemoveChatEscapeChar( text ); CG_AddToTeamChat( text ); CG_Printf( "%s\n", text ); return; } if ( !strcmp( cmd, "scores" ) ) { CG_ParseScores(); return; } if ( !strcmp( cmd, "tinfo" ) ) { CG_ParseTeamInfo(); return; } if ( !strcmp( cmd, "map_restart" ) ) { CG_MapRestart(); return; } if ( Q_stricmp( cmd, "remapShader" ) == 0 ) { if ( trap_Argc() == 4 ) { trap_R_RemapShader( CG_Argv( 1 ), CG_Argv( 2 ), CG_Argv( 3 ) ); } } //the server has triggered a menu if ( !strcmp( cmd, "servermenu" ) ) { if ( trap_Argc() == 2 && !cg.demoPlayback ) { CG_Menu( atoi( CG_Argv( 1 ) ) ); } return; } //the server thinks this client should close all menus if ( !strcmp( cmd, "serverclosemenus" ) ) { trap_SendConsoleCommand( "closemenus\n" ); return; } //poison cloud effect needs to be reliable if ( !strcmp( cmd, "poisoncloud" ) ) { cg.poisonedTime = cg.time; if ( CG_IsParticleSystemValid( &cg.poisonCloudPS ) ) { cg.poisonCloudPS = CG_SpawnNewParticleSystem( cgs.media.poisonCloudPS ); CG_SetAttachmentCent( &cg.poisonCloudPS->attachment, &cg.predictedPlayerEntity ); CG_AttachToCent( &cg.poisonCloudPS->attachment ); } return; } if ( !strcmp( cmd, "weaponswitch" ) ) { CG_Printf( "client weaponswitch\n" ); if ( trap_Argc() == 2 ) { cg.weaponSelect = atoi( CG_Argv( 1 ) ); cg.weaponSelectTime = cg.time; } return; } // server requests a ptrc if ( !strcmp( cmd, "ptrcrequest" ) ) { int code = CG_ReadPTRCode(); trap_SendClientCommand( va( "ptrcverify %d", code ) ); return; } // server issues a ptrc if ( !strcmp( cmd, "ptrcissue" ) ) { if ( trap_Argc() == 2 ) { int code = atoi( CG_Argv( 1 ) ); CG_WritePTRCode( code ); } return; } // reply to ptrcverify if ( !strcmp( cmd, "ptrcconfirm" ) ) { trap_SendConsoleCommand( "menu ptrc_popmenu\n" ); return; } CG_Printf( "Unknown client game command: %s\n", cmd ); }