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


C++ UTIL_GetCommandClient函数代码示例

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


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

示例1: CC_SwitchToPhyscannon

//
//	Name: CC_SwitchToPhyscannon
//	Author: Hekar Khani
//	Description: Concommand. Switches between Physcannon and last weapon
//	Notes:
//
void CC_SwitchToPhyscannon( void )
{
	CBasePlayer *pPlayer = ToBasePlayer( UTIL_GetCommandClient() );
	
	if ( pPlayer )
	{
		CBaseCombatWeapon *pWeapon = pPlayer->GetActiveWeapon();

		if ( pWeapon )
		{
			// Tell the client to stop selecting weapons
			engine->ClientCommand( UTIL_GetCommandClient()->edict(), "cancelselect" );

			const char *strWeaponName = pWeapon->GetName();

			if ( !Q_stricmp( strWeaponName, "weapon_lf_combat_cannon" ) )
			{
				pPlayer->SelectLastItem();
			}
			else
			{
				pPlayer->SelectItem( "weapon_lf_combat_cannon" );
			}
		}
	}
}
开发者ID:hekar,项目名称:luminousforts-2013,代码行数:32,代码来源:ClassicCommands.cpp

示例2: asw_marine_spectate_f

void asw_marine_spectate_f(const CCommand &args)
{
	CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient());
	if ( args.ArgC() < 2 )
	{
		Msg( "Usage: asw_marine_spectate [marine_num]\n" );
		return;
	}

	CASW_Game_Resource* pGameResource = ASWGameResource();
	if (!pGameResource)
		return;

	int iMarine = atof(args[1]);
	if (iMarine < 0 || iMarine >= pGameResource->GetMaxMarineResources())
		return;

	CASW_Marine_Resource* pMR = pGameResource->GetMarineResource(iMarine);
	if (!pMR)
	{
		Msg("No marine resource in that index\n");
		return;
	}

	CASW_Marine *pMarine = pMR->GetMarineEntity();
	if (!pMarine)
	{
		Msg("No live marine in that slot\n");
		return;
	}
		
	pPlayer->SetSpectatingMarine(pMarine);
}
开发者ID:Nightgunner5,项目名称:Jastian-Summer,代码行数:33,代码来源:asw_concommands.cpp

示例3: fire_rocket_projectile_f

static void fire_rocket_projectile_f( void )
{
	CBasePlayer *pPlayer = (CBasePlayer *)UTIL_GetCommandClient();

	Vector ptEyes, vForward;
	QAngle vLookAng;
	ptEyes = pPlayer->EyePosition();
	pPlayer->EyeVectors( &vForward );
	vLookAng = pPlayer->EyeAngles();

	CRocket_Turret_Projectile *pRocket = (CRocket_Turret_Projectile *) CBaseEntity::Create( "rocket_turret_projectile", ptEyes, vLookAng, pPlayer );

	if ( !pRocket )
		return;

	pRocket->SetThink( NULL );
	pRocket->SetMoveType( MOVETYPE_FLY );

	pRocket->SetModel( ROCKET_TURRET_PROJECTILE_NAME );
	UTIL_SetSize( pRocket, vec3_origin, vec3_origin );

	pRocket->CreateSmokeTrail();

	pRocket->SetAbsVelocity( vForward * 550 );
	pRocket->SetLauncher ( NULL );
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:26,代码来源:npc_rocket_turret.cpp

示例4: asw_alien_batch_f

// creates a batch of aliens at the mouse cursor
void asw_alien_batch_f( const CCommand& args )
{
    MDLCACHE_CRITICAL_SECTION();

    bool allowPrecache = CBaseEntity::IsPrecacheAllowed();
    CBaseEntity::SetAllowPrecache( true );

    // find spawn point
    CASW_Player* pPlayer = ToASW_Player(UTIL_GetCommandClient());
    if (!pPlayer)
        return;
    CASW_Marine *pMarine = pPlayer->GetMarine();
    if (!pMarine)
        return;
    trace_t tr;
    Vector forward;

    AngleVectors( pMarine->EyeAngles(), &forward );
    UTIL_TraceLine(pMarine->EyePosition(),
                   pMarine->EyePosition() + forward * 300.0f,MASK_SOLID,
                   pMarine, COLLISION_GROUP_NONE, &tr );
    if ( tr.fraction != 0.0 )
    {
        // trace to the floor from this spot
        Vector vecSrc = tr.endpos;
        tr.endpos.z += 12;
        UTIL_TraceLine( vecSrc + Vector(0, 0, 12),
                        vecSrc - Vector( 0, 0, 512 ) ,MASK_SOLID,
                        pMarine, COLLISION_GROUP_NONE, &tr );

        ASWSpawnManager()->SpawnAlienBatch( "asw_parasite", 25, tr.endpos, vec3_angle );
    }

    CBaseEntity::SetAllowPrecache( allowPrecache );
}
开发者ID:docfinorlias,项目名称:asb2,代码行数:36,代码来源:asw_spawn_manager.cpp

示例5: asw_path_end_f

void asw_path_end_f()
{
	CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient());
	if ( !pPlayer || !ASWPathUtils() )
		return;

	if ( !pPlayer->GetMarine() )
		return;

	Vector vecPathEnd = pPlayer->GetMarine()->GetAbsOrigin();
	debugoverlay->AddBoxOverlay( g_vecPathStart, Vector(-10, -10, -10 ), Vector(10, 10, 10) , vec3_angle, 255, 0, 0, 255, 30.0f );
	debugoverlay->AddBoxOverlay( vecPathEnd, Vector(-10, -10, -10 ), Vector(10, 10, 10) , vec3_angle, 255, 255, 0, 255, 30.0f );

	AI_Waypoint_t *pWaypoint = ASWPathUtils()->BuildRoute( g_vecPathStart, vecPathEnd, NULL, 100, NAV_NONE, bits_BUILD_GET_CLOSE );
	if ( !pWaypoint )
	{
		Msg( "Failed to find route\n" );
		return;
	}

	if ( UTIL_ASW_DoorBlockingRoute( pWaypoint, true ) )
	{
		Msg(" Route blocked by sealed/locked door\n" );
	}

	ASWPathUtils()->DebugDrawRoute( g_vecPathStart, pWaypoint );
}
开发者ID:Au-heppa,项目名称:swarm-sdk,代码行数:27,代码来源:asw_path_utils.cpp

示例6: asw_test_turret_f

void asw_test_turret_f()
{
	CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient());
	
	if (pPlayer && pPlayer->GetMarine())
	{
		CASW_Marine *pMarine = pPlayer->GetMarine();
		if (pMarine->m_hRemoteTurret.Get())
		{
			pMarine->m_hRemoteTurret->StopUsingTurret();//m_hUser = NULL;
			pMarine->m_hRemoteTurret = NULL;
			return;
		}
		CBaseEntity* pEntity = NULL;
		while ((pEntity = gEntList.FindEntityByClassname( pEntity, "asw_remote_turret" )) != NULL)
		{
			CASW_Remote_Turret* pTurret = dynamic_cast<CASW_Remote_Turret*>(pEntity);			
			if (pTurret)
			{
				pTurret->StartedUsingTurret(pMarine);
				pMarine->m_hRemoteTurret = pTurret;
				Msg("Set turret\n");
				return;
			}
		}
	}	
	Msg("Failed to find a turret\n");
}
开发者ID:Nightgunner5,项目名称:Jastian-Summer,代码行数:28,代码来源:asw_concommands.cpp

示例7: asw_room_info_f

void asw_room_info_f()
{
	CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient());
	if ( pPlayer && pPlayer->GetMarine() && missionchooser && missionchooser->RandomMissions() )
	{
		IASW_Room_Details *pRoom = missionchooser->RandomMissions()->GetRoomDetails( pPlayer->GetMarine()->GetAbsOrigin() );
		if ( !pRoom )
		{
			Msg(" Couldn't find room\n" );
		}
		else
		{
			char buf[MAX_PATH];
			pRoom->GetFullRoomName( buf, MAX_PATH );
			Msg( " Room name: %s\n", buf );
			Msg( " Room tags: " );
			int nNumTags = pRoom->GetNumTags();
			for ( int i = 0; i < nNumTags; ++ i )
			{
				Msg( "%s    ", pRoom->GetTag( i ) );
			}
			Msg( "\n" );
		}
	}
}
开发者ID:Nightgunner5,项目名称:Jastian-Summer,代码行数:25,代码来源:asw_concommands.cpp

示例8: change_portalgun_linkage_id_f

static void change_portalgun_linkage_id_f( const CCommand &args )
{
	if( sv_cheats->GetBool() == false ) //heavy handed version since setting the concommand with FCVAR_CHEATS isn't working like I thought
		return;

	if( args.ArgC() < 2 )
		return;

	unsigned char iNewID = (unsigned char)atoi( args[1] );

	CPortal_Player *pPlayer = (CPortal_Player *)UTIL_GetCommandClient();

	int iWeaponCount = pPlayer->WeaponCount();
	for( int i = 0; i != iWeaponCount; ++i )
	{
		CBaseCombatWeapon *pWeapon = pPlayer->GetWeapon(i);
		if( pWeapon == NULL )
			continue;

		if( dynamic_cast<CWeaponPortalgun *>(pWeapon) != NULL )
		{
			CWeaponPortalgun *pPortalGun = (CWeaponPortalgun *)pWeapon;
			pPortalGun->m_iPortalLinkageGroupID = iNewID;
			break;
		}
	}
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:27,代码来源:weapon_portalgun.cpp

示例9: CC_ASW_Ent_Create

//------------------------------------------------------------------------------
// Purpose: Create an NPC of the given type
//------------------------------------------------------------------------------
void CC_ASW_Ent_Create( const CCommand& args )
{
	MDLCACHE_CRITICAL_SECTION();

	bool allowPrecache = CBaseEntity::IsPrecacheAllowed();
	CBaseEntity::SetAllowPrecache( true );

	// Try to create entity
	CBaseEntity *entity = dynamic_cast< CBaseEntity * >( CreateEntityByName(args[1]) );
	if (entity)
	{
		entity->Precache();		

		// Now attempt to drop into the world
		CASW_Player* pPlayer = ToASW_Player( UTIL_GetCommandClient() );
		if (!pPlayer)
			return;

		trace_t tr;
		UTIL_TraceLine( pPlayer->GetCrosshairTracePos() + Vector( 0, 0, 30 ),
			pPlayer->GetCrosshairTracePos(), MASK_SOLID, 
			pPlayer, COLLISION_GROUP_NONE, &tr );

		if ( tr.fraction != 0.0 )
		{
			// Raise the end position a little up off the floor, place the npc and drop him down
			tr.endpos.z += 12;
			entity->Teleport( &tr.endpos, NULL, NULL );
			// this was causing aliens to spawn under ground 
			//UTIL_DropToFloor( entity, MASK_SOLID );
		}
		DispatchSpawn(entity);
	}
	CBaseEntity::SetAllowPrecache( allowPrecache );
}
开发者ID:Nightgunner5,项目名称:Jastian-Summer,代码行数:38,代码来源:asw_concommands.cpp

示例10: asw_drop_ammo_f

void asw_drop_ammo_f(const CCommand &args)
{
	CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient());
	if (!pPlayer)
		return;
	
	CASW_Marine *pMarine = pPlayer->GetMarine();
	if (!pMarine)
		return;

	int iBagSlot = atoi(args[1]);

	CASW_Weapon_Ammo_Bag *pBag = dynamic_cast<CASW_Weapon_Ammo_Bag*>(pMarine->GetWeapon(0));
	if (pBag)
	{
		if (pBag->DropAmmoPickup(iBagSlot))
		{
			return;
		}
	}

	pBag = dynamic_cast<CASW_Weapon_Ammo_Bag*>(pMarine->GetWeapon(1));
	if (pBag)
	{
		if (pBag->DropAmmoPickup(iBagSlot))
		{
			return;
		}
	}
}
开发者ID:Nightgunner5,项目名称:Jastian-Summer,代码行数:30,代码来源:asw_concommands.cpp

示例11: CC_ASW_Shake

//------------------------------------------------------------------------------
// Purpose: Console command to cause a screen shake.
//------------------------------------------------------------------------------
void CC_ASW_Shake( void )
{
	CBasePlayer *pPlayer = UTIL_GetCommandClient();
	if (pPlayer)
	{
		UTIL_ASW_ScreenShake( pPlayer->WorldSpaceCenter(), 25.0, 150.0, 1.0, 750, SHAKE_START );
	}
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:11,代码来源:asw_env_shake.cpp

示例12: CC_WC_Create

//------------------------------------------------------------------------------
// Purpose : 
// Input   :
// Output  :
//------------------------------------------------------------------------------
void CC_WC_Create( void )
{
	// Only allowed in wc_edit_mode
	if (engine->IsInEditMode())
	{
		CBaseEntity::m_nDebugPlayer = UTIL_GetCommandClientIndex();

		if (g_pAINetworkManager->GetEditOps()->m_bLinkEditMode)
		{
			NWCEdit::CreateAILink(UTIL_GetCommandClient());
		}
		else
		{
			NWCEdit::CreateAINode(UTIL_GetCommandClient());
		}
	}
}
开发者ID:WorldGamers,项目名称:Mobile-Forces-Source,代码行数:22,代码来源:wcedit.cpp

示例13: asw_debug_spectator_server_f

void asw_debug_spectator_server_f(void)
{
	CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient());
	if (!pPlayer)
		return;
	
	Msg("Server: m_bRequestedSpectator=%d\n", pPlayer->m_bRequestedSpectator);
}
开发者ID:Nightgunner5,项目名称:Jastian-Summer,代码行数:8,代码来源:asw_concommands.cpp

示例14: asw_live_marines_f

void asw_live_marines_f()
{
	CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient());
	if (!pPlayer)
		return;

	Msg("Has live marines: %d\n", pPlayer->HasLiveMarines());
}
开发者ID:Nightgunner5,项目名称:Jastian-Summer,代码行数:8,代码来源:asw_concommands.cpp

示例15: asw_suicide_f

void asw_suicide_f()
{
	CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient());
		
	if (pPlayer && pPlayer->GetMarine() && pPlayer->GetMarine()->GetHealth() > 0)
	{
		pPlayer->GetMarine()->Suicide();
	}
}
开发者ID:Nightgunner5,项目名称:Jastian-Summer,代码行数:9,代码来源:asw_concommands.cpp


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