/* ================= ConsoleCommand ================= */ qboolean ConsoleCommand( void ) { char cmd[MAX_TOKEN_CHARS]; trap_Argv( 0, cmd, sizeof( cmd ) ); // all commands prefixed with st_ are destined for the rules engine. if ( cmd[ 0 ] == 's' && cmd[ 1 ] == 't' && cmd[ 2 ] == '_' ) { if ( G_ST_exec( ST_CONSOLECOMMAND, cmd+3 ) ) return qtrue; } switch( SWITCHSTRING( cmd ) ) { #ifdef DEVELOPER case CS('b','u','y',0): case CS('s','e','l','l'): case CS('v','i','s','i'): case CS('b','e','g','i'): case CS('a','s','s','e'): case CS('i','n','t','e'): case CS('e','n','d','i'): case CS('l','o','o','k'): case CS('p','l','a','n'): G_ST_exec( ST_CLIENTCOMMAND, 0, cmd ); trap_SendConsoleCommand( EXEC_INSERT, "wait 50 ;" ); return qtrue; // cl0_ case CS('c','l','0','_'): ClientCommand( 0, cmd + 4 ); return 0; #endif // entitylist case CS('e','n','t','i'): Svcmd_EntityList_f(); return qtrue; // forceteam case CS('f','o','r','c'): Svcmd_ForceTeam_f(); return qtrue; // game_memory case CS('g','a','m','e'): Svcmd_GameMem_f(); return qtrue; // addbot case CS('a','d','d','b'): Svcmd_AddBot_f(); return qtrue; // botlist case CS('b','o','t','l'): Svcmd_BotList_f(); return qtrue; // addip case CS('a','d','d','i'): Svcmd_AddIP_f(); return qtrue; // removeip case CS('r','e','m','o'): Svcmd_RemoveIP_f(); return qtrue; // listip case CS('l','i','s','t'): trap_SendConsoleCommand( EXEC_NOW, "g_banIPs\n" ); return qtrue; // abort case CS('a','b','o','r'): G_ST_exec( ST_CONSOLECOMMAND, cmd ); return qtrue; } if (g_dedicated.integer) { if (Q_stricmp (cmd, "say") == 0) { trap_SendServerCommand( -1, va("print \"server: %s\"", ConcatArgs(1) ) ); return qtrue; } // everything else will also be printed as a say command trap_SendServerCommand( -1, va("print \"server: %s\"", ConcatArgs(0) ) ); return qtrue; } return qfalse; }
/* ================= ConsoleCommand ================= */ qboolean ConsoleCommand( void ) { char cmd[MAX_TOKEN_CHARS]; trap_Argv( 0, cmd, sizeof( cmd ) ); if ( Q_stricmp (cmd, "entitylist") == 0 ) { Svcmd_EntityList_f(); return qtrue; } if ( Q_stricmp (cmd, "forceteam") == 0 ) { Svcmd_ForceTeam_f(); return qtrue; } if (Q_stricmp (cmd, "game_memory") == 0) { Svcmd_GameMem_f(); return qtrue; } if (Q_stricmp (cmd, "addbot") == 0) { Svcmd_AddBot_f(); return qtrue; } if (Q_stricmp (cmd, "botlist") == 0) { Svcmd_BotList_f(); return qtrue; } if (Q_stricmp (cmd, "abort_podium") == 0) { Svcmd_AbortPodium_f(); return qtrue; } if (Q_stricmp (cmd, "addip") == 0) { Svcmd_AddIP_f(); return qtrue; } if (Q_stricmp (cmd, "removeip") == 0) { Svcmd_RemoveIP_f(); return qtrue; } if (Q_stricmp (cmd, "listip") == 0) { trap_SendConsoleCommand( EXEC_NOW, "g_banIPs\n" ); return qtrue; } if(Q_stricmp (cmd, "setGametype") == 0) { Svcmd_SetGameType_f(); return qtrue; } if(Q_stricmp (cmd, "startcam") == 0) { Svcmd_StartCam(); return qtrue; } if(Q_stricmp (cmd, "stopcam") == 0) { Svcmd_StopCam(); return qtrue; } if(Q_stricmp (cmd, "camcmd") == 0) { Svcmd_CamCmd(); return qtrue; } if( !Q_stricmp( cmd, "initwp") ) { WaypointInit(); return qtrue; } if ( Q_stricmp( cmd, "blibset") == 0 ) { char key[MAX_TOKEN_CHARS]; char value[MAX_TOKEN_CHARS]; trap_Argv(1, key, sizeof(key) ); trap_Argv(2, value, sizeof(value) ); if(!strlen(key)) { G_Printf("missing key\n"); return qtrue; } if( !strlen(value) ) // use "1" as default strcpy( value, "1" ); trap_BotLibVarSet( key, value ); return qtrue; } if(wopSP_cmdCheck(cmd)) return qtrue; if (g_dedicated.integer) { if ( Q_stricmp( cmd, "ssay" ) == 0 ) { Svcmd_Say_f(); return qtrue; } if ( Q_stricmp( cmd, "stell" ) == 0 ) { Svcmd_Tell_f(); return qtrue; } if ( Q_stricmp( cmd, "scp" ) == 0 ) { Svcmd_ClientCommand_f( CCMD_CP ); return qtrue; } if ( Q_stricmp( cmd, "smp" ) == 0 ) { Svcmd_ClientCommand_f( CCMD_MP ); return qtrue; } if ( Q_stricmp( cmd, "sprint" ) == 0 ) { Svcmd_ClientCommand_f( CCMD_PRINT ); return qtrue; } // everything else will also be printed to clients trap_SendServerCommand( -1, va("print \"server: %s\n\"", ConcatArgs(0) ) ); return qtrue; } return qfalse; }
/* ================= ConsoleCommand ================= */ qboolean ConsoleCommand( void ) { char cmd[MAX_TOKEN_CHARS]; trap_Argv( 0, cmd, sizeof( cmd ) ); if ( Q_stricmp( cmd, "entitylist" ) == 0 ) { Svcmd_EntityList_f(); return qtrue; } if ( Q_stricmp( cmd, "forceteam" ) == 0 ) { Svcmd_ForceTeam_f(); return qtrue; } if ( Q_stricmp( cmd, "game_memory" ) == 0 ) { Svcmd_GameMem_f(); return qtrue; } if ( Q_stricmp( cmd, "addbot" ) == 0 ) { Svcmd_AddBot_f(); return qtrue; } if ( Q_stricmp( cmd, "addip" ) == 0 ) { Svcmd_AddIP_f(); return qtrue; } if ( Q_stricmp( cmd, "removeip" ) == 0 ) { Svcmd_RemoveIP_f(); return qtrue; } if ( Q_stricmp( cmd, "listip" ) == 0 ) { trap_SendConsoleCommand( EXEC_INSERT, "g_banIPs\n" ); return qtrue; } if ( Q_stricmp( cmd, "listmaxlivesip" ) == 0 ) { PrintMaxLivesGUID(); return qtrue; } // NERVE - SMF if ( Q_stricmp( cmd, "start_match" ) == 0 ) { Svcmd_StartMatch_f(); return qtrue; } if ( Q_stricmp( cmd, "reset_match" ) == 0 ) { Svcmd_ResetMatch_f(); return qtrue; } if ( Q_stricmp( cmd, "swap_teams" ) == 0 ) { Svcmd_SwapTeams_f(); return qtrue; } // -NERVE - SMF if ( g_dedicated.integer ) { if ( Q_stricmp( cmd, "say" ) == 0 ) { trap_SendServerCommand( -1, va( "print \"server:[lof] %s\"", ConcatArgs( 1 ) ) ); return qtrue; } // everything else will also be printed as a say command trap_SendServerCommand( -1, va( "print \"server:[lof] %s\"", ConcatArgs( 0 ) ) ); return qtrue; } return qfalse; }
/* ================= ConsoleCommand ================= */ qboolean ConsoleCommand( void ) { char cmd[MAX_TOKEN_CHARS]; trap_Argv( 0, cmd, sizeof( cmd ) ); if ( Q_stricmp (cmd, "entitylist") == 0 ) { Svcmd_EntityList_f(); return qtrue; } if ( Q_stricmp (cmd, "forceteam") == 0 ) { Svcmd_ForceTeam_f(); return qtrue; } if (Q_stricmp (cmd, "game_memory") == 0) { Svcmd_GameMem_f(); return qtrue; } if (Q_stricmp (cmd, "addbot") == 0) { Svcmd_AddBot_f(); return qtrue; } if (Q_stricmp (cmd, "botlist") == 0) { Svcmd_BotList_f(); return qtrue; } /* if (Q_stricmp (cmd, "abort_podium") == 0) { Svcmd_AbortPodium_f(); return qtrue; } */ if (Q_stricmp (cmd, "addip") == 0) { Svcmd_AddIP_f(); return qtrue; } if (Q_stricmp (cmd, "removeip") == 0) { Svcmd_RemoveIP_f(); return qtrue; } if (Q_stricmp (cmd, "listip") == 0) { trap_SendConsoleCommand( EXEC_NOW, "g_banIPs\n" ); return qtrue; } if (g_dedicated.integer) { if (Q_stricmp (cmd, "say") == 0) { trap_SendServerCommand( -1, va("print \"server: %s\n\"", ConcatArgs(1) ) ); return qtrue; } // everything else will also be printed as a say command trap_SendServerCommand( -1, va("print \"server: %s\n\"", ConcatArgs(0) ) ); return qtrue; } return qfalse; }
/* ================= ConsoleCommand ================= */ qboolean ConsoleCommand(void) { char cmd[MAX_TOKEN_CHARS]; trap_Argv(0, cmd, sizeof(cmd)); #ifdef FEATURE_LUA if (!Q_stricmp(cmd, "lua_status")) { G_LuaStatus(NULL); return qtrue; } // *LUA* API callbacks if (G_LuaHook_ConsoleCommand(cmd)) { return qtrue; } #endif if (Q_stricmp(cmd, "entitylist") == 0) { Svcmd_EntityList_f(); return qtrue; } if (Q_stricmp(cmd, "forceteam") == 0) { Svcmd_ForceTeam_f(); return qtrue; } if (Q_stricmp(cmd, "game_memory") == 0) { Svcmd_GameMem_f(); return qtrue; } if (Q_stricmp(cmd, "addip") == 0) { Svcmd_AddIP_f(); return qtrue; } if (Q_stricmp(cmd, "removeip") == 0) { Svcmd_RemoveIP_f(); return qtrue; } if (Q_stricmp(cmd, "listip") == 0) { trap_SendConsoleCommand(EXEC_INSERT, "g_banIPs\n"); return qtrue; } if (Q_stricmp(cmd, "listmaxlivesip") == 0) { PrintMaxLivesGUID(); return qtrue; } if (Q_stricmp(cmd, "start_match") == 0) { Svcmd_StartMatch_f(); return qtrue; } if (Q_stricmp(cmd, "reset_match") == 0) { Svcmd_ResetMatch_f(qtrue, qtrue); return qtrue; } if (Q_stricmp(cmd, "swap_teams") == 0) { Svcmd_SwapTeams_f(); return qtrue; } if (Q_stricmp(cmd, "shuffle_teams") == 0) { Svcmd_ShuffleTeams_f(); return qtrue; } if (Q_stricmp(cmd, "makeReferee") == 0) { G_MakeReferee(); return qtrue; } if (Q_stricmp(cmd, "removeReferee") == 0) { G_RemoveReferee(); return qtrue; } /*if (Q_stricmp (cmd, "mute") == 0) { G_MuteClient(); return qtrue; } if (Q_stricmp (cmd, "unmute") == 0) { G_UnMuteClient(); return qtrue; }*/ if (Q_stricmp(cmd, "ban") == 0) { G_PlayerBan(); return qtrue; } if (Q_stricmp(cmd, "campaign") == 0) { Svcmd_Campaign_f(); return qtrue; } if (Q_stricmp(cmd, "listcampaigns") == 0) { Svcmd_ListCampaigns_f(); return qtrue; } if (Q_stricmp(cmd, "revive") == 0) { trap_Argv(1, cmd, sizeof(cmd)); Svcmd_RevivePlayer(cmd); return qtrue; } // fretn - moved from engine if (!Q_stricmp(cmd, "kick")) { Svcmd_Kick_f(); return qtrue; } if (!Q_stricmp(cmd, "clientkick")) { Svcmd_KickNum_f(); return qtrue; } #ifdef FEATURE_OMNIBOT if (!Q_stricmp(cmd, "bot")) { Bot_Interface_ConsoleCommand(); return qtrue; } #endif if (!Q_stricmp(cmd, "sv_cvarempty")) { memset(level.svCvars, 0, sizeof(level.svCvars)); level.svCvarsCount = 0; G_UpdateSvCvars(); return qtrue; } if (!Q_stricmp(cmd, "sv_cvar")) { CC_svcvar(); return qtrue; } if (!Q_stricmp(cmd, "playsound") || !Q_stricmp(cmd, "playsound_env")) { G_PlaySound_Cmd(); return qtrue; } if (g_dedicated.integer) { if (!Q_stricmp(cmd, "say")) { trap_SendServerCommand(-1, va("cpm \"server: %s\n\"", ConcatArgs(1))); return qtrue; } // OSP - console also gets ref commands if (!level.fLocalHost && Q_stricmp(cmd, "ref") == 0) { // G_refCommandCheck expects the next argument (warn, pause, lock,..) trap_Argv(1, cmd, sizeof(cmd)); if (!G_refCommandCheck(NULL, cmd)) { G_refHelp_cmd(NULL); } return qtrue; } // everything else will also be printed as a say command // trap_SendServerCommand( -1, va("cpm \"server: %s\n\"", ConcatArgs(0) ) ); // prints to the console instead now return qfalse; } return qfalse; }
/* ================= ConsoleCommand ================= */ qboolean ConsoleCommand( void ) { char cmd[MAX_TOKEN_CHARS]; trap_Argv( 0, cmd, sizeof( cmd ) ); #ifdef SAVEGAME_SUPPORT if (Q_stricmp (cmd, "savegame") == 0) { if( g_gametype.integer != GT_SINGLE_PLAYER ) return qtrue; // don't allow a manual savegame command while we are waiting for the game to start/exit if (g_reloading.integer) return qtrue; if (saveGamePending) return qtrue; trap_Argv( 1, cmd, sizeof( cmd ) ); if (strlen(cmd) > 0) { // strip the extension if provided if (strrchr(cmd, '.')) { cmd[strrchr(cmd,'.')-cmd] = '\0'; } if ( !Q_stricmp( cmd, "current") ) { // beginning of map Com_Printf("sorry, '%s' is a reserved savegame name. please use another name.\n", cmd); return qtrue; } if (G_SaveGame( cmd )) trap_SendServerCommand(-1, "cp \"Game Saved\n\""); // deletedgame else G_Printf( "Unable to save game.\n" ); } else { // need a name G_Printf( "syntax: savegame <name>\n" ); } return qtrue; } #endif // SAVEGAME_SUPPORT if ( Q_stricmp (cmd, "entitylist") == 0 ) { Svcmd_EntityList_f(); return qtrue; } // omnibot: waypoint tool only, not for mods if ( Q_stricmp (cmd, "oidlist") == 0 ) { Svcmd_OIDList_f(); return qtrue; } if ( Q_stricmp (cmd, "forceteam") == 0 ) { Svcmd_ForceTeam_f(); return qtrue; } if (Q_stricmp (cmd, "game_memory") == 0) { Svcmd_GameMem_f(); return qtrue; } // omnibot /*if (Q_stricmp (cmd, "addbot") == 0) { Svcmd_AddBot_f(); return qtrue; } if (Q_stricmp (cmd, "removebot") == 0) { Svcmd_AddBot_f(); return qtrue; }*/ // end omnibot if (Q_stricmp (cmd, "addip") == 0) { Svcmd_AddIP_f(); return qtrue; } if (Q_stricmp (cmd, "removeip") == 0) { Svcmd_RemoveIP_f(); return qtrue; } if (Q_stricmp (cmd, "listip") == 0) { trap_SendConsoleCommand( EXEC_INSERT, "g_banIPs\n" ); return qtrue; } if (Q_stricmp (cmd, "listmaxlivesip") == 0) { PrintMaxLivesGUID(); return qtrue; } // NERVE - SMF if (Q_stricmp (cmd, "start_match") == 0) { Svcmd_StartMatch_f(); return qtrue; } if (Q_stricmp (cmd, "reset_match") == 0) { Svcmd_ResetMatch_f(qtrue, qtrue); return qtrue; } if (Q_stricmp (cmd, "swap_teams") == 0) { Svcmd_SwapTeams_f(); return qtrue; } if (Q_stricmp (cmd, "shuffle_teams") == 0) { Svcmd_ShuffleTeams_f(); return qtrue; } // -NERVE - SMF if (Q_stricmp (cmd, "makeReferee") == 0) { G_MakeReferee(); return qtrue; } if (Q_stricmp (cmd, "removeReferee") == 0) { G_RemoveReferee(); return qtrue; } /*if (Q_stricmp (cmd, "mute") == 0) { G_MuteClient(); return qtrue; } if (Q_stricmp (cmd, "unmute") == 0) { G_UnMuteClient(); return qtrue; }*/ if (Q_stricmp (cmd, "ban") == 0) { G_PlayerBan(); return qtrue; } if( Q_stricmp( cmd, "campaign" ) == 0 ) { Svcmd_Campaign_f(); return qtrue; } if( Q_stricmp( cmd, "listcampaigns" ) == 0 ) { Svcmd_ListCampaigns_f(); return qtrue; } #ifndef NO_BOT_SUPPORT if (Q_stricmp (cmd, "spawnbot") == 0) { Svcmd_SpawnBot(); return qtrue; } #endif // START - Mad Doc - TDF if (Q_stricmp (cmd, "revive") == 0) { trap_Argv( 1, cmd, sizeof( cmd ) ); Svcmd_RevivePlayer( cmd ); return qtrue; } // END - Mad Doc - TDF // omnibot if (Q_stricmp (cmd, "bot") == 0) { Bot_Interface_ConsoleCommand(); return qtrue; } // end omnibot // fretn - moved from engine if (!Q_stricmp(cmd, "kick")) { Svcmd_Kick_f(); return qtrue; } if (!Q_stricmp(cmd, "clientkick")) { Svcmd_KickNum_f(); return qtrue; } // -fretn if( g_dedicated.integer ) { if( !Q_stricmp (cmd, "say")) { trap_SendServerCommand( -1, va("cpm \"server: %s\n\"", ConcatArgs(1) ) ); return qtrue; } // OSP - console also gets ref commands if(!level.fLocalHost && Q_stricmp(cmd, "ref") == 0) { if(!G_refCommandCheck(NULL, cmd)) { G_refHelp_cmd(NULL); } return(qtrue); } // everything else will also be printed as a say command // trap_SendServerCommand( -1, va("cpm \"server: %s\n\"", ConcatArgs(0) ) ); // prints to the console instead now return qfalse; } return qfalse; }
/* ================= ConsoleCommand ================= */ qboolean ConsoleCommand( void ) { char cmd[MAX_TOKEN_CHARS]; trap_Argv( 0, cmd, sizeof( cmd ) ); if ( Q_stricmp (cmd, "entitylist") == 0 ) { Svcmd_EntityList_f(); return qtrue; } if ( Q_stricmp (cmd, "forceteam") == 0 ) { Svcmd_ForceTeam_f(); return qtrue; } if (Q_stricmp (cmd, "game_memory") == 0) { Svcmd_GameMem_f(); return qtrue; } if (Q_stricmp (cmd, "addbot") == 0) { Svcmd_AddBot_f(); return qtrue; } #ifdef SMOKINGUNS if (Q_stricmp (cmd, "kickbots") == 0) { Svcmd_KickBots_f(); return qtrue; } #endif if (Q_stricmp (cmd, "botlist") == 0) { Svcmd_BotList_f(); return qtrue; } #ifndef SMOKINGUNS if (Q_stricmp (cmd, "abort_podium") == 0) { Svcmd_AbortPodium_f(); return qtrue; } #endif if (Q_stricmp (cmd, "addip") == 0) { Svcmd_AddIP_f(); return qtrue; } if (Q_stricmp (cmd, "removeip") == 0) { Svcmd_RemoveIP_f(); return qtrue; } if (Q_stricmp (cmd, "listip") == 0) { trap_SendConsoleCommand( EXEC_NOW, "g_banIPs\n" ); return qtrue; } #ifdef SMOKINGUNS // Tequila: Big text announcement command if (Q_stricmp (cmd, "bigtext") == 0 || Q_stricmp (cmd, "cp") == 0) { Svcmd_BigText_f(); return qtrue; } // Joe Kari: Minilog feature, for admin-bot if (Q_stricmp (cmd, "poponelog") == 0 ) { Svcmd_PopMinilog_f(); return qtrue; } if (Q_stricmp (cmd, "poplog") == 0 ) { Svcmd_PopAllMinilog_f(); return qtrue; } // It is probably not a good idea to allow an user to push the minilog, it would interfer with game log //if (Q_stricmp (cmd, "pushlog") == 0 ) { // Svcmd_PushMinilog_f(); // return qtrue; //} // Joe Kari: Mute command: change everything this client said to "(muted)" if (Q_stricmp (cmd, "mute") == 0) { Svcmd_Mute_f( 1 ); return qtrue; } if (Q_stricmp (cmd, "unmute") == 0) { Svcmd_Mute_f( 0 ); return qtrue; } // Joe Kari: give some money to a client if ( Q_stricmp (cmd, "givemoney") == 0 ) { Svcmd_GiveMoney_f(); return qtrue; } // Joe Kari: give some money to a client if ( Q_stricmp (cmd, "giveitem") == 0 ) { Svcmd_GiveItem_f(); return qtrue; } // Joe Kari: replacement for forceteam, using client ID instead of name if ( Q_stricmp (cmd, "forceteamnum") == 0 ) { Svcmd_ForceTeamNum_f(); return qtrue; } // Joe Kari: game version of clientkick if (Q_stricmp (cmd, "kicknum") == 0) { Svcmd_KickNum_f(); return qtrue; } // Tequila: Replacement for kick command from server engine with sendaway one if (Q_stricmp (cmd, "sendaway") == 0) { Svcmd_SendAway_f(); return qtrue; } // Tequila: New admin command to cancel a vote // Joe Kari: Move it out of "if (g_dedicated.integer) {}" if (Q_stricmp (cmd, "cancelvote") == 0) { Svcmd_CancelVote_f(); return qtrue; } if (Q_stricmp (cmd, "playerstatus") == 0) { Svcmd_PlayerStatus_f(); return qtrue; } // Tequila: New command to add a map entity for testing purpose if (Q_stricmp (cmd, "addentity") == 0) { Svcmd_AddEntity_f(); return qtrue; } #endif if (g_dedicated.integer) { if (Q_stricmp (cmd, "say") == 0) { trap_SendServerCommand( -1, va("print \"server: %s\"", ConcatArgs(1) ) ); return qtrue; } // everything else will also be printed as a say command trap_SendServerCommand( -1, va("print \"server: %s\"", ConcatArgs(0) ) ); return qtrue; } return qfalse; }
qboolean ConsoleCommand( void ) { char cmd[MAX_TOKEN_CHARS]; trap->Cmd_Argv( 0, cmd, sizeof( cmd ) ); if ( !Q_stricmp( cmd, "entitylist" ) ) { Svcmd_EntityList_f(); return qtrue; } if ( !Q_stricmp( cmd, "forceteam" ) ) { Svcmd_ForceTeam_f(); return qtrue; } if ( !Q_stricmp( cmd, "game_memory" ) ) { Svcmd_GameMem_f(); return qtrue; } if ( !Q_stricmp( cmd, "addbot" ) ) { Svcmd_AddBot_f(); return qtrue; } if ( !Q_stricmp( cmd, "botlist" ) ) { Svcmd_BotList_f(); return qtrue; } if ( !Q_stricmp( cmd, "addip" ) ) { Svcmd_AddIP_f(); return qtrue; } if ( !Q_stricmp( cmd, "removeip" ) ) { Svcmd_RemoveIP_f(); return qtrue; } if ( !Q_stricmp( cmd, "listip" ) ) { trap->Cbuf_ExecuteText( EXEC_NOW, "g_banIPs\n" ); return qtrue; } //OSP: pause if ( !Q_stricmp( cmd, "pause" ) ) { if ( level.pause.state == PAUSE_NONE ) { level.pause.state = PAUSE_PAUSED; level.pause.time = level.time + g_pauseTime->integer*1000; } else if ( level.pause.state == PAUSE_PAUSED ) { level.pause.state = PAUSE_UNPAUSING; level.pause.time = level.time + g_unpauseTime->integer*1000; } return qtrue; } if ( dedicated->boolean ) { if ( !Q_stricmp( cmd, "say" ) ) { trap->SV_GameSendServerCommand( -1, va( "print \"server: %s\n\"", ConcatArgs( 1 ) ) ); return qtrue; } } return qfalse; }
qboolean ConsoleCommand(void) { char cmd[MAX_TOKEN_CHARS]; trap_Argv(0, cmd, sizeof(cmd)); #ifdef FEATURE_LUA if (!Q_stricmp(cmd, "lua_status")) { G_LuaStatus(NULL); return qtrue; } if (Q_stricmp(cmd, "lua_api") == 0) { G_LuaStackDump(); return qtrue; } // *LUA* API callbacks if (G_LuaHook_ConsoleCommand(cmd)) { return qtrue; } #endif if (Q_stricmp(cmd, "entitylist") == 0) { Svcmd_EntityList_f(); return qtrue; } if (Q_stricmp(cmd, "csinfo") == 0) { Svcmd_CSInfo_f(); return qtrue; } if (Q_stricmp(cmd, "forceteam") == 0) { Svcmd_ForceTeam_f(); return qtrue; } if (Q_stricmp(cmd, "game_memory") == 0) { Svcmd_GameMem_f(); return qtrue; } if (Q_stricmp(cmd, "addip") == 0) { Svcmd_AddIP_f(); return qtrue; } if (Q_stricmp(cmd, "removeip") == 0) { Svcmd_RemoveIP_f(); return qtrue; } if (Q_stricmp(cmd, "listip") == 0) { trap_SendConsoleCommand(EXEC_INSERT, "g_banIPs\n"); return qtrue; } if (Q_stricmp(cmd, "listmaxlivesip") == 0) { PrintMaxLivesGUID(); return qtrue; } if (Q_stricmp(cmd, "start_match") == 0) { Svcmd_StartMatch_f(); return qtrue; } if (Q_stricmp(cmd, "reset_match") == 0) { Svcmd_ResetMatch_f(qtrue, qtrue); return qtrue; } if (Q_stricmp(cmd, "swap_teams") == 0) { Svcmd_SwapTeams_f(); return qtrue; } if (Q_stricmp(cmd, "shuffle_teams") == 0) { Svcmd_ShuffleTeams_f(qtrue); return qtrue; } if (Q_stricmp(cmd, "shuffle_teams_norestart") == 0) { Svcmd_ShuffleTeams_f(qfalse); return qtrue; } if (Q_stricmp(cmd, "makeReferee") == 0) { G_MakeReferee(); return qtrue; } if (Q_stricmp(cmd, "removeReferee") == 0) { G_RemoveReferee(); return qtrue; } if (Q_stricmp(cmd, "mute") == 0) { G_MuteClient(); return qtrue; } if (Q_stricmp(cmd, "unmute") == 0) { G_UnMuteClient(); return qtrue; } if (Q_stricmp(cmd, "ban") == 0) { G_PlayerBan(); return qtrue; } if (Q_stricmp(cmd, "campaign") == 0) { Svcmd_Campaign_f(); return qtrue; } if (Q_stricmp(cmd, "listcampaigns") == 0) { Svcmd_ListCampaigns_f(); return qtrue; } if (Q_stricmp(cmd, "revive") == 0) { trap_Argv(1, cmd, sizeof(cmd)); Svcmd_RevivePlayer(cmd); return qtrue; } // moved from engine if (!Q_stricmp(cmd, "kick")) { Svcmd_Kick_f(); return qtrue; } if (!Q_stricmp(cmd, "clientkick")) { Svcmd_KickNum_f(); return qtrue; } #ifdef FEATURE_OMNIBOT if (!Q_stricmp(cmd, "bot")) { Bot_Interface_ConsoleCommand(); return qtrue; } #endif if (!Q_stricmp(cmd, "cp")) { trap_SendServerCommand(-1, va("cp \"%s\"", Q_AddCR(ConcatArgs(1)))); return qtrue; } if (!Q_stricmp(cmd, "reloadConfig")) { trap_SetConfigstring(CS_CONFIGNAME, ""); memset(&level.config, 0, sizeof(config_t)); G_configSet(g_customConfig.string); return qtrue; } if (!Q_stricmp(cmd, "loadConfig")) { CC_loadconfig(); return qtrue; } if (!Q_stricmp(cmd, "sv_cvarempty")) { memset(level.svCvars, 0, sizeof(level.svCvars)); level.svCvarsCount = 0; G_UpdateSvCvars(); return qtrue; } if (!Q_stricmp(cmd, "sv_cvar")) { CC_svcvar(); return qtrue; } if (!Q_stricmp(cmd, "playsound") || !Q_stricmp(cmd, "playsound_env")) { G_PlaySound_Cmd(); return qtrue; } //if (g_cheats.integer) //{ if (!Q_stricmp(cmd, "gib")) { Svcmd_Gib(); return qtrue; } if (!Q_stricmp(cmd, "die")) { Svcmd_Die(); return qtrue; } if (!Q_stricmp(cmd, "freeze")) { Svcmd_Freeze(); return qtrue; } if (!Q_stricmp(cmd, "unfreeze")) { Svcmd_Unfreeze(); return qtrue; } if (!Q_stricmp(cmd, "burn")) { Svcmd_Burn(); return qtrue; } if (!Q_stricmp(cmd, "pip")) { Svcmd_Pip(); return qtrue; } if (!Q_stricmp(cmd, "throw")) { Svcmd_Fling(1); return qtrue; } //} if (g_dedicated.integer) { // FIXME // this 'say' condition is never reached?! if (!Q_stricmp(cmd, "say")) { trap_SendServerCommand(-1, va("cpm \"server: %s\n\"", Q_AddCR(ConcatArgs(1)))); return qtrue; } // added for rcon/Lua chat if (!Q_stricmp(cmd, "chat")) { trap_SendServerCommand(-1, va("chat \"console: %s\"", Q_AddCR(ConcatArgs(1)))); return qtrue; } // console also gets ref commands if (!level.fLocalHost && Q_stricmp(cmd, "ref") == 0) { //G_refCommandCheck expects the next argument (warn, pause, lock,..) trap_Argv(1, cmd, sizeof(cmd)); if (!G_refCommandCheck(NULL, cmd)) { G_refHelp_cmd(NULL); } return qtrue; } // everything else will also be printed as a say command //trap_SendServerCommand( -1, va("cpm \"server: %s\n\"", ConcatArgs(0) ) ); // prints to the console instead now return qfalse; } return qfalse; }
qboolean ConsoleCommand( void ) { char cmd[MAX_TOKEN_CHARS]; trap_Argv( 0, cmd, sizeof( cmd ) ); if (!Q_stricmp (cmd, "lua_reload")) { G_Printf("Doing soft GLua restart\n"); GLua_SoftRestart(); return qtrue; } if (!Q_stricmp (cmd, "lua_restart")) { G_Printf("Doing hard GLua restart\n"); GLua_Close(); GLua_Init(); GLua_Hook_GameInit(level.time, 0); GLua_Hook_MapLoadFinished(); return qtrue; } if (!Q_stricmp (cmd, "lua_run")) { char line[1024] = {0}; char buff[1024] = {0}; int i, argc; argc = trap_Argc(); for (i=1; i < argc; i++) { trap_Argv(i, buff, sizeof(buff)); Q_strcat(line, 1023, buff); Q_strcat(line, 1023, " "); //Com_sprintf(line, sizeof(line), "%s%s ", line, buff); } GLua_Run(line); return qtrue; } // Check for admin commands if (JKG_Admin_ExecuteRcon(cmd)) return qtrue; #if 0 if (!Q_stricmp (cmd, "disasm")) { Cmd_DisAsmDirect_f(); return qtrue; } if (!Q_stricmp (cmd, "stresslevel")) { JKG_GLS_StressLevelInfo(); return qtrue; } #endif if (GLua_RconCommand(cmd)) return qtrue; if ( !Q_stricmp (cmd, "entinfo") ) { Svcmd_EntityInfo_f(); return qtrue; } if ( Q_stricmp (cmd, "entitylist") == 0 ) { Svcmd_EntityList_f(); return qtrue; } if ( Q_stricmp (cmd, "forceteam") == 0 ) { Svcmd_ForceTeam_f(); return qtrue; } if (Q_stricmp (cmd, "game_memory") == 0) { Svcmd_GameMem_f(); return qtrue; } if (Q_stricmp (cmd, "addbot") == 0) { Svcmd_AddBot_f(); return qtrue; } if (Q_stricmp (cmd, "botlist") == 0) { Svcmd_BotList_f(); return qtrue; } /* if (Q_stricmp (cmd, "abort_podium") == 0) { Svcmd_AbortPodium_f(); return qtrue; } */ if (Q_stricmp (cmd, "addip") == 0) { Svcmd_AddIP_f(); return qtrue; } if (Q_stricmp (cmd, "removeip") == 0) { Svcmd_RemoveIP_f(); return qtrue; } if (Q_stricmp (cmd, "listip") == 0) { trap_SendConsoleCommand( EXEC_NOW, "g_banIPs\n" ); return qtrue; } if (g_dedicated.integer) { if (Q_stricmp (cmd, "say") == 0) { trap_SendServerCommand( -1, va("print \"server: %s\n\"", ConcatArgs(1) ) ); return qtrue; } if ( Q_stricmp (cmd, "timemappaths") == 0 ) { AIMod_TimeMapPaths(); return qtrue; } // everything else will also be printed as a say command //trap_SendServerCommand( -1, va("print \"server: %s\n\"", ConcatArgs(0) ) ); G_Printf("Unknown server command '%s'\n", cmd); return qtrue; } return qfalse; }
/* ================= ConsoleCommand ================= */ qboolean ConsoleCommand( void ) { //void char cmd[MAX_TOKEN_CHARS]; trap_Argv( 0, cmd, sizeof( cmd ) ); #ifdef G_LUA if(Q_stricmp(cmd, "lua_status") == 0) { G_LuaStatus(NULL); return qtrue; } if(Q_stricmp(cmd, "lua_restart") == 0) { Svcmd_LuaRestart_f(); return qtrue; } #endif if ( Q_stricmp (cmd, "entitylist") == 0 ) { Svcmd_EntityList_f(); return qtrue; } if ( Q_stricmp (cmd, "forceteam") == 0 ) { Svcmd_ForceTeam_f(); return qtrue; } if (Q_stricmp (cmd, "game_memory") == 0) { Svcmd_GameMem_f(); return qtrue; } if (Q_stricmp (cmd, "addbot") == 0) { Svcmd_AddBot_f(); return qtrue; } if (Q_stricmp (cmd, "botlist") == 0) { Svcmd_BotList_f(); return qtrue; } if (Q_stricmp (cmd, "abort_podium") == 0) { Svcmd_AbortPodium_f(); return qtrue; } if (Q_stricmp (cmd, "addip") == 0) { Svcmd_AddIP_f(); return qtrue; } if (Q_stricmp (cmd, "removeip") == 0) { Svcmd_RemoveIP_f(); return qtrue; } if (Q_stricmp (cmd, "listip") == 0) { trap_SendConsoleCommand( EXEC_INSERT, "g_banIPs\n" ); return qtrue; } if (Q_stricmp (cmd, "banUser") == 0) { Svcmd_BanUser_f(); return qtrue; } if ( Q_stricmp (cmd, "findID") == 0 ) { Svcmd_FindID_f(); return qtrue; } if ( Q_stricmp (cmd, "removeID") == 0 ) { Svcmd_RemoveID_f(); return qtrue; } return qfalse; }
//[/AdminSys] qboolean ConsoleCommand( void ) { char cmd[MAX_TOKEN_CHARS]; trap_Argv( 0, cmd, sizeof( cmd ) ); if (Q_stricmp (cmd, "game_memory") == 0) { Svcmd_GameMem_f(); return qtrue; } if (Q_stricmp (cmd, "addbot") == 0) { Svcmd_AddBot_f(); return qtrue; } if (Q_stricmp (cmd, "botlist") == 0) { Svcmd_BotList_f(); return qtrue; } /* if (Q_stricmp (cmd, "abort_podium") == 0) { Svcmd_AbortPodium_f(); return qtrue; } */ if (Q_stricmp (cmd, "addip") == 0) { Svcmd_AddIP_f(); return qtrue; } if (Q_stricmp (cmd, "removeip") == 0) { Svcmd_RemoveIP_f(); return qtrue; } if (Q_stricmp (cmd, "listip") == 0) { //[AdminCommands] Svcmd_ListIPs_f(); //trap_SendConsoleCommand( EXEC_NOW, "g_banIPs\n" ); //[/AdminCommands] return qtrue; } if (Q_stricmp (cmd, "giveadmin") == 0) { Cmd_SVGrantAdmin_F(); return qtrue; } if (Q_stricmp (cmd, "removeadmin") == 0) { Cmd_SVRemoveAdmin_F(); return qtrue; } //[AdminSys] //added bigsay command to be able to print things to the center of the screen as the server admin. if (Q_stricmp (cmd, "centersay") == 0) { if(OJP_AllPlayersHaveClientPlugin()) {//just fire off the text without editting it for line breaks. trap_SendServerCommand( -1, va("cp \"%s\n\"", ConcatArgs(1) ) ); } else {//since someone is running basejka, we need to add line breaks to make up for the //50 chars per line limit of basejka's cp code. char temp[1024]; //MAX_STRINGED_SV_STRING char output[1024]; //copy the print text. strcpy(temp, ConcatArgs(1)); TextWrapCenterPrint(temp, output); trap_SendServerCommand( -1, va("cp \"%s\n\"", output ) ); } //also duplicate the message in the chat buffer and in the game log. (so the admin can follow admin<->player //conversations trap_SendServerCommand( -1, va("print \"server: %s\n\"", ConcatArgs(1) ) ); G_LogPrintf( "server: %s\n", ConcatArgs(1) ); return qtrue; } //[/AdminSys] if (g_dedicated.integer) { if (Q_stricmp (cmd, "say") == 0) { trap_SendServerCommand( -1, va("print \"server: %s\n\"", ConcatArgs(1) ) ); return qtrue; } //[JAC Bugfix - Don't put unknown dedicated server console commands into chat!] // everything else will NOT also be printed as a say command //trap_SendServerCommand( -1, va("print \"server: %s\n\"", ConcatArgs(0) ) ); //return qtrue; //[/JAC Bugfix - Don't put unknown dedicated server console commands into chat!] //OPENRPTODO - Print that it's an unknown cmd } return qfalse; }
/* ================= ConsoleCommand ================= */ qboolean ConsoleCommand( void ) { char cmd[MAX_TOKEN_CHARS]; trap_Argv( 0, cmd, sizeof( cmd ) ); #ifdef SAVEGAME_SUPPORT if (Q_stricmp (cmd, "savegame") == 0) { if( g_gametype.integer != GT_SINGLE_PLAYER ) return qtrue; // don't allow a manual savegame command while we are waiting for the game to start/exit if (g_reloading.integer) return qtrue; if (saveGamePending) return qtrue; trap_Argv( 1, cmd, sizeof( cmd ) ); if (strlen(cmd) > 0) { // strip the extension if provided if (strrchr(cmd, '.')) { cmd[strrchr(cmd,'.')-cmd] = '\0'; } if ( !Q_stricmp( cmd, "current") ) { // beginning of map Com_Printf("sorry, '%s' is a reserved savegame name. please use another name.\n", cmd); return qtrue; } if (G_SaveGame( cmd )) trap_SendServerCommand(-1, "cp \"Game Saved\n\""); // deletedgame else G_Printf( "Unable to save game.\n" ); } else { // need a name G_Printf( "syntax: savegame <name>\n" ); } return qtrue; } #endif // SAVEGAME_SUPPORT if ( Q_stricmp (cmd, "entitylist") == 0 ) { Svcmd_EntityList_f(); return qtrue; } if ( Q_stricmp (cmd, "forceteam") == 0 ) { Svcmd_ForceTeam_f(); return qtrue; } if (Q_stricmp (cmd, "game_memory") == 0) { Svcmd_GameMem_f(); return qtrue; } /*if (Q_stricmp (cmd, "addbot") == 0) { Svcmd_AddBot_f(); return qtrue; } if (Q_stricmp (cmd, "removebot") == 0) { Svcmd_AddBot_f(); return qtrue; }*/ if (Q_stricmp (cmd, "addip") == 0) { Svcmd_AddIP_f(); return qtrue; } if (Q_stricmp (cmd, "removeip") == 0) { Svcmd_RemoveIP_f(); return qtrue; } if (Q_stricmp (cmd, "listip") == 0) { trap_SendConsoleCommand( EXEC_INSERT, "g_banIPs\n" ); return qtrue; } if (Q_stricmp (cmd, "listmaxlivesip") == 0) { PrintMaxLivesGUID(); return qtrue; } if (Q_stricmp (cmd, "reset_match") == 0) { Svcmd_ResetMatch_f(qtrue, qtrue); return qtrue; } if (Q_stricmp (cmd, "swap_teams") == 0) { Svcmd_SwapTeams_f(); return qtrue; } if (Q_stricmp (cmd, "shuffle_teams") == 0) { Svcmd_ShuffleTeams_f(); return qtrue; } // -NERVE - SMF if (Q_stricmp (cmd, "makeReferee") == 0) { G_MakeReferee(); return qtrue; } if (Q_stricmp (cmd, "removeReferee") == 0) { G_RemoveReferee(); return qtrue; } /*if (Q_stricmp (cmd, "mute") == 0) { G_MuteClient(); return qtrue; } if (Q_stricmp (cmd, "unmute") == 0) { G_UnMuteClient(); return qtrue; }*/ if (Q_stricmp (cmd, "ban") == 0) { G_PlayerBan(); return qtrue; } if( Q_stricmp( cmd, "campaign" ) == 0 ) { Svcmd_Campaign_f(); return qtrue; } if( Q_stricmp( cmd, "listcampaigns" ) == 0 ) { Svcmd_ListCampaigns_f(); return qtrue; } // fretn - moved from engine if (!Q_stricmp(cmd, "kick")) { Svcmd_Kick_f(); return qtrue; } if (!Q_stricmp(cmd, "clientkick")) { Svcmd_KickNum_f(); return qtrue; } if (!Q_stricmp(cmd, "noVoteLimit")) { Svcmd_noVoteLimit(); return qtrue; } if (!Q_stricmp(cmd, "cp")) { AP(va("cp \"%s\n\"", ConcatArgs(1))); return qtrue; } if (!Q_stricmp(cmd, "qsay")) { AP(va("chat \"%s\"", ConcatArgs(1))); G_LogPrintf("qsay: \"%s\n\"", ConcatArgs(1)); return qtrue; } if (!Q_stricmp(cmd, "bp")) { AP(va("bp \"%s\"", ConcatArgs(1))); G_LogPrintf("banner: \"%s\n\"", ConcatArgs(1)); return qtrue; } if (!Q_stricmp(cmd, "cpm")) { AP(va("cpm \"%s\n\"", ConcatArgs(1))); return qtrue; } if (!Q_stricmp(cmd, "freespec")) { gclient_t *cl; char num[MAX_TOKEN_CHARS]; int clientnum; trap_Argv(1, num, sizeof(num)); clientnum = atoi(num); cl = G_GetPlayerByNum( clientnum ); if ( !cl ) { return; } cl->sess.freeSpec = qtrue; return qtrue; } if (!Q_stricmp(cmd, "pcmd")) { gclient_t *cl; char name[MAX_TOKEN_CHARS]; int clientNum; trap_Argv(1, name, sizeof(name)); clientNum = atoi(name); cl = G_GetPlayerByNum( clientNum ); if ( !cl ) { return; } trap_SendServerCommand(cl - level.clients, va("pcmd %s", ConcatArgs(2))); return qtrue; } if (!Q_stricmp(cmd, "blockmap")) { char map[MAX_STRING_TOKENS]; char blocklist[MAX_CVAR_VALUE_STRING]; trap_Argv(1, map, sizeof(map)); if (strlen(tjg_blockedMaps.string) + strlen(map) > sizeof(tjg_blockedMaps.string)) { AP("print \"tjg_blockedMaps is full.\n\""); } else { Com_sprintf(blocklist, sizeof(blocklist), "%s %s", tjg_blockedMaps.string, map); trap_Cvar_Set("tjg_blockedMaps", va("%s", blocklist)); } return qtrue; } if (!tjg_recordMode.integer) { if (!Q_stricmp(cmd, "forcecvar")) { char cvar_name[MAX_TOKEN_CHARS]; char cvar_val[MAX_TOKEN_CHARS]; trap_Argv(1, cvar_name, sizeof(cvar_name)); trap_Argv(2, cvar_val, sizeof(cvar_val)); trap_Cvar_Set(cvar_name, va("%d", atoi(cvar_val))); AP(va("print \"Forced %s to %s.\n\"", cvar_name, va("%d", atoi(cvar_val)) ) ); return qtrue; } } if( g_dedicated.integer ) { if( !Q_stricmp (cmd, "say")) { trap_SendServerCommand( -1, va("cpm \"server: %s\n\"", ConcatArgs(1) ) ); return qtrue; } // OSP - console also gets ref commands if(!level.fLocalHost && Q_stricmp(cmd, "ref") == 0) { // CHRUKER: b005 - G_refCommandCheck expects the next argument (warn, pause, lock etc). trap_Argv(1, cmd, sizeof(cmd)); if(!G_refCommandCheck(NULL, cmd)) { G_refHelp_cmd(NULL); } return(qtrue); } // everything else will also be printed as a say command // trap_SendServerCommand( -1, va("cpm \"server: %s\n\"", ConcatArgs(0) ) ); // prints to the console instead now return qfalse; } return qfalse; }