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


C++ const_iterator::GetIndex方法代码示例

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


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

示例1: RT_SetTransmitCallback

bool AntiSmokeBlocker::RT_SetTransmitCallback ( PlayerHandler::const_iterator sender, PlayerHandler::const_iterator receiver )
{
	//if(!receiver) return false;

	if( GetPlayerDataStructByIndex ( receiver.GetIndex () )->is_in_smoke )
		return true;

	if( GetPlayerDataStructByIndex ( receiver.GetIndex () )->can_not_see_this_player[ sender.GetIndex () ] == true )
		return true;

	return false;
}
开发者ID:L-EARN,项目名称:NoCheatZ-4,代码行数:12,代码来源:AntiSmokeBlocker.cpp

示例2: RT_ThinkPostCallback

void RadarHackBlocker::RT_ThinkPostCallback ( SourceSdk::edict_t const * const pent )
{
	ProcessFilter::HumanAtLeastConnectedOrBot const filter_class;

	for( PlayerHandler::const_iterator ph ( &filter_class ); ph != PlayerHandler::end (); ph += &filter_class )
	{
		int const index ( ph.GetIndex () );
		ClientRadarData * pData ( GetPlayerDataStructByIndex ( index ) );
		if( pData->m_last_spotted_status != m_players_spotted[ index ] )
		{
			pData->m_last_spotted_status = m_players_spotted[ index ];

			if( pData->m_last_spotted_status )
			{
				RT_UpdatePlayerData ( *ph );
				RT_ProcessEntity ( ph->GetEdict () );
			}
			else
			{
				//pData->m_next_update = curtime + 1.0f;
				//UpdatePlayerData(ph->playerClass);
				//ProcessEntity(Helpers::PEntityOfEntIndex(x));
			}
		}
	}
}
开发者ID:L-EARN,项目名称:NoCheatZ-4,代码行数:26,代码来源:RadarHackBlocker.cpp

示例3: RT_ProcessOnTick

void RadarHackBlocker::RT_ProcessOnTick ( float const curtime )
{
	ProcessFilter::HumanAtLeastConnectedOrBot const filter_class;

	for( PlayerHandler::const_iterator ph ( &filter_class ); ph != PlayerHandler::end (); ph += &filter_class )
	{
		int const index ( ph.GetIndex () );

		ClientRadarData * pData ( GetPlayerDataStructByIndex ( index ) );

		if( pData->m_last_spotted_status )
		{
			RT_UpdatePlayerData ( *ph );
			RT_ProcessEntity ( ph->GetEdict () );
		}
		else
		{
			if( curtime > m_next_process )
			{
				RT_UpdatePlayerData ( *ph );
				RT_ProcessEntity ( ph->GetEdict () );
			}
		}
	}

	if( curtime > m_next_process )
	{
		m_next_process = curtime + 2.0f;
	}
}
开发者ID:L-EARN,项目名称:NoCheatZ-4,代码行数:30,代码来源:RadarHackBlocker.cpp

示例4: FireGameEvent

void EyeAnglesTester::FireGameEvent ( SourceSdk::IGameEvent *ev ) // round_end
{
	ProcessFilter::HumanAtLeastConnected filter_class;
	for( PlayerHandler::const_iterator ph ( &filter_class ); ph != PlayerHandler::end (); ph+=&filter_class )
	{
		++( GetPlayerDataStructByIndex ( ph.GetIndex () )->ignore_last );
	}
}
开发者ID:L-EARN,项目名称:NoCheatZ-4,代码行数:8,代码来源:EyeAnglesTester.cpp

示例5: Load

void AutoAttackTester::Load ()
{
	for( PlayerHandler::const_iterator it ( PlayerHandler::begin () ); it != PlayerHandler::end (); ++it )
	{
		ResetPlayerDataStructByIndex ( it.GetIndex () );
	}

	PlayerRunCommandHookListener::RegisterPlayerRunCommandHookListener ( this, SystemPriority::UserCmdHookListener::AutoAttackTester );
}
开发者ID:L-EARN,项目名称:NoCheatZ-4,代码行数:9,代码来源:AutoAttackTester.cpp

示例6: pdata

void AutoAttackTester::OnAttack2Up ( PlayerHandler::const_iterator ph, int game_tick )
{
	AttackTriggerStats * const pdata ( GetPlayerDataStructByIndex ( ph.GetIndex () ) );

	pdata->attack2_up_tick = game_tick;
	pdata->attack2_sustain_stats.Store ( game_tick - pdata->attack2_down_tick , pdata->attack2_down_tick );

	FindDetection ( ph, &( pdata->attack2_sustain_stats ) );
}
开发者ID:L-EARN,项目名称:NoCheatZ-4,代码行数:9,代码来源:AutoAttackTester.cpp

示例7: Load

void EyeAnglesTester::Load ()
{
	for( PlayerHandler::const_iterator it ( PlayerHandler::begin () ); it != PlayerHandler::end (); ++it )
	{
		ResetPlayerDataStructByIndex ( it.GetIndex () );
	}

	SourceSdk::InterfacesProxy::GetGameEventManager ()->AddListener ( this, "round_end", true );
	PlayerRunCommandHookListener::RegisterPlayerRunCommandHookListener ( this, SystemPriority::UserCmdHookListener::EyeAnglesTester );
}
开发者ID:L-EARN,项目名称:NoCheatZ-4,代码行数:10,代码来源:EyeAnglesTester.cpp

示例8: Load

void AntiSmokeBlocker::Load ()
{
	for( PlayerHandler::const_iterator it ( PlayerHandler::begin () ); it != PlayerHandler::end (); ++it )
	{
		ResetPlayerDataStructByIndex ( it.GetIndex () );
	}

	SourceSdk::InterfacesProxy::GetGameEventManager ()->AddListener ( this, "smokegrenade_detonate", true );
	SourceSdk::InterfacesProxy::GetGameEventManager ()->AddListener ( this, "round_start", true );
	OnTickListener::RegisterOnTickListener ( this );
	SetTransmitHookListener::RegisterSetTransmitHookListener ( this, 1 );
}
开发者ID:L-EARN,项目名称:NoCheatZ-4,代码行数:12,代码来源:AntiSmokeBlocker.cpp

示例9: RT_ProcessOnTick

void AntiSmokeBlocker::RT_ProcessOnTick ( float const curtime )
{
	METRICS_ENTER_SECTION ( "AntiSmokeBlocker::OnFrame" );

	SmokeListT::elem_t* it ( m_smokes.GetFirst () );

	// remove old smokes
	while( it != nullptr )
	{
		if( curtime - ( it->m_value.bang_time + ConfigManager::GetInstance ()->m_smoke_time ) > 0.0f )
			it = m_smokes.Remove ( it );
		else it = it->m_next;
	}

	ST_R_STATIC SmokeInfoT empty;
	ResetAll ( &empty );

	it = m_smokes.GetFirst ();
	if( it == nullptr ) return;

	// Test if players are immersed in smoke
	ProcessFilter::InTestsNoBot l1_filter;
	ProcessFilter::InTestsOrBot l2_filter;
	for( PlayerHandler::const_iterator ph ( &l1_filter ); ph != PlayerHandler::end (); ph+=&l1_filter )
	{
		SourceSdk::Vector delta, other_delta;

		MathInfo const & x_math ( MathCache::GetInstance ()->RT_GetCachedMaths ( ph.GetIndex () ) );

		do // At this stage, m_smokes ! empty
		{
			if( curtime - it->m_value.bang_time > ConfigManager::GetInstance ()->m_smoke_timetobang )
			{
				SourceSdk::vec_t dst;
				SourceSdk::VectorDistanceSqr ( x_math.m_eyepos, it->m_value.pos, delta, dst );
				if( dst < ConfigManager::GetInstance ()->m_innersmoke_radius_sqr )
				{
					GetPlayerDataStructByIndex ( ph.GetIndex () )->is_in_smoke = true;
				}

				/* Players can't see eachother if they are behind a smoke */

				const SourceSdk::vec_t ang_smoke ( tanf ( ConfigManager::GetInstance ()->m_smoke_radius / sqrtf ( dst ) ) );
				SourceSdk::VectorNorm ( delta );

				for( PlayerHandler::const_iterator other_ph ( &l2_filter ); other_ph != PlayerHandler::end (); other_ph+=&l2_filter )
				{
					if( ph == other_ph ) continue;

					MathInfo const & y_math ( MathCache::GetInstance ()->RT_GetCachedMaths ( other_ph.GetIndex () ) );

					// Is he behind the smoke against us ?

					SourceSdk::vec_t other_dst;
					SourceSdk::VectorDistanceSqr ( x_math.m_eyepos, y_math.m_abs_origin, other_delta, other_dst );
					if( dst + ConfigManager::GetInstance ()->m_smoke_radius < other_dst )
					{
						// Hidden by the hull of the smoke ?

						SourceSdk::VectorNorm ( other_delta );

						SourceSdk::vec_t dp;
						SourceSdk::VectorDotProduct ( other_delta, delta, dp );
						const SourceSdk::vec_t angle_player ( fabs ( acos ( dp ) ) );

						if( angle_player < ang_smoke )
						{
							GetPlayerDataStructByIndex ( ph.GetIndex () )->can_not_see_this_player[ other_ph.GetIndex () ] = true;
						}
					}
				}
			}
			it = it->m_next;
		}
		while( it != nullptr );
		it = m_smokes.GetFirst ();
	}

	METRICS_LEAVE_SECTION ( "AntiSmokeBlocker::OnFrame" );
}
开发者ID:L-EARN,项目名称:NoCheatZ-4,代码行数:80,代码来源:AntiSmokeBlocker.cpp

示例10: RT_PlayerRunCommandCallback

PlayerRunCommandRet EyeAnglesTester::RT_PlayerRunCommandCallback ( PlayerHandler::const_iterator ph, void * const pCmd, void * const old_cmd )
{
	int const * const flags ( EntityProps::GetInstance ()->GetPropValue<int, PROP_FLAGS> ( ph->GetEdict () ) );

	/*
		FL_FROZEN			(1 << 5)
		FL_ATCONTROLS		(1 << 6)
	*/
	if( *flags & ( 3 << 5 ) ) return PlayerRunCommandRet::CONTINUE;

	PlayerRunCommandRet drop_cmd ( PlayerRunCommandRet::CONTINUE );

	EyeAngleInfoT* playerData ( GetPlayerDataStructByIndex ( ph.GetIndex () ) );
	playerData->x.abs_value = fabs ( playerData->x.value = static_cast< SourceSdk::CUserCmd_csgo* >( pCmd )->viewangles.x );
	playerData->y.abs_value = fabs ( playerData->y.value = static_cast< SourceSdk::CUserCmd_csgo* >( pCmd )->viewangles.y );
	playerData->z.abs_value = fabs ( playerData->z.value = static_cast< SourceSdk::CUserCmd_csgo* >( pCmd )->viewangles.z );

	if( playerData->x.abs_value > 89.0f || playerData->z.abs_value > 1.0f || playerData->y.abs_value > 180.0f )
	{
		if( playerData->ignore_last ) --( playerData->ignore_last );
		else drop_cmd = PlayerRunCommandRet::INERT;
	}

	if( drop_cmd > PlayerRunCommandRet::CONTINUE )
	{
		if( playerData->x.abs_value > 89.0f )
		{
			++playerData->x.detectionsCount;
			if( playerData->x.lastDetectionPrintTime + ANTIFLOOD_LOGGING_TIME < Plat_FloatTime () )
			{
				playerData->x.lastDetectionPrintTime = Plat_FloatTime ();

				Detection_EyeAngleX pDetection;
				pDetection.PrepareDetectionData ( playerData );
				pDetection.PrepareDetectionLog ( *ph, this );
				pDetection.Log ();
			}
		}
		if( playerData->y.abs_value > 180.0f )
		{
			++playerData->y.detectionsCount;
			if( playerData->y.lastDetectionPrintTime + ANTIFLOOD_LOGGING_TIME < Plat_FloatTime () )
			{
				playerData->y.lastDetectionPrintTime = Plat_FloatTime ();

				Detection_EyeAngleY pDetection;
				pDetection.PrepareDetectionData ( playerData );
				pDetection.PrepareDetectionLog ( *ph, this );
				pDetection.Log ();
			}
		}
		if( playerData->z.abs_value > 1.0f )
		{
			++playerData->z.detectionsCount;
			if( playerData->z.lastDetectionPrintTime + ANTIFLOOD_LOGGING_TIME < Plat_FloatTime () )
			{
				playerData->z.lastDetectionPrintTime = Plat_FloatTime ();

				Detection_EyeAngleZ pDetection;
				pDetection.PrepareDetectionData ( playerData );
				pDetection.PrepareDetectionLog ( *ph, this );
				pDetection.Log ();
			}
		}

		BanRequest::GetInstance ()->AddAsyncBan ( *ph, 0, "Banned by NoCheatZ 4" );
	}
	return drop_cmd;
}
开发者ID:L-EARN,项目名称:NoCheatZ-4,代码行数:69,代码来源:EyeAnglesTester.cpp

示例11: LoadPlayerManager

void NczPlayerManager::LoadPlayerManager ()
{
	SourceSdk::InterfacesProxy::GetGameEventManager ()->AddListener ( this, "player_death", true );
	SourceSdk::InterfacesProxy::GetGameEventManager ()->AddListener ( this, "player_team", true );
	SourceSdk::InterfacesProxy::GetGameEventManager ()->AddListener ( this, "player_spawn", true );
	SourceSdk::InterfacesProxy::GetGameEventManager ()->AddListener ( this, "player_connect", true );
	SourceSdk::InterfacesProxy::GetGameEventManager ()->AddListener ( this, "player_disconnect", true );
	SourceSdk::InterfacesProxy::GetGameEventManager ()->AddListener ( this, "round_end", true );
	SourceSdk::InterfacesProxy::GetGameEventManager ()->AddListener ( this, "round_freeze_end", true );
	SourceSdk::InterfacesProxy::GetGameEventManager ()->AddListener ( this, "bot_takeover", true );

	//Helpers::FastScan_EntList();
	Helpers::m_EdictList = Helpers::PEntityOfEntIndex ( 0 );

	//if(Helpers::m_EdictList)
	//{
	//int maxcl = Helpers::GetMaxClients();

	for( PlayerHandler::const_iterator ph ( PlayerHandler::begin () ); ph != PlayerHandler::end (); ++ph )
	{
		SourceSdk::edict_t* const pEntity ( Helpers::PEntityOfEntIndex ( ph.GetIndex () ) );
		if( Helpers::isValidEdict ( pEntity ) )
		{
			void * playerinfo ( SourceSdk::InterfacesProxy::Call_GetPlayerInfo ( pEntity ) );
			if( playerinfo )
			{
				bool isfakeclient;
				if( SourceSdk::InterfacesProxy::m_game == SourceSdk::CounterStrikeGlobalOffensive )
				{
					isfakeclient = static_cast< SourceSdk::IPlayerInfo_csgo* >( playerinfo )->IsFakeClient ();
				}
				else
				{
					isfakeclient = static_cast< SourceSdk::IPlayerInfo* >( playerinfo )->IsFakeClient ();
				}
				if( isfakeclient )
				{
					ph.GetHandler ()->status = SlotStatus::BOT;
					ph.GetHandler ()->playerClass = new NczPlayer ( ph.GetIndex () );
					m_max_index = ph.GetIndex ();
				}
				else if( static_cast< SourceSdk::IPlayerInfo* >( playerinfo )->IsConnected () )
				{
					ph.GetHandler ()->status = SlotStatus::PLAYER_CONNECTED;
					ph.GetHandler ()->playerClass = new NczPlayer ( ph.GetIndex () );
					ph.GetHandler ()->playerClass->OnConnect ();
					m_max_index = ph.GetIndex ();
				}
			}
		}
	}

	//}

	if( m_max_index )
	{
		PlayerHandler::first = ( &FullHandlersList[ 1 ] );
		PlayerHandler::last = ( &FullHandlersList[ m_max_index ] );
	}
	else
	{
		PlayerHandler::first = PlayerHandler::invalid;
		PlayerHandler::last = PlayerHandler::invalid;
	}

	BaseSystem::ManageSystems ();
}
开发者ID:L-EARN,项目名称:NoCheatZ-4,代码行数:67,代码来源:NczPlayerManager.cpp

示例12: RT_PlayerRunCommandCallback

PlayerRunCommandRet ShotTester::RT_PlayerRunCommandCallback ( PlayerHandler::const_iterator ph, void* pCmd, void* lastcmd )
{
	PlayerRunCommandRet drop_cmd = PlayerRunCommandRet::CONTINUE;

	ShotStatsT * const playerData ( GetPlayerDataStructByIndex ( ph.GetIndex () ) );

	float const curtime ( Plat_FloatTime () );

	bool cur_in_attack;
	bool past_in_attack;

	if( SourceSdk::InterfacesProxy::m_game == SourceSdk::CounterStrikeGlobalOffensive )
	{
		cur_in_attack = ( static_cast< SourceSdk::CUserCmd_csgo* >( pCmd )->buttons & IN_ATTACK ) != 0;
		past_in_attack = ( static_cast< SourceSdk::CUserCmd_csgo* >( lastcmd )->buttons & IN_ATTACK ) != 0;
	}
	else
	{
		cur_in_attack = ( static_cast< SourceSdk::CUserCmd* >( pCmd )->buttons & IN_ATTACK ) != 0;
		past_in_attack = ( static_cast< SourceSdk::CUserCmd* >( lastcmd )->buttons & IN_ATTACK ) != 0;
	}

	if( cur_in_attack && !past_in_attack )
	{
		//SystemVerbose1(Helpers::format("Player %s : IN_ATTACK button down.", ph->GetName()));
		playerData->down_time = curtime;
	}
	else if( past_in_attack && !cur_in_attack )
	{
		playerData->up_time = curtime;
		TriggerStat ( &( playerData->clicks ), playerData->up_time, playerData->down_time, playerData->clicks.n );
		//SystemVerbose1(Helpers::format("Player %s : IN_ATTACK button up.", ph->GetName()));

		if( playerData->up_time - playerData->down_time <= SHORT_TIME )
		{
			if( curtime - playerData->last_detection > 1.0 )
			{
				if( playerData->row == 1 )
				{
					if( playerData->on_target.ratio > 25.0 && playerData->clicks.n > 50 )
					{
						Detection_TriggerBot pDetection;
						pDetection.PrepareDetectionData ( playerData );
						pDetection.PrepareDetectionLog ( *ph, this );
						pDetection.Log ();

						ph->Ban ();
					}
				}
				playerData->row = 0;
			}
			if( playerData->row > 10 )
			{
				if( playerData->short_clicks.ratio > 40.0 && playerData->clicks.n > 50 )
				{
					Detection_AutoPistol pDetection;
					pDetection.PrepareDetectionData ( playerData );
					pDetection.PrepareDetectionLog ( *ph, this );
					pDetection.Log ();

					ph->Ban ();
				}
			}
			playerData->last_detection = curtime;
			++( playerData->row );

			TriggerStat ( &( playerData->short_clicks ), playerData->up_time, playerData->down_time, playerData->clicks.n );
			if( ph->GetWpnShotType () == HAND ) TriggerStat ( &( playerData->with_hand ), playerData->up_time, playerData->down_time, playerData->clicks.n );
			else if( ph->GetWpnShotType () == PISTOL ) TriggerStat ( &( playerData->with_pistol ), playerData->up_time, playerData->down_time, playerData->clicks.n );
			else TriggerStat ( &( playerData->with_auto ), playerData->up_time, playerData->down_time, playerData->clicks.n );
			if( ph->aimingAt () > 0 ) TriggerStat ( &( playerData->on_target ), playerData->up_time, playerData->down_time, playerData->clicks.n );
			drop_cmd = PlayerRunCommandRet::INERT;

			if( this->m_verbose )
			{
				printf ( "%f - clicks ", curtime );
				OutputStat ( &( playerData->clicks ) );
				printf ( ", short_clicks " );
				OutputStat ( &( playerData->short_clicks ) );
				printf ( ", with_hand " );
				OutputStat ( &( playerData->with_hand ) );
				printf ( ", with_pistol " );
				OutputStat ( &( playerData->with_pistol ) );
				printf ( ", with_auto " );
				OutputStat ( &( playerData->with_auto ) );
				printf ( ", on_target " );
				OutputStat ( &( playerData->on_target ) );
				printf ( ", row %u\n", playerData->row );
			}
		}
	}
	return drop_cmd;
}
开发者ID:L-EARN,项目名称:NoCheatZ-4,代码行数:93,代码来源:ShotTester.cpp


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