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


C++ IPlayerInfo::GetAbsOrigin方法代码示例

本文整理汇总了C++中IPlayerInfo::GetAbsOrigin方法的典型用法代码示例。如果您正苦于以下问题:C++ IPlayerInfo::GetAbsOrigin方法的具体用法?C++ IPlayerInfo::GetAbsOrigin怎么用?C++ IPlayerInfo::GetAbsOrigin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IPlayerInfo的用法示例。


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

示例1: GetAbsOrigin

static cell_t GetAbsOrigin(IPluginContext *pContext, const cell_t *params)
{
	int client = params[1];

	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
	if (!pPlayer)
	{
		return pContext->ThrowNativeError("Client index %d is invalid", client);
	} else if (!pPlayer->IsInGame()) {
		return pContext->ThrowNativeError("Client %d is not in game", client);
	}

	IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
	if (!pInfo)
	{
		return pContext->ThrowNativeError("IPlayerInfo not supported by game");
	}

	cell_t *pVec;
	pContext->LocalToPhysAddr(params[2], &pVec);

	Vector vec = pInfo->GetAbsOrigin();
	pVec[0] = sp_ftoc(vec.x);
	pVec[1] = sp_ftoc(vec.y);
	pVec[2] = sp_ftoc(vec.z);

	return 1;
}
开发者ID:pmrowla,项目名称:sourcemod-1.5,代码行数:28,代码来源:smn_player.cpp

示例2: entityOrigin

Vector CClient :: getOrigin ()
{
	IPlayerInfo *playerinfo = playerinfomanager->GetPlayerInfo( m_pPlayer );

	if ( playerinfo )
	{
		return  playerinfo->GetAbsOrigin() + Vector(0,0,32);
	}

	return CBotGlobals::entityOrigin(m_pPlayer) + Vector(0,0,32);//m_pPlayer->GetCollideable()->GetCollisionOrigin();
}
开发者ID:chrizonix,项目名称:RCBot2,代码行数:11,代码来源:bot_client.cpp

示例3: OnRevived

	int __thiscall RevivedByDefib::OnRevived(CBaseEntity *pInitiator, void *deathModel)
	{
		CBaseEntity* pTarget = reinterpret_cast<CBaseEntity*>(this);
		cell_t client = gamehelpers->EntityToBCompatRef(pTarget);

		IGamePlayer* pGamePlayer = playerhelpers->GetGamePlayer(client);
		if(pGamePlayer) {
			IPlayerInfo* pInfo = pGamePlayer->GetPlayerInfo();
			if(pInfo) {
				r_nowAlive(pInfo->GetAbsOrigin(), g_dead_players, arraysize(g_dead_players));
				L4D_DEBUG_LOG("RevivedByDefib called for: %s", pInfo->GetName());
			}
		}


		return (this->*(GetTrampoline()))(pInitiator, deathModel);
	}
开发者ID:spumer,项目名称:Left4Fix,代码行数:17,代码来源:on_revived_by_defib.cpp

示例4: GameFrame

//---------------------------------------------------------------------------------
// Purpose: called once per server frame, do recurring work here (like checking for timeouts)
//---------------------------------------------------------------------------------
void WebSpecPlugin::GameFrame( bool simulating )
{
	if (gpGlobals->curtime - g_lastUpdateTime > WEBSPEC_UPDATE_RATE_IN_SECONDS
		&& ws_spectators.Count() > 0) {
		
		char *buffer = (char *)malloc(MAX_BUFFER_SIZE);
		Vector playerOrigin;
		QAngle playerAngles;
		float playerUberCharge;
		int userid, health, playerClass;

		IPlayerInfo *playerInfo;
		CBaseEntity *playerEntity;
		int bufferLength;

		bufferLength = sprintf(buffer, "O");

		for (int i = 1; i < gpGlobals->maxClients; i++) {
			playerInfo = playerInfoManager->GetPlayerInfo(engine->PEntityOfEntIndex(i));
			if (playerInfo == NULL || !playerInfo->IsConnected() || playerInfo->IsDead()) continue;

			if (strlen(buffer) > 1)
				snprintf(buffer, MAX_BUFFER_SIZE, "%s|", buffer);

			userid = playerInfo->GetUserID();
			health = playerInfo->GetHealth();
			playerOrigin = playerInfo->GetAbsOrigin();

			playerEntity = serverGameEnts->EdictToBaseEntity(engine->PEntityOfEntIndex(i));
			playerClass = *MakePtr(int*, playerEntity, WSOffsets::pCTFPlayer__m_iClass);
			playerAngles = CBaseEntity_EyeAngles(playerEntity);

			if (playerClass == TFClass_Medic) {
				CBaseCombatCharacter *playerCombatCharacter = CBaseEntity_MyCombatCharacterPointer(playerEntity);
				CBaseCombatWeapon *slot1Weapon = CBaseCombatCharacter_Weapon_GetSlot(playerCombatCharacter, 1);
				
				playerUberCharge = *MakePtr(float*, slot1Weapon, WSOffsets::pCWeaponMedigun__m_flChargeLevel);
			} else {
开发者ID:MattMcNam,项目名称:webspec,代码行数:41,代码来源:webspec.cpp

示例5: if


//.........这里部分代码省略.........


		if ( isDebugOn(BOT_DEBUG_SPEED) )
		{
			CBotGlobals::botMessage(m_pPlayer,0,"speed = %0.0f",m_fSpeed);
		}

		if ( isDebugOn(BOT_DEBUG_USERCMD) )
		{

			if ( p )
			{
				CBotCmd cmd = p->GetLastUserCommand();

				CBotGlobals::botMessage(m_pPlayer,0,"Btns = %d, cmd_no = %d, impulse = %d, weapselect = %d, weapsub = %d",cmd.buttons,cmd.command_number,cmd.impulse,cmd.weaponselect,cmd.weaponsubtype);

			}
		}


		if ( (m_pDebugBot!=NULL) && isDebugOn(BOT_DEBUG_HUD) )
		{
			if ( m_fNextPrintDebugInfo < engine->Time() )
			{
				char msg[1024];
				CBot *pBot = CBots::getBotPointer(m_pDebugBot);

				QAngle eyes = p->GetLastUserCommand().viewangles;
				Vector vForward;
				// in fov? Check angle to edict
				AngleVectors(eyes,&vForward);

				vForward = vForward / vForward.Length(); // normalize
				Vector vLeft = (vForward-p->GetAbsOrigin()).Cross(Vector(0,0,1));
				vLeft = vLeft/vLeft.Length();
				
				Vector vDisplay = p->GetAbsOrigin() + vForward*300.0f; 
				vDisplay = vDisplay - vLeft*300.0f;

				// get debug message
				pBot->debugBot(msg);

#ifndef __linux__
				int i = 0; 
				int n = 0;
				char line[256];
				int linenum = 0;
				int iIndex = ENTINDEX(m_pDebugBot);

				do
				{
					while ( (msg[i]!=0) && (msg[i]!='\n') ) 
						line[n++] = msg[i++];

					line[n]=0;
					debugoverlay->AddEntityTextOverlay(iIndex,linenum++,1.0f,255,255,255,255,line);
					n = 0;

					if ( msg[i] == 0 )
						break;
					i++;
				}while ( 1 ) ;
				//int ent_index, int line_offset, float duration, int r, int g, int b, int a, const char *format, ...
			//	debugoverlay->AddEntityTextOverlay();
#endif
				m_fNextPrintDebugInfo = engine->Time() + 1.0f;
开发者ID:chrizonix,项目名称:RCBot2,代码行数:67,代码来源:bot_client.cpp


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