Exemplo n.º 1
0
// Parses for a referee command.
//	--> ref arg allows for the server console to utilize all referee commands (ent == NULL)
//
qboolean G_refCommandCheck(gentity_t *ent, char *cmd)
{
		 if(!Q_stricmp(cmd, "allready"))	G_refAllReady_cmd(ent);
	else if(!Q_stricmp(cmd, "lock"))		G_refLockTeams_cmd(ent, qtrue);
	else if(!Q_stricmp(cmd, "help"))		G_refHelp_cmd(ent);
	else if(!Q_stricmp(cmd, "pause"))		G_refPause_cmd(ent, qtrue);
	else if(!Q_stricmp(cmd, "putallies"))	G_refPlayerPut_cmd(ent, TEAM_ALLIES);
	else if(!Q_stricmp(cmd, "putaxis"))		G_refPlayerPut_cmd(ent, TEAM_AXIS);
	else if(!Q_stricmp(cmd, "remove"))		G_refRemove_cmd(ent);
	else if(!Q_stricmp(cmd, "speclock"))	G_refSpeclockTeams_cmd(ent, qtrue);
	else if(!Q_stricmp(cmd, "specunlock"))	G_refSpeclockTeams_cmd(ent, qfalse);
	else if(!Q_stricmp(cmd, "unlock"))		G_refLockTeams_cmd(ent, qfalse);
	else if(!Q_stricmp(cmd, "unpause"))		G_refPause_cmd(ent, qfalse);
	else if(!Q_stricmp(cmd, "warmup"))		G_refWarmup_cmd(ent);
	else if(!Q_stricmp(cmd, "warn"))		G_refWarning_cmd(ent);
	// yada - handled by the vote functions now
	//else if(!Q_stricmp(cmd, "mute"))		G_refMute_cmd(ent, qtrue); 
	//else if(!Q_stricmp(cmd, "unmute"))		G_refMute_cmd(ent, qfalse);

	// pheno
	else if( !Q_stricmp( cmd, "makeshoutcaster" ) )
		G_refMakeShoutcaster_cmd( ent );
	else if( !Q_stricmp( cmd, "removeshoutcaster" ) )
		G_refRemoveShoutcaster_cmd( ent );
	else if( !Q_stricmp( cmd, "logout" ) )
		G_refLogout_cmd( ent );

	else return(qfalse);

	return(qtrue);
}
Exemplo n.º 2
0
// Request for ref status or lists ref commands.
void G_ref_cmd(gentity_t *ent, unsigned int dwCommand, qboolean fValue)
{
	char arg[MAX_TOKEN_CHARS];

	
	// Roll through ref commands if already a ref
	if(ent == NULL || ent->client->sess.referee) {
		voteInfo_t votedata;

		trap_Argv(1, arg, sizeof(arg));

		memcpy( &votedata, &level.voteInfo, sizeof( voteInfo_t ) );

		if( Cmd_CallVote_f(ent, 0, qtrue) ) {
			memcpy( &level.voteInfo, &votedata, sizeof( voteInfo_t ) );
			return;
		} else {
			memcpy( &level.voteInfo, &votedata, sizeof( voteInfo_t ) );

			if(G_refCommandCheck(ent, arg)) {
				return;
			} else {
				G_refHelp_cmd(ent);
			}
		}
		return;
	}

	if(ent) {
		if(!Q_stricmp(refereePassword.string, "none") || !refereePassword.string[0]) {
			CP("cpm \"Sorry, referee status disabled on this server.\n\"");
			return;
		}

		if(trap_Argc() < 2) {
			CP("cpm \"Usage: ref [password]\n\"");
			return;
		}

		trap_Argv(1, arg, sizeof(arg));

		if(Q_stricmp(arg, refereePassword.string)) {
			CP("cpm \"Invalid referee password!\n\"");
			return;
		}

		ent->client->sess.referee = 1;
		ent->client->sess.spec_invite = TEAM_AXIS | TEAM_ALLIES;
		AP(va("cp \"%s\n^3has become a referee\n\"", ent->client->pers.netname));
		ClientUserinfoChanged( ent-g_entities );
	}
}
Exemplo n.º 3
0
// Parses for a referee command.
//	--> ref arg allows for the server console to utilize all referee commands (ent == NULL)
//
qboolean G_refCommandCheck(gentity_t *ent, char *cmd)
{
		 if(!Q_stricmp(cmd, "allready"))	G_refAllReady_cmd(ent);
	else if(!Q_stricmp(cmd, "lock"))		G_refLockTeams_cmd(ent, qtrue);
	else if(!Q_stricmp(cmd, "help"))		G_refHelp_cmd(ent);
	else if(!Q_stricmp(cmd, "pause"))		G_refPause_cmd(ent, qtrue);
	else if(!Q_stricmp(cmd, "putallies"))	G_refPlayerPut_cmd(ent, TEAM_ALLIES);
	else if(!Q_stricmp(cmd, "putaxis"))		G_refPlayerPut_cmd(ent, TEAM_AXIS);
	else if(!Q_stricmp(cmd, "remove"))		G_refRemove_cmd(ent);
	else if(!Q_stricmp(cmd, "speclock"))	G_refSpeclockTeams_cmd(ent, qtrue);
	else if(!Q_stricmp(cmd, "specunlock"))	G_refSpeclockTeams_cmd(ent, qfalse);
	else if(!Q_stricmp(cmd, "unlock"))		G_refLockTeams_cmd(ent, qfalse);
	else if(!Q_stricmp(cmd, "unpause"))		G_refPause_cmd(ent, qfalse);
	else if(!Q_stricmp(cmd, "warmup"))		G_refWarmup_cmd(ent);
	else if(!Q_stricmp(cmd, "warn"))		G_refWarning_cmd(ent);
	else if(!Q_stricmp(cmd, "mute"))		G_refMute_cmd(ent, qtrue);
	else if(!Q_stricmp(cmd, "unmute"))		G_refMute_cmd(ent, qfalse);
	else return(qfalse);

	return(qtrue);
}
Exemplo n.º 4
0
/*
=================
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;
}
Exemplo n.º 5
0
/*
=================
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;
}
Exemplo n.º 6
0
// Request for ref status or lists ref commands.
void G_ref_cmd(gentity_t *ent, unsigned int dwCommand, qboolean fValue)
{
	char arg[MAX_TOKEN_CHARS];

	// forty - in mod flood protection
	// yada - dont check this on console
	if(	ent && ClientIsFlooding(ent, qfalse) ){
		CP("print \"^1Spam Protection: ^7dropping ref\n\"");
		return;
	}
	
	// Roll through ref commands if already a ref
	if(ent == NULL || ent->client->sess.referee) {
		voteInfo_t votedata;

		trap_Argv(1, arg, sizeof(arg));

		memcpy( &votedata, &level.voteInfo, sizeof( voteInfo_t ) );

		if( Cmd_CallVote_f(ent, 0, qtrue) ) {
			memcpy( &level.voteInfo, &votedata, sizeof( voteInfo_t ) );
			return;
		} else {
			memcpy( &level.voteInfo, &votedata, sizeof( voteInfo_t ) );

			if(G_refCommandCheck(ent, arg)) {
				return;
			} else {
				G_refHelp_cmd(ent);
			}
		}
		return;
	}

	if(ent) {
		if(!Q_stricmp(refereePassword.string, "none") || !refereePassword.string[0]) {
			// CHRUKER: b046 - Was using the cpm command, but this is really just for the console.
			CP("print \"Sorry, referee status disabled on this server.\n\"");
			return;
		}

		if(trap_Argc() < 2) {
			// CHRUKER: b046 - Was using the cpm command, but this is really just for the console.
			CP("print \"Usage: ref [password]\n\"");
			return;
		}

		trap_Argv(1, arg, sizeof(arg));

		if(Q_stricmp(arg, refereePassword.string)) {
			// CHRUKER: b046 - Was using the cpm command, but this is really just for the console.
			CP("print \"Invalid referee password!\n\"");
			return;
		}

		ent->client->sess.referee = 1;
		ent->client->sess.spec_invite = TEAM_AXIS | TEAM_ALLIES;
		AP(va("cp \"%s\n^3has become a referee\n\"", ent->client->pers.netname));
		ClientUserinfoChanged( ent-g_entities );
	}
}
Exemplo n.º 7
0
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;
}
Exemplo n.º 8
0
/*
=================
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;
}