当前位置: 首页>>代码示例>>C++>>正文


C++ UTIL_LogPrintf函数代码示例

本文整理汇总了C++中UTIL_LogPrintf函数的典型用法代码示例。如果您正苦于以下问题:C++ UTIL_LogPrintf函数的具体用法?C++ UTIL_LogPrintf怎么用?C++ UTIL_LogPrintf使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了UTIL_LogPrintf函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DevMsg

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CAI_Expresser::SpeechMsg( CBaseEntity *pFlex, const char *pszFormat, ... )
{
	if ( !DebuggingSpeech() )
		return;

	if ( pFlex->MyNPCPointer() )
	{
		DevMsg( pFlex->MyNPCPointer(), CFmtStr( &pszFormat ) );
	}
	else 
	{
		DevMsg( CFmtStr( &pszFormat ) );
	}
	UTIL_LogPrintf( (char *) ( (const char *) CFmtStr( &pszFormat ) ) );
}
开发者ID:Entropy-Soldier,项目名称:ges-legacy-code,代码行数:18,代码来源:ai_speech.cpp

示例2: GetRestartTimeLimit

// sets the length of the pause between round end and respawning
void CBaseRoundRules::SetRestartLength(float flRestartTime)
{
	if(flRestartTime > GetRestartTimeLimit()) {
		flRestartTime = GetRestartTimeLimit();
	}

	if(flRestartTime >= 0) {
		m_flRestartTime = gpGlobals->time + flRestartTime;
	} else {
		// -- this is wierd to log it
		ALERT(at_console, "Bad Restart Length being set - (%1.f)\n", flRestartTime);
		UTIL_LogPrintf(ROUND_LOGGING, "World triggered \"Bad Restart Length\" (restart_length \"%1.f\") (old_restart_length \"1.f\") (respawn_style \"%i\") (round_state \"%i\")\n", flRestartTime, GetRestartTime(), (int)m_iRespawnStyle, (int)m_iRoundState);
		
		m_flRestartTime = gpGlobals->time + GetRestartTimeLimit();
	}
}
开发者ID:BackupTheBerlios,项目名称:battlegrounds-svn,代码行数:17,代码来源:bg_round.cpp

示例3: ALERT

// returns the current round state
ROUND_STATE CBaseRoundRules::GetRoundState()
{
	// check validity of current round state
	if(!m_iRoundState)
	{
		// - report the error
		ALERT(at_console, "Null Round State\n");
		UTIL_LogPrintf(ROUND_LOGGING, "World triggered \"Null Round State\"\n");

		// - set a default round state to help the game recover
		SetRoundState(ROUND_NOTSTARTED, false);
		return m_iRoundState;
	}

	return m_iRoundState;
}
开发者ID:BackupTheBerlios,项目名称:battlegrounds-svn,代码行数:17,代码来源:bg_round.cpp

示例4: ClientDisconnected

//=========================================================
//=========================================================
void CHalfLifeMultiplay :: ClientDisconnected( edict_t *pClient )
{
	if ( pClient )
	{
		CBasePlayer *pPlayer = (CBasePlayer *)CBaseEntity::Instance( pClient );
		
		if ( pPlayer )
		{
			FireTargets( "game_playerleave", pPlayer, pPlayer, USE_TOGGLE, 0 );
			
			UTIL_LogPrintf( "%s disconnected\n", GetLogStringForPlayer( pPlayer->edict() ).c_str() );
			
			pPlayer->RemoveAllItems( TRUE );// destroy all of the players weapons and items
		}
	}
}
开发者ID:Arkshine,项目名称:NS,代码行数:18,代码来源:multiplay_gamerules.cpp

示例5: FuncPrintfLog

void FuncPrintfLog(const char *str, ...)
{
	va_list			argptr;
	static char		string[1024];

	va_start(argptr, str);
	vsnprintf(string, sizeof(string), str, argptr);
	va_end(argptr);

	FILE *file = NULL;
	int length;
	const char *path = "AdminMod/logs/";
	char fullpath[PATH_MAX];
	char line[MAX_CONF_LEN];

	time_t clock = time(NULL);
	tm *ltm = localtime(&clock);

	sup_gamedir_path(path, fullpath);

	sup_make_str(fullpath + strlen(fullpath), sizeof(fullpath), "%d-%d-%d_1.txt", ltm->tm_mday, ltm->tm_mon + 1,
		1900 + ltm->tm_year);
	sup_make_str(line, sizeof(line), "[%d-%d-%d] - [%d:%d:%d] : %s\n", ltm->tm_mday, ltm->tm_mon + 1,
		1900 + ltm->tm_year, ltm->tm_hour, ltm->tm_min, ltm->tm_sec, string);

	while(1)
	{
		file = fopen(fullpath, "a+");
		if(!file)
		{
			UTIL_LogPrintf("Unable to create log list file '%s': %s", fullpath, strerror(errno));
			return;
		}

		fseek(file, 0, SEEK_END);
		length = ftell(file);

		if(length >= MAX_FILE_LEN)
			sup_add_symb(fullpath, strlen(fullpath) - 5);
		else break;

		fclose(file);
	}

	fputs(line, file);
	fclose(file);
}
开发者ID:JuGGerNaunT,项目名称:AdminMod,代码行数:47,代码来源:PluginFuncs.cpp

示例6: sprintf

//=========================================================
// ClientUserInfoChanged
//=========================================================
void CHalfLifeTeamplay::ClientUserInfoChanged( CBasePlayer *pPlayer, char *infobuffer )
{
	char text[1024];

	// prevent skin/color/model changes
	char *mdls = g_engfuncs.pfnInfoKeyValue( infobuffer, "model" );

	if ( !stricmp( mdls, pPlayer->m_szTeamName ) )
		return;

	if ( defaultteam.value )
	{
		int clientIndex = pPlayer->entindex();

		g_engfuncs.pfnSetClientKeyValue( clientIndex, g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "model", pPlayer->m_szTeamName );
		g_engfuncs.pfnSetClientKeyValue( clientIndex, g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "team", pPlayer->m_szTeamName );
		sprintf( text, "* Not allowed to change teams in this game!\n" );
		UTIL_SayText( text, pPlayer );
		return;
	}

	if ( defaultteam.value || !IsValidTeam( mdls ) )
	{
		int clientIndex = pPlayer->entindex();

		g_engfuncs.pfnSetClientKeyValue( clientIndex, g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "model", pPlayer->m_szTeamName );
		sprintf( text, "* Can't change team to \'%s\'\n", mdls );
		UTIL_SayText( text, pPlayer );
		sprintf( text, "* Server limits teams to \'%s\'\n", m_szTeamList );
		UTIL_SayText( text, pPlayer );
		return;
	}
	// notify everyone of the team change
	sprintf( text, "* %s has changed to team \'%s\'\n", STRING(pPlayer->pev->netname), mdls );
	UTIL_SayTextAll( text, pPlayer );

	UTIL_LogPrintf( "\"%s<%i><%s><%s>\" joined team \"%s\"\n", 
		STRING(pPlayer->pev->netname),
		GETPLAYERUSERID( pPlayer->edict() ),
		GETPLAYERAUTHID( pPlayer->edict() ),
		pPlayer->m_szTeamName,
		mdls );

	ChangePlayerTeam( pPlayer, mdls, TRUE, TRUE );
	// recound stuff
	RecountTeams( TRUE );
}
开发者ID:johndrinkwater,项目名称:CSSDK,代码行数:50,代码来源:teamplay_gamerules.cpp

示例7: SetRespawnStyle

// setup all variables up to default state
CBaseRoundRules::CBaseRoundRules()
{
	m_flRoundTimeLimit = 0.0;
	m_flRoundTime = 0.0;

	m_iRespawnStyle = NULL_RESPAWN;
	SetRespawnStyle((RESPAWN_STYLE)((int)CVAR_GET_FLOAT("mp_respawnstyle")));

	m_iRoundState = ROUND_NOTSTARTED;

	iCount = 0;
	ClearTeamsCount();
	m_iWinningTeam = 0;

	ALERT(at_console, "New Round Rules Created\n");
	UTIL_LogPrintf(ROUND_LOGGING, "World triggered \"Round Rules Created\"\n");
}
开发者ID:BackupTheBerlios,项目名称:battlegrounds-svn,代码行数:18,代码来源:bg_round.cpp

示例8: Bucket

/* 
0 [Byte]	1	// Weapons Groupings
1 [Byte]	210	// Total Rounds Allowed
2 [Byte]	-1	// Undefined Not Used
3 [Byte]	-1	// Undefined Not Used
4 [Byte]	2	// Weapon Slot
5 [Byte]	0	// Bucket ( Position Under Weapon Slot )
6 [Short]	7	// Weapon Number / Bit Field for the weapon
7 [Byte]	128	// Bit Field for the Ammo or Ammo Type
8 [Byte]	30	// Rounds Per Mag

id, wpnID, slot, position, totalrds
*/
static cell AMX_NATIVE_CALL dod_weaponlist(AMX *amx, cell *params) // player
{
	if(!weaponlist[params[1]].changeable)
	{
		MF_LogError(amx, AMX_ERR_NATIVE, "This Weapon Cannot be Changed");
		return 0;
	}

	int id = params[1];
	int wpnID = params[2];
	int slot = params[3];
	int position = params[4];
	int totalrds = params[5];

	UTIL_LogPrintf("ID (%d) WpnID (%d) Slot (%d) Pos (%d) Rounds (%d)", id, wpnID, slot, position, totalrds);

	CHECK_PLAYER(id);

	CPlayer* pPlayer = GET_PLAYER_POINTER_I(id);
	if(!pPlayer->ingame)
	{
		MF_LogError(amx, AMX_ERR_NATIVE, "Invalid Player, Not on Server");
		return 0;
	}
	
	MESSAGE_BEGIN(MSG_ONE, GET_USER_MSG_ID(PLID, "WeaponList", NULL), NULL, INDEXENT(id));
	WRITE_BYTE(weaponlist[wpnID].grp);
		WRITE_BYTE(totalrds);
		WRITE_BYTE(-1);
		WRITE_BYTE(-1);
		WRITE_BYTE(slot - 1);
		WRITE_BYTE(position);
		WRITE_SHORT(wpnID);
		WRITE_BYTE(weaponlist[wpnID].bitfield);

		// Is it grenades
		if(wpnID == 13 || wpnID == 14 || wpnID == 15 || wpnID == 16 || wpnID == 36)
			WRITE_BYTE(-1);
		else if(wpnID == 29 || wpnID == 30 || wpnID == 31)
			WRITE_BYTE(1);
		else
			WRITE_BYTE(weaponlist[wpnID].clip);
	MESSAGE_END();

	return 1;
}
开发者ID:Chuvi-w,项目名称:amxmodx,代码行数:59,代码来源:NBase.cpp

示例9: ClientDisconnected

//=========================================================
//=========================================================
void CHalfLifeMultiplay :: ClientDisconnected( edict_t *pClient )
{
	if ( pClient )
	{
		CBasePlayer *pPlayer = (CBasePlayer *)CBaseEntity::Instance( pClient );

		if ( pPlayer )
		{
			FireTargets( "game_playerleave", pPlayer, pPlayer, USE_TOGGLE, 0 );

			UTIL_LogPrintf( "\"%s<%i><%s><%i>\" disconnected\n",  
				STRING( pPlayer->pev->netname ), 
				GETPLAYERUSERID( pPlayer->edict() ),
				GETPLAYERAUTHID( pPlayer->edict() ),
				GETPLAYERUSERID( pPlayer->edict() ) );

			pPlayer->RemoveAllItems( TRUE );// destroy all of the players weapons and items

			// Tell all clients this player isn't a spectator anymore
			MESSAGE_BEGIN( MSG_ALL, gmsgSpectator );  
				WRITE_BYTE( ENTINDEX(pClient) );
				WRITE_BYTE( 0 );
			MESSAGE_END();

			CBasePlayer *client = NULL;
			while ( ((client = (CBasePlayer*)UTIL_FindEntityByClassname( client, "player" )) != NULL) && (!FNullEnt(client->edict())) ) 
			{
				if ( !client->pev )
					continue;
				if ( client == pPlayer )
					continue;

				// If a spectator was chasing this player, move him/her onto the next player
				if ( client->m_hObserverTarget == pPlayer )
				{
					int iMode = client->pev->iuser1;
					client->pev->iuser1 = 0;
					client->m_hObserverTarget = NULL;
					client->Observer_SetMode( iMode );
				}
			}
		}
	}
}
开发者ID:Skumek,项目名称:hlsdk,代码行数:46,代码来源:multiplay_gamerules.cpp

示例10: UTIL_SayText

//=========================================================
// ClientUserInfoChanged
//=========================================================
void CTeamplayRules::ClientUserInfoChanged( CBasePlayer *pPlayer, char *infobuffer )
{
	char text[1024];

	// prevent skin/color/model changes
	char *mdls = engine->InfoKeyValue( infobuffer, "model" );

	if ( !stricmp( mdls, pPlayer->TeamName() ) )
		return;

	if ( defaultteam.GetFloat() )
	{
		int clientIndex = pPlayer->entindex();

		engine->SetClientKeyValue( clientIndex, engine->GetInfoKeyBuffer( pPlayer->edict() ), "model", pPlayer->TeamName() );
		engine->SetClientKeyValue( clientIndex, engine->GetInfoKeyBuffer( pPlayer->edict() ), "team", pPlayer->TeamName() );
		UTIL_SayText( "Not allowed to change teams in this game!\n", pPlayer );
		return;
	}

	if ( defaultteam.GetFloat() || !IsValidTeam( mdls ) )
	{
		int clientIndex = pPlayer->entindex();

		engine->SetClientKeyValue( clientIndex, engine->GetInfoKeyBuffer( pPlayer->edict() ), "model", pPlayer->TeamName() );
		Q_snprintf( text,sizeof(text), "Can't change team to \'%s\'\n", mdls );
		UTIL_SayText( text, pPlayer );
		Q_snprintf( text,sizeof(text), "Server limits teams to \'%s\'\n", m_szTeamList );
		UTIL_SayText( text, pPlayer );
		return;
	}
	// notify everyone of the team change
	if ( Q_strlen( STRING(pPlayer->pl.netname) ) > 0 )
	{
		Q_snprintf( text,sizeof(text), "%s has changed to team \'%s\'\n", STRING(pPlayer->pl.netname), mdls );
		UTIL_SayTextAll( text, pPlayer );
	}

	UTIL_LogPrintf( "\"%s<%i>\" changed to team %s\n", STRING( pPlayer->pl.netname ), engine->GetPlayerUserId( pPlayer->edict() ), mdls );

	ChangePlayerTeam( pPlayer, mdls, true, true );
	// recound stuff
	RecountTeams();
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:47,代码来源:teamplay_gamerules.cpp

示例11: ClientDisconnected

//=========================================================
//=========================================================
void CHalfLifeRules :: ClientDisconnected( edict_t *pClient )
{
	if ( pClient )
	{
		CBasePlayer *pPlayer = (CBasePlayer *)CBaseEntity::Instance( pClient );

		if ( pPlayer )
		{
			FireTargets( "game_playerleave", pPlayer, pPlayer, USE_TOGGLE, 0 );

			UTIL_LogPrintf( "\"%s<%i><%s><%i>\" disconnected\n",  
			STRING( pPlayer->pev->netname ), 
			GETPLAYERUSERID( pPlayer->edict() ),
			GETPLAYERAUTHID( pPlayer->edict() ),
			GETPLAYERUSERID( pPlayer->edict() ) );

			pPlayer->RemoveAllItems( TRUE );// destroy all of the players weapons and items
		}
	}
}
开发者ID:mittorn,项目名称:hlwe_src,代码行数:22,代码来源:singleplay_gamerules.cpp

示例12: ClientUserInfoChanged

/*
========================
ClientUserInfoChanged

called after the player changes
userinfo - gives dll a chance to modify it before
it gets sent into the rest of the engine.
========================
*/
void ClientUserInfoChanged( edict_t *pEntity, char *infobuffer )
{
	// Is the client spawned yet?
	if ( !pEntity->pvPrivateData )
		return;

	// msg everyone if someone changes their name,  and it isn't the first time (changing no name to current name)
	if ( pEntity->v.netname && STRING(pEntity->v.netname)[0] != 0 && !FStrEq( STRING(pEntity->v.netname), g_engfuncs.pfnInfoKeyValue( infobuffer, "name" )) )
	{
		char text[256];
		sprintf( text, "* %s changed name to %s\n", STRING(pEntity->v.netname), g_engfuncs.pfnInfoKeyValue( infobuffer, "name" ) );
		MESSAGE_BEGIN( MSG_ALL, gmsgSayText, NULL );
			WRITE_BYTE( ENTINDEX(pEntity) );
			WRITE_STRING( text );
		MESSAGE_END();

		UTIL_LogPrintf( "\"%s<%i>\" changed name to \"%s<%i>\"\n", STRING( pEntity->v.netname ), GETPLAYERUSERID( pEntity ), g_engfuncs.pfnInfoKeyValue( infobuffer, "name" ), GETPLAYERUSERID( pEntity ) );
	}

	g_pGameRules->ClientUserInfoChanged( GetClassPtr((CBasePlayer *)&pEntity->v), infobuffer );
}
开发者ID:jlecorre,项目名称:hlinvasion,代码行数:30,代码来源:client.cpp

示例13: UTIL_LogPrintf

void AvHVisibleBlipList::AddBlip(float inX, float inY, float inZ, int8 inStatus, int8 inBlipInfo)
{
	//ASSERT(this->mNumBlips < kMaxBlips);
	if(this->mNumBlips < (kMaxBlips-1))
	{
		int theBlipOffset = this->mNumBlips;
		
		this->mBlipPositions[theBlipOffset][0] = inX;
		this->mBlipPositions[theBlipOffset][1] = inY;
		this->mBlipPositions[theBlipOffset][2] = inZ;
		this->mBlipStatus[theBlipOffset] = inStatus;
		this->mBlipInfo[theBlipOffset] = inBlipInfo;
		
		this->mNumBlips++;
	}
	else
	{
		#ifdef AVH_SERVER
		UTIL_LogPrintf("AvHVisibleBlipList::AddBlip(%f, %f, %f, status: %d):  Can't add blip, max limit %d reached.\n", inX, inY, inZ, inStatus, kMaxBlips);
		#endif
	}
}
开发者ID:tschumann,项目名称:naturalselection,代码行数:22,代码来源:AvHVisibleBlipList.cpp

示例14: ClientPrint

void CHostage::AnnounceDeath(CBasePlayer *pAttacker)
{
	ClientPrint(pAttacker->pev, HUD_PRINTCENTER, "#Killed_Hostage");

	if (!(pAttacker->m_flDisplayHistory & DHF_HOSTAGE_KILLED))
	{
		pAttacker->HintMessage("#Hint_lost_money");
		pAttacker->m_flDisplayHistory |= DHF_HOSTAGE_KILLED;
	}

	if (!g_pGameRules->IsMultiplayer())
		CHalfLifeTraining::HostageDied();

	UTIL_LogPrintf("\"%s<%i><%s><%s>\" triggered \"Killed_A_Hostage\"\n", STRING(pAttacker->pev->netname), GETPLAYERUSERID(pAttacker->edict()), GETPLAYERAUTHID(pAttacker->edict()), GetTeam(pAttacker->m_iTeam));

	MESSAGE_BEGIN(MSG_SPEC, SVC_DIRECTOR);
	WRITE_BYTE(9);
	WRITE_BYTE(DRC_CMD_EVENT);
	WRITE_SHORT(ENTINDEX(pAttacker->edict()));
	WRITE_SHORT(ENTINDEX(edict()));
	WRITE_LONG(15);
	MESSAGE_END();
}
开发者ID:DeadlyGamer,项目名称:cs16nd,代码行数:23,代码来源:hostage.cpp

示例15: InputDisable

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTeamRoundTimer::RoundTimerSetupThink( void )
{
	if ( TeamplayRoundBasedRules()->IsInPreMatch() == true && IsDisabled() == false )
	{
		inputdata_t data;
		InputDisable( data );
		m_OnSetupFinished.FireOutput( this, this );
	}

	if ( IsDisabled() || m_bTimerPaused )
	{
		SetContextThink( &CTeamRoundTimer::RoundTimerSetupThink, gpGlobals->curtime + 0.05, ROUND_TIMER_SETUP_THINK );
		return;
	}

	float flTime = GetTimeRemaining();
	TeamplayRoundBasedRules()->SetOvertime( false );

	if ( flTime <= 0.0f && m_bFireFinished )
	{
		IGameEvent *event = gameeventmanager->CreateEvent( "teamplay_setup_finished" );
		if ( event )
		{
			gameeventmanager->FireEvent( event );
		}

		m_OnSetupFinished.FireOutput( this, this );
		m_bFireFinished = false;

		SetTimeRemaining( m_nTimeToUseAfterSetupFinished );
		SetState( RT_STATE_NORMAL );

		if ( ShowInHud() && !TeamplayRoundBasedRules()->IsInWaitingForPlayers() )
		{
			UTIL_LogPrintf( "World triggered \"Round_Setup_End\"\n" );
		}
		return;
	}
	else if ( flTime <= 60.0 && m_bFire1MinRemain )
	{
		m_On1MinRemain.FireOutput( this, this );
		m_bFire1MinRemain = false;
	}
	else if ( flTime <= 30.0 && m_bFire30SecRemain )
	{
		m_On30SecRemain.FireOutput( this, this );
		m_bFire30SecRemain = false;
	}
	else if ( flTime <= 10.0 && m_bFire10SecRemain )
	{
		m_On10SecRemain.FireOutput( this, this );
		m_bFire10SecRemain = false;
	}
	else if ( flTime <= 5.0 && m_bFire5SecRemain )
	{
		m_On5SecRemain.FireOutput( this, this );
		m_bFire5SecRemain = false;
	}
	else if ( flTime <= 4.0 && m_bFire4SecRemain )
	{
		m_On4SecRemain.FireOutput( this, this );
		m_bFire4SecRemain = false;
	}
	else if ( flTime <= 3.0 && m_bFire3SecRemain )
	{
		m_On3SecRemain.FireOutput( this, this );
		m_bFire3SecRemain = false;
	}
	else if ( flTime <= 2.0 && m_bFire2SecRemain )
	{
		m_On2SecRemain.FireOutput( this, this );
		m_bFire2SecRemain = false;
	}
	else if ( flTime <= 1.0 && m_bFire1SecRemain )
	{
		m_On1SecRemain.FireOutput( this, this );
		m_bFire1SecRemain = false;
	}

	SetContextThink( &CTeamRoundTimer::RoundTimerSetupThink, gpGlobals->curtime + 0.05, ROUND_TIMER_SETUP_THINK );
}
开发者ID:0xFEEDC0DE64,项目名称:UltraGame,代码行数:84,代码来源:teamplay_round_timer.cpp


注:本文中的UTIL_LogPrintf函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。