本文整理汇总了C++中CBaseTFPlayer::ForceRespawn方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseTFPlayer::ForceRespawn方法的具体用法?C++ CBaseTFPlayer::ForceRespawn怎么用?C++ CBaseTFPlayer::ForceRespawn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBaseTFPlayer
的用法示例。
在下文中一共展示了CBaseTFPlayer::ForceRespawn方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sizeof
//-----------------------------------------------------------------------------
// Purpose: Create a new Bot and put it in the game.
// Output : Pointer to the new Bot, or NULL if there's no free clients.
//-----------------------------------------------------------------------------
CBasePlayer *BotPutInServer( bool bFrozen, int iTeam, int iClass )
{
g_iNextBotTeam = iTeam;
g_iNextBotClass = iClass;
char botname[ 64 ];
Q_snprintf( botname, sizeof( botname ), "Bot%02i", BotNumber );
edict_t *pEdict = engine->CreateFakeClient( botname );
if (!pEdict)
{
Msg( "Failed to create Bot.\n");
return NULL;
}
// Allocate a CBasePlayer for the bot, and call spawn
ClientPutInServer( pEdict, botname );
CBaseTFPlayer *pPlayer = ((CBaseTFPlayer *)CBaseEntity::Instance( pEdict ));
pPlayer->ClearFlags();
pPlayer->AddFlag( FL_CLIENT | FL_FAKECLIENT );
if ( bFrozen )
pPlayer->AddEFlags( EFL_BOT_FROZEN );
if ( iTeam != -1 )
{
pPlayer->ChangeTeam( iTeam );
}
pPlayer->ForceRespawn();
BotNumber++;
return pPlayer;
}