Exemple #1
0
static void M_Custom_Init( void )
{
	menucommon_t *menuitem = NULL;
	int yoffset = 40;
	int i, count;

	s_custom_menu.nitems = 0;

	// parse the command line to create the buttons

	if( trap_Cmd_Argc() < 1 )
		return;

	// first one is always the tittle

	menuitem = UI_InitMenuItem( "m_custom_title1", trap_Cmd_Argv( 1 ), 0, yoffset, MTYPE_SEPARATOR, ALIGN_CENTER_TOP, uis.fontSystemBig, NULL );
	Menu_AddItem( &s_custom_menu, menuitem );
	yoffset += trap_SCR_strHeight( menuitem->font );

	yoffset += trap_SCR_strHeight( menuitem->font );

	// from now on each 2 new arguments define a new button
	for( i = 2, count = 0; i < trap_Cmd_Argc(); i += 2, count++ )
	{
		menuitem = UI_InitMenuItem( va( "m_custom_button%i", count ), trap_Cmd_Argv( i ), 0, yoffset, MTYPE_ACTION, ALIGN_CENTER_TOP, uis.fontSystemBig, M_Custom_ExecuteButton );
		menuitem->itemlocal = UI_CopyString( trap_Cmd_Argv( i + 1 ) );
		Menu_AddItem( &s_custom_menu, menuitem );
		yoffset += UI_SetupButton( menuitem, qtrue ) + UI_BUTTONBOX_VERTICAL_SPACE;
	}

	Menu_Center( &s_custom_menu );
	Menu_Init( &s_custom_menu, qtrue );
	Menu_SetStatusBar( &s_custom_menu, NULL );
}
Exemple #2
0
/*
* CG_AddCam_Sub_f
*/
static void CG_AddSub_Cmd_f( void )
{
	cg_subtitle_t *sub;

	sub = CG_Democam_RegisterSubtitle();
	if( !sub )
	{
		CG_Printf( "DemoCam Error: Failed to allocate the subtitle\n" );
		return;
	}

	if( trap_Cmd_Argc() > 1 )
	{
		char str[MAX_STRING_CHARS]; // one line of the console can't handle more than this
		int i;

		str[0] = 0;
		for( i = 1; i < trap_Cmd_Argc(); i++ )
		{
			Q_strncatz( str, trap_Cmd_Argv( i ), sizeof( str ) );
			if( i < trap_Cmd_Argc() - 1 )
				Q_strncatz( str, " ", sizeof( str ) );
		}

		sub->text = CG_CopyString( str );
	}
	else
		sub->text = CG_CopyString( "" );
}
Exemple #3
0
/*
* Cmd_ShowStats_f
*/
static void Cmd_ShowStats_f( edict_t *ent )
{
	edict_t *target;

	if( trap_Cmd_Argc() > 2 )
	{
		G_PrintMsg( ent, "Usage: stats [player]\n" );
		return;
	}

	if( trap_Cmd_Argc() == 2 )
	{
		target = G_PlayerForText( trap_Cmd_Argv( 1 ) );
		if( target == NULL )
		{
			G_PrintMsg( ent, "No such player\n" );
			return;
		}
	}
	else
	{
		if( ent->r.client->resp.chase.active && game.edicts[ent->r.client->resp.chase.target].r.client )
			target = &game.edicts[ent->r.client->resp.chase.target];
		else
			target = ent;
	}

	if( target->s.team == TEAM_SPECTATOR )
	{
		G_PrintMsg( ent, "No stats for spectators\n" );
		return;
	}

	trap_GameCmd( ent, va( "plstats 1 \"%s\"", G_StatsMessage( target ) ) );
}
Exemple #4
0
/*
* Cmd_AddIP_f
*/
static void Cmd_AddIP_f( void )
{
	int i;

	if( trap_Cmd_Argc() < 2 )
	{
		G_Printf( "Usage: addip <ip-mask> [time-mins]\n" );
		return;
	}

	for( i = 0; i < numipfilters; i++ )
		if( ipfilters[i].compare == 0xffffffff || (ipfilters[i].timeout && ipfilters[i].timeout <= game.serverTime) )
			break; // free spot
	if( i == numipfilters )
	{
		if( numipfilters == MAX_IPFILTERS )
		{
			G_Printf( "IP filter list is full\n" );
			return;
		}
		numipfilters++;
	}

	ipfilters[i].timeout = 0;
	if( !StringToFilter( trap_Cmd_Argv( 1 ), &ipfilters[i] ) )
		ipfilters[i].compare = 0xffffffff;
	else if( trap_Cmd_Argc() == 3 )
		ipfilters[i].timeout = game.serverTime + atof( trap_Cmd_Argv(2) )*60*1000;
}
Exemple #5
0
/*
* Cmd_CvarInfo_f - Contains a cvar name and string provided by the client
*/
static void Cmd_CvarInfo_f( edict_t *ent )
{
	if( trap_Cmd_Argc() < 2 )
	{
		G_PrintMsg( ent, "Cmd_CvarInfo_f: invalid argument count\n" );
		return;
	}

	// see if the gametype script is requesting this info
	if( !GT_asCallGameCommand( ent->r.client, "cvarinfo", trap_Cmd_Args(), trap_Cmd_Argc() - 1 ) )
	{
		// if the gametype script wasn't interested in this command, print the output to console
		G_Printf( "%s%s's cvar '%s' is '%s%s'\n", ent->r.client->netname, S_COLOR_WHITE, trap_Cmd_Argv( 1 ), trap_Cmd_Argv( 2 ), S_COLOR_WHITE );
	}
}
Exemple #6
0
/*
* Cmd_RemoveIP_f
*/
static void Cmd_RemoveIP_f( void )
{
	ipfilter_t f;
	int i, j;

	if( trap_Cmd_Argc() < 2 )
	{
		G_Printf( "Usage: removeip <ip-mask>\n" );
		return;
	}

	if( !StringToFilter( trap_Cmd_Argv( 1 ), &f ) )
		return;

	for( i = 0; i < numipfilters; i++ )
		if( ipfilters[i].mask == f.mask
			&& ipfilters[i].compare == f.compare )
		{
			for( j = i+1; j < numipfilters; j++ )
				ipfilters[j-1] = ipfilters[j];
			numipfilters--;
			G_Printf( "Removed.\n" );
			return;
		}
		G_Printf( "Didn't find %s.\n", trap_Cmd_Argv( 1 ) );
}
Exemple #7
0
/*
* Cmd_ChaseCam_f
*/
void Cmd_ChaseCam_f( edict_t *ent ) {
	bool team_only;
	const char *arg1;

	if( ent->s.team != TEAM_SPECTATOR && !ent->r.client->teamstate.is_coach ) {
		G_Teams_JoinTeam( ent, TEAM_SPECTATOR );
		if( !CheckFlood( ent, false ) ) { // prevent 'joined spectators' spam
			G_PrintMsg( NULL, "%s%s joined the %s%s team.\n", ent->r.client->netname,
						S_COLOR_WHITE, GS_TeamName( ent->s.team ), S_COLOR_WHITE );
		}
	}

	// & 1 = scorelead
	// & 2 = powerups
	// & 4 = objectives
	// & 8 = fragger

	if( ent->r.client->teamstate.is_coach && GS_TeamBasedGametype() ) {
		team_only = true;
	} else {
		team_only = false;
	}

	arg1 = trap_Cmd_Argv( 1 );

	if( trap_Cmd_Argc() < 2 ) {
		G_ChasePlayer( ent, NULL, team_only, 0 );
	} else if( !Q_stricmp( arg1, "auto" ) ) {
		G_PrintMsg( ent, "Chasecam mode is 'auto'. It will follow the score leader when no powerup nor flag is carried.\n" );
		G_ChasePlayer( ent, NULL, team_only, 7 );
	} else if( !Q_stricmp( arg1, "carriers" ) ) {
		G_PrintMsg( ent, "Chasecam mode is 'carriers'. It will switch to flag or powerup carriers when any of these items is picked up.\n" );
		G_ChasePlayer( ent, NULL, team_only, 6 );
	} else if( !Q_stricmp( arg1, "powerups" ) ) {
		G_PrintMsg( ent, "Chasecam mode is 'powerups'. It will switch to powerup carriers when any of these items is picked up.\n" );
		G_ChasePlayer( ent, NULL, team_only, 2 );
	} else if( !Q_stricmp( arg1, "objectives" ) ) {
		G_PrintMsg( ent, "Chasecam mode is 'objectives'. It will switch to objectives carriers when any of these items is picked up.\n" );
		G_ChasePlayer( ent, NULL, team_only, 4 );
	} else if( !Q_stricmp( arg1, "score" ) ) {
		G_PrintMsg( ent, "Chasecam mode is 'score'. It will always follow the player with the best score.\n" );
		G_ChasePlayer( ent, NULL, team_only, 1 );
	} else if( !Q_stricmp( arg1, "fragger" ) ) {
		G_PrintMsg( ent, "Chasecam mode is 'fragger'. The last fragging player will be followed.\n" );
		G_ChasePlayer( ent, NULL, team_only, 8 );
	} else if( !Q_stricmp( arg1, "help" ) ) {
		G_PrintMsg( ent, "Chasecam modes:\n" );
		G_PrintMsg( ent, "- 'auto': Chase the score leader unless there's an objective carrier or a powerup carrier.\n" );
		G_PrintMsg( ent, "- 'carriers': User has pov control unless there's an objective carrier or a powerup carrier.\n" );
		G_PrintMsg( ent, "- 'objectives': User has pov control unless there's an objective carrier.\n" );
		G_PrintMsg( ent, "- 'powerups': User has pov control unless there's a flag carrier.\n" );
		G_PrintMsg( ent, "- 'score': Always follow the score leader. User has no pov control.\n" );
		G_PrintMsg( ent, "- 'none': Disable chasecam.\n" );
		return;
	} else {
		G_ChasePlayer( ent, arg1, team_only, 0 );
	}

	G_Teams_LeaveChallengersQueue( ent );
}
Exemple #8
0
/*
* Cmd_Match_f
*/
static void Cmd_Match_f( void )
{
	const char *cmd;

	if( trap_Cmd_Argc() != 2 )
	{
		Com_Printf( "Usage: match <option: restart|advance|status>\n" );
		return;
	}

	cmd = trap_Cmd_Argv( 1 );
	if( !Q_stricmp( cmd, "restart" ) )
	{
		level.exitNow = false;
		level.hardReset = false;
		Q_strncpyz( level.forcemap, level.mapname, sizeof( level.mapname ) );
		G_EndMatch();
	}
	else if( !Q_stricmp( cmd, "advance" ) )
	{
		level.exitNow = false;
		level.hardReset = true;
		//		level.forcemap[0] = 0;
		G_EndMatch();
	}
	else if( !Q_stricmp( cmd, "status" ) )
	{
		trap_Cmd_ExecuteText( EXEC_APPEND, "status" );
	}
}
Exemple #9
0
/*
* ClientCommand
*/
void ClientCommand( edict_t *ent )
{
	char *cmd;
	int i;

	if( !ent->r.client || trap_GetClientState( PLAYERNUM( ent ) ) < CS_SPAWNED )
		return; // not fully in game yet

	cmd = trap_Cmd_Argv( 0 );

	if( Q_stricmp( cmd, "cvarinfo" ) ) // skip cvarinfo cmds because they are automatic responses
		G_Client_UpdateActivity( ent->r.client ); // activity detected

	for( i = 0; i < MAX_GAMECOMMANDS; i++ )
	{
		if( !g_Commands[i].name[0] )
			break;

		if( !Q_stricmp( g_Commands[i].name, cmd ) )
		{
			if( g_Commands[i].func )
				g_Commands[i].func( ent );
			else
				GT_asCallGameCommand( ent->r.client, cmd, trap_Cmd_Args(), trap_Cmd_Argc() - 1 );
			return;
		}
	}

	G_PrintMsg( ent, "Bad user command: %s\n", cmd );
}
Exemple #10
0
/*
* Cmd_Say_f
*/
void Cmd_Say_f( edict_t *ent, bool arg0, bool checkflood )
{
	char *p;
	char text[2048];
	size_t arg0len = 0;

#ifdef AUTHED_SAY
	if( sv_mm_enable->integer && ent->r.client && ent->r.client->mm_session <= 0 )
	{
		// unauthed players are only allowed to chat to public at non play-time
		if( GS_MatchState() == MATCH_STATE_PLAYTIME )
		{
			G_PrintMsg( ent, "%s", S_COLOR_YELLOW "You must authenticate to be able to communicate to other players during the match.\n");
			return;
		}
	}
#endif

	if( checkflood )
	{
		if( CheckFlood( ent, false ) )
			return;
	}

	if( ent->r.client && ( ent->r.client->muted & 1 ) )
		return;

	if( trap_Cmd_Argc() < 2 && !arg0 )
		return;

	text[0] = 0;

	if( arg0 )
	{
		Q_strncatz( text, trap_Cmd_Argv( 0 ), sizeof( text ) );
		Q_strncatz( text, " ", sizeof( text ) );
		arg0len = strlen( text );
		Q_strncatz( text, trap_Cmd_Args(), sizeof( text ) );
	}
	else
	{
		p = trap_Cmd_Args();

		if( *p == '"' )
		{
			if( p[strlen( p )-1] == '"' )
				p[strlen( p )-1] = 0;
			p++;
		}
		Q_strncatz( text, p, sizeof( text ) );
	}

	// don't let text be too long for malicious reasons
	text[arg0len + (MAX_CHAT_BYTES - 1)] = 0;

	if( !Q_stricmp( text, "gg" ) || !Q_stricmp( text, "good game" ) )
		G_AwardFairPlay( ent );

	G_ChatMsg( NULL, ent, false, "%s", text );
}
Exemple #11
0
/*
* SF_Music
*/
static void SF_Music_f( void )
{
	if( trap_Cmd_Argc() == 2 )
	{
		SF_StartBackgroundTrack( trap_Cmd_Argv( 1 ), trap_Cmd_Argv( 1 ), 0 );
	}
	else if( trap_Cmd_Argc() == 3 )
	{
		SF_StartBackgroundTrack( trap_Cmd_Argv( 1 ), trap_Cmd_Argv( 2 ), 0 );
	}
	else
	{
		Com_Printf( "music <intro|playlist> [loop|shuffle]\n" );
		return;
	}
}
Exemple #12
0
/*
* CG_DemoEditMode_Cmd_f
*/
static void CG_DemoEditMode_Cmd_f( void ) {
	if( !cgs.demoPlaying ) {
		return;
	}

	if( trap_Cmd_Argc() > 1 ) {
		if( !Q_stricmp( trap_Cmd_Argv( 1 ), "on" ) ) {
			democam_editing_mode = true;
		} else if( !Q_stricmp( trap_Cmd_Argv( 1 ), "off" ) ) {
			democam_editing_mode = false;
		}
	} else {
		democam_editing_mode = !democam_editing_mode;
	}

	CG_Printf( "demo cam editing mode %s\n", democam_editing_mode ? "on" : "off" );
	if( democam_editing_mode ) {
		trap_Cmd_AddCommand( "addcam", CG_AddCam_Cmd_f );
		trap_Cmd_AddCommand( "deletecam", CG_DeleteCam_Cmd_f );
		trap_Cmd_AddCommand( "editcam", CG_EditCam_Cmd_f );
		trap_Cmd_AddCommand( "saverecam", CG_SaveCam_Cmd_f );
		trap_Cmd_AddCommand( "clearcams", CG_Democam_FreeCams );
		trap_Cmd_AddCommand( "importcams", CG_Democam_ImportCams_f );
		trap_Cmd_AddCommand( "subtitle", CG_AddSub_Cmd_f );
		trap_Cmd_AddCommand( "addprint", CG_AddPrint_Cmd_f );
	} else {
		CG_DemoEditMode_RemoveCmds();
	}
}
Exemple #13
0
/*
* UI_Force_f
*/
void UI_Force_f( void )
{
	if( trap_Cmd_Argc() != 2 )
		return;

	uis.forceUI = (qboolean)( atoi( trap_Cmd_Argv( 1 ) ) != 0 );
}
Exemple #14
0
/*
* CG_AddCam_Cmd_f
*/
static void CG_AddCam_Cmd_f( void ) {
	int type, i;

	CG_DemoCam_UpdateDemoTime();

	if( trap_Cmd_Argc() == 2 ) {
		// type
		type = -1;
		for( i = 0; cam_TypeNames[i] != NULL; i++ ) {
			if( !Q_stricmp( cam_TypeNames[i], trap_Cmd_Argv( 1 ) ) ) {
				type = i;
				break;
			}
		}

		if( type != -1 ) {
			// valid. Register and return
			if( CG_Democam_RegisterCam( type ) != NULL ) {
				CG_Printf( "cam added\n" );

				// update current cam
				CG_Democam_ExecutePathAnalysis();
				currentcam = CG_Democam_FindCurrent( demo_time );
				nextcam = CG_Democam_FindNext( demo_time );
				return;
			}
		}
	}

	// print help
	CG_Printf( " : Usage: AddCam <type>\n" );
	CG_Printf( " : Available types:\n" );
	for( i = 0; cam_TypeNames[i] != NULL; i++ )
		CG_Printf( " : %s\n", cam_TypeNames[i] );
}
Exemple #15
0
/*
* CG_SC_DemoGet
*/
static void CG_SC_DemoGet( void )
{
	if( cgs.demoPlaying )
	{
		// ignore download commands coming from demo files
		return;
	}

	if( !demo_requested )
	{
		CG_Printf( "Warning: demoget when not requested, ignored\n" );
		return;
	}

	demo_requested = qfalse;

	if( trap_Cmd_Argc() < 2 )
	{
		CG_Printf( "No such demo found\n" );
		return;
	}

	if( !COM_ValidateRelativeFilename( trap_Cmd_Argv( 1 ) ) )
	{
		CG_Printf( "Warning: demoget: Invalid filename, ignored\n" );
		return;
	}

	trap_DownloadRequest( trap_Cmd_Argv( 1 ), qfalse );
}
Exemple #16
0
/*
* CG_Democam_ImportCams_f
*/
void CG_Democam_ImportCams_f( void )
{
	int name_size;
	char *customName;

	if( trap_Cmd_Argc() < 2 )
	{
		CG_Printf( "Usage: importcams <filename> (relative to demos directory)\n" );
		return;
	}

	// see if there is any script for this demo, and load it
	name_size = sizeof( char ) * ( strlen( "demos/" ) + strlen( trap_Cmd_Argv( 1 ) ) + strlen( ".cam" ) + 1 );
	customName = ( char * )CG_Malloc( name_size );
	Q_snprintfz( customName, name_size, "demos/%s", trap_Cmd_Argv( 1 ) );
	COM_ReplaceExtension( customName, ".cam", name_size );
	if( CG_LoadRecamScriptFile( customName ) )
	{
		CG_Printf( "cam script imported\n" );
	}
	else
	{
		CG_Printf( "CG_Democam_ImportCams_f: no valid file found\n" );
	}
}
Exemple #17
0
/*
* Cmd_GameOperator_f
*/
static void Cmd_GameOperator_f( edict_t *ent )
{
	if( !g_operator_password->string[0] )
	{
		G_PrintMsg( ent, "Operator is disabled in this server\n" );
		return;
	}

	if( trap_Cmd_Argc() < 2 )
	{
		G_PrintMsg( ent, "Usage: 'operator <password>' or 'op <password>'\n" );
		return;
	}

	if( !Q_stricmp( trap_Cmd_Argv( 1 ), g_operator_password->string ) )
	{
		if( !ent->r.client->isoperator )
			G_PrintMsg( NULL, "%s"S_COLOR_WHITE" is now a game operator\n", ent->r.client->netname );

		ent->r.client->isoperator = true;
		return;
	}

	G_PrintMsg( ent, "Incorrect operator password.\n" );
}
Exemple #18
0
/*
* S_Music
*/
static void SF_Music_f( void )
{
	if( trap_Cmd_Argc() < 2 )
	{
		Com_Printf( "music: <introfile|playlist> [loopfile|shuffle]\n" );
		return;
	}

	SF_StartBackgroundTrack( trap_Cmd_Argv( 1 ), trap_Cmd_Argv( 2 ), 0 );
}
Exemple #19
0
/*
* CG_Cmd_UseItem_f
*/
static void CG_Cmd_UseItem_f( void )
{
	if( !trap_Cmd_Argc() )
	{
		CG_Printf( "Usage: 'use <item name>' or 'use <item index>'\n" );
		return;
	}

	CG_UseItem( trap_Cmd_Args() );
}
Exemple #20
0
/*
* Cmd_Score_f
*/
static void Cmd_Score_f( edict_t *ent )
{
	qboolean newvalue;

	if( trap_Cmd_Argc() == 2 )
		newvalue = ( atoi( trap_Cmd_Argv( 1 ) ) != 0 );
	else
		newvalue = !ent->r.client->level.showscores;

	ent->r.client->level.showscores = newvalue;
}
Exemple #21
0
/*
* Cmd_Score_f
*/
static void Cmd_Score_f( edict_t *ent )
{
	bool newvalue;

	if( trap_Cmd_Argc() == 2 )
		newvalue = ( atoi( trap_Cmd_Argv( 1 ) ) != 0 ) ? true : false;
	else
		newvalue = !ent->r.client->level.showscores ? true : false;

	ent->r.client->level.showscores = newvalue;
}
Exemple #22
0
/*
* Cmd_Whois_f
*/
static void Cmd_Whois_f( edict_t *ent )
{
	edict_t *target;
	gclient_t *cl;
	const char *login;

	if( trap_Cmd_Argc() > 2 )
	{
		G_PrintMsg( ent, "Usage: whois [player]\n" );
		return;
	}

	if( trap_Cmd_Argc() == 2 )
	{
		target = G_PlayerForText( trap_Cmd_Argv( 1 ) );
		if( target == NULL )
		{
			G_PrintMsg( ent, "No such player\n" );
			return;
		}
	}
	else
	{
		if( ent->r.client->resp.chase.active && game.edicts[ent->r.client->resp.chase.target].r.client )
			target = &game.edicts[ent->r.client->resp.chase.target];
		else
			target = ent;
	}

	cl = target->r.client;

	if( cl->mm_session <= 0 )
	{
		G_PrintMsg( ent, "Unregistered player\n" );
		return;
	}

	login = Info_ValueForKey( cl->userinfo, "cl_mm_login" );

	G_PrintMsg( ent, "%s%s is %s\n", cl->netname, S_COLOR_WHITE, login );
}
Exemple #23
0
/*
* CG_SC_MenuCustom
*/
static void CG_SC_MenuCustom( void )
{
	char request[MAX_STRING_CHARS];
	int i, c;

	if( cgs.demoPlaying || cgs.tv )
		return;

	if( trap_Cmd_Argc() < 2 )
		return;

	Q_strncpyz( request, va( "menu_open custom title \"%s\" ", trap_Cmd_Argv( 1 ) ), sizeof( request ) );
	
	for( i = 2, c = 1; i < trap_Cmd_Argc() - 1; i += 2, c++ )
	{
		Q_strncatz( request, va( "btn%i \"%s\" ", c, trap_Cmd_Argv( i ) ), sizeof( request ) );
		Q_strncatz( request, va( "cmd%i \"%s\" ", c, trap_Cmd_Argv( i + 1 ) ), sizeof( request ) );
	}

	trap_Cmd_ExecuteText( EXEC_APPEND, va( "%s\n", request ) );
}
Exemple #24
0
/*
* CG_SC_ChannelRemove
*/
static void CG_SC_ChannelRemove( void )
{
	int i, id;

	for( i = 1; i < trap_Cmd_Argc(); i++ )
	{
		id = atoi( trap_Cmd_Argv( i ) );
		if( id <= 0 )
			continue;
		trap_Cmd_ExecuteText( EXEC_NOW, va( "menu_tvchannel_remove %i\n", id ) );
	}
}
Exemple #25
0
/*
* TVM_Cmd_PlayersExt_f
*/
static void TVM_Cmd_PlayersExt_f( edict_t *ent, bool onlyspecs ) {
	int i;
	int count = 0;
	int start = 0;
	char line[64];
	char msg[1024];
	edict_t *e;
	tvm_relay_t *relay = ent->relay;

	if( trap_Cmd_Argc() > 1 ) {
		start = atoi( trap_Cmd_Argv( 1 ) );
	}
	clamp( start, 0, relay->maxclients - 1 );

	// print information
	msg[0] = 0;

	for( i = start + 1; PLAYERNUM( ( relay->edicts + i ) ) < relay->maxclients; i++ ) {
		e = relay->edicts + i;
		if( e->r.inuse && !e->local && e->r.client ) {
			char *userinfo;

			userinfo = relay->configStrings[CS_PLAYERINFOS + PLAYERNUM( e )];
			Q_snprintfz( line, sizeof( line ), "%3i %s\n", i, Info_ValueForKey( userinfo, "name" ) );

			if( strlen( line ) + strlen( msg ) > sizeof( msg ) - 100 ) {
				// can't print all of them in one packet
				Q_strncatz( msg, "...\n", sizeof( msg ) );
				break;
			}

			if( count == 0 ) {
				Q_strncatz( msg, "num name\n", sizeof( msg ) );
				Q_strncatz( msg, "--- ---------------\n", sizeof( msg ) );
			}

			Q_strncatz( msg, line, sizeof( msg ) );
			count++;
		}
	}

	if( count ) {
		Q_strncatz( msg, "--- ---------------\n", sizeof( msg ) );
	}
	Q_strncatz( msg, va( "%3i %s\n", count, trap_Cmd_Argv( 0 ) ), sizeof( msg ) );
	TVM_PrintMsg( relay, ent, "%s", msg );

	if( i < relay->maxclients ) {
		TVM_PrintMsg( relay, ent, "Type '%s %i' for more %s\n", trap_Cmd_Argv( 0 ), i, trap_Cmd_Argv( 0 ) );
	}
}
Exemple #26
0
/*
* Cmd_PlayersExt_f
*/
static void Cmd_PlayersExt_f( edict_t *ent, bool onlyspecs )
{
	int i;
	int count = 0;
	int start = 0;
	char line[64];
	char msg[1024];

	if( trap_Cmd_Argc() > 1 )
		start = atoi( trap_Cmd_Argv( 1 ) );
	clamp( start, 0, gs.maxclients - 1 );

	// print information
	msg[0] = 0;

	for( i = start; i < gs.maxclients; i++ )
	{
		if( trap_GetClientState( i ) >= CS_SPAWNED )
		{
			if( onlyspecs && game.edicts[i+1].s.team != TEAM_SPECTATOR )
				continue;

			Q_snprintfz( line, sizeof( line ), "%3i %s%s\n", i, game.clients[i].netname,
				game.clients[i].isoperator ? " op" : "" );

			if( strlen( line ) + strlen( msg ) > sizeof( msg ) - 100 )
			{
				// can't print all of them in one packet
				Q_strncatz( msg, "...\n", sizeof( msg ) );
				break;
			}

			if( count == 0 )
			{
				Q_strncatz( msg, "num name\n", sizeof( msg ) );
				Q_strncatz( msg, "--- ---------------\n", sizeof( msg ) );
			}

			Q_strncatz( msg, line, sizeof( msg ) );
			count++;
		}
	}

	if( count )
		Q_strncatz( msg, "--- ---------------\n", sizeof( msg ) );
	Q_strncatz( msg, va( "%3i %s\n", count, trap_Cmd_Argv( 0 ) ), sizeof( msg ) );
	G_PrintMsg( ent, "%s", msg );

	if( i < gs.maxclients )
		G_PrintMsg( ent, "Type '%s %i' for more %s\n", trap_Cmd_Argv( 0 ), i, trap_Cmd_Argv( 0 ) );
}
Exemple #27
0
/*
* CG_DemoFreeFly_Cmd_f
*/
static void CG_DemoFreeFly_Cmd_f( void ) {
	if( trap_Cmd_Argc() > 1 ) {
		if( !Q_stricmp( trap_Cmd_Argv( 1 ), "on" ) ) {
			CamIsFree = true;
		} else if( !Q_stricmp( trap_Cmd_Argv( 1 ), "off" ) ) {
			CamIsFree = false;
		}
	} else {
		CamIsFree = !CamIsFree;
	}

	VectorClear( cam_velocity );
	CG_Printf( "demo cam mode %s\n", CamIsFree ? "Free Fly" : "Preview" );
}
Exemple #28
0
static void SF_Play_f( void )
{
	int i;
	char name[MAX_QPATH];

	i = 1;
	while( i < trap_Cmd_Argc() )
	{
		Q_strncpyz( name, trap_Cmd_Argv( i ), sizeof( name ) );

		S_StartLocalSound( name );
		i++;
	}
}
Exemple #29
0
/*
* Cmd_Say_f
*/
void Cmd_Say_f( edict_t *ent, qboolean arg0, qboolean checkflood )
{
	char *p;
	char text[2048];

	if( checkflood )
	{
		if( CheckFlood( ent, qfalse ) )
			return;
	}

	if( ent->r.client && ent->r.client->muted & 1 )
		return;

	if( trap_Cmd_Argc() < 2 && !arg0 )
		return;

	text[0] = 0;

	if( arg0 )
	{
		Q_strncatz( text, trap_Cmd_Argv( 0 ), sizeof( text ) );
		Q_strncatz( text, " ", sizeof( text ) );
		Q_strncatz( text, trap_Cmd_Args(), sizeof( text ) );
	}
	else
	{
		p = trap_Cmd_Args();

		if( *p == '"' )
		{
			if( p[strlen( p )-1] == '"' )
				p[strlen( p )-1] = 0;
			p++;
		}
		Q_strncatz( text, p, sizeof( text ) );
	}

	// don't let text be too long for malicious reasons
	if( strlen( text ) > 150 )
		text[150] = 0;

	G_ChatMsg( NULL, ent, qfalse, "%s", text );

	// racesow
	RS_ircSendMessage( va( "%s", COM_RemoveColorTokens(( ent->r.client->netname ) )),
			va( "%s", COM_RemoveColorTokens(( text)) ) );
	// !racesow
}
Exemple #30
0
static void SF_Play_f( void )
{
	int i;
	sfx_t *sfx;

	for( i = 1; i < trap_Cmd_Argc(); i++ )
	{
		sfx = SF_RegisterSound( trap_Cmd_Argv( i ) );
		if( !sfx )
		{
			Com_Printf( "Couldn't play: %s\n", trap_Cmd_Argv( i ) );
			continue;
		}
		S_StartGlobalSound( sfx, S_CHANNEL_AUTO, 1.0 );
	}
}