本文整理汇总了C++中playerhandler::const_iterator::GetEdict方法的典型用法代码示例。如果您正苦于以下问题:C++ const_iterator::GetEdict方法的具体用法?C++ const_iterator::GetEdict怎么用?C++ const_iterator::GetEdict使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类playerhandler::const_iterator
的用法示例。
在下文中一共展示了const_iterator::GetEdict方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
}
示例2: HookOnGround
void OnGroundHookListener::HookOnGround ( PlayerHandler::const_iterator ph )
{
Assert ( Helpers::isValidEdict ( ph->GetEdict () ) );
void* unk ( ph->GetEdict ()->m_pUnk );
HookInfo info ( unk, ConfigManager::GetInstance ()->vfid_mhgroundentity, ( DWORD ) RT_nNetworkStateChanged_m_hGroundEntity );
HookGuard<OnGroundHookListener>::GetInstance ()->VirtualTableHook ( info );
}
示例3: HookWeapon
void WeaponHookListener::HookWeapon ( PlayerHandler::const_iterator ph )
{
LoggerAssert ( Helpers::isValidEdict ( ph->GetEdict () ) );
void* unk ( ph->GetEdict ()->m_pUnk );
HookInfo info_equip ( unk, ConfigManager::GetInstance ()->vfid_weaponequip, ( DWORD ) RT_nWeapon_Equip );
HookInfo info_drop ( unk, ConfigManager::GetInstance ()->vfid_weapondrop, ( DWORD ) RT_nWeapon_Drop );
HookGuard<WeaponHookListener>::GetInstance ()->VirtualTableHook ( info_equip );
HookGuard<WeaponHookListener>::GetInstance ()->VirtualTableHook ( info_drop );
}
示例4: UnPause
//---------------------------------------------------------------------------------
// Purpose: called when the plugin is unpaused (i.e should start executing again)
//---------------------------------------------------------------------------------
void CNoCheatZPlugin::UnPause ( void )
{
GlobalTimer::GetInstance ()->EnterSection ();
Logger::GetInstance ()->Msg<MSG_CONSOLE> ( "Unpausing ..." );
BaseSystem::InitSystems ();
BanRequest::GetInstance ()->Init ();
NczPlayerManager::GetInstance ()->LoadPlayerManager (); // Mark any present player as PLAYER_CONNECTED
SourceSdk::InterfacesProxy::Call_ServerExecute ();
SourceSdk::InterfacesProxy::Call_ServerCommand ( "exec nocheatz.cfg\n" );
SourceSdk::InterfacesProxy::Call_ServerExecute ();
for( int i ( 1 ); i < MAX_PLAYERS; ++i )
{
PlayerHandler::const_iterator ph ( NczPlayerManager::GetInstance ()->GetPlayerHandlerByIndex ( i ) );
if( ph >= SlotStatus::BOT )
{
HookEntity ( ph->GetEdict () );
WeaponHookListener::HookWeapon ( ph );
if( ph >= SlotStatus::PLAYER_CONNECTED )
{
HookBasePlayer ( ph );
}
}
}
BaseSystem::ManageSystems ();
Logger::GetInstance ()->Msg<MSG_CHAT> ( "Plugin unpaused" );
}
示例5: 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));
}
}
}
}
示例6: ClientActive
//---------------------------------------------------------------------------------
// Purpose: called when a client spawns into a server (i.e as they begin to play)
//---------------------------------------------------------------------------------
void CNoCheatZPlugin::ClientActive ( SourceSdk::edict_t *pEntity )
{
DebugMessage ( Helpers::format ( "CNoCheatZPlugin::ClientActive (%X -> %s)", pEntity, pEntity->GetClassName () ) );
NczPlayerManager::GetInstance ()->ClientActive ( pEntity );
PlayerHandler::const_iterator ph ( NczPlayerManager::GetInstance ()->GetPlayerHandlerByEdict ( pEntity ) );
if( ph >= SlotStatus::PLAYER_CONNECTED ) HookBasePlayer ( ph );
if( ph >= SlotStatus::BOT )
{
WeaponHookListener::HookWeapon ( ph );
HookEntity ( ph->GetEdict () );
}
ProcessFilter::HumanAtLeastConnected filter_class;
if( NczPlayerManager::GetInstance ()->GetPlayerCount ( &filter_class ) == 1 ) AutoTVRecord::GetInstance ()->SpawnTV ();
}
示例7: GetPlayerHandlerByBasePlayer
PlayerHandler::const_iterator NczPlayerManager::GetPlayerHandlerByBasePlayer ( void * const BasePlayer ) const
{
SourceSdk::edict_t * tEdict;
for( PlayerHandler::const_iterator it ( PlayerHandler::begin () ); it != PlayerHandler::end (); ++it )
{
if( it )
{
tEdict = it->GetEdict ();
if( Helpers::isValidEdict ( tEdict ) )
{
if( tEdict->GetUnknown () == BasePlayer ) return it;
}
}
}
return PlayerHandler::end ();
}
示例8: Load
//---------------------------------------------------------------------------------
// Purpose: called when the plugin is loaded, load the interface we need from the engine
//---------------------------------------------------------------------------------
bool CNoCheatZPlugin::Load ( SourceSdk::CreateInterfaceFn _interfaceFactory, SourceSdk::CreateInterfaceFn gameServerFactory )
{
GlobalTimer::GetInstance ()->EnterSection ();
Logger::GetInstance ()->Msg<MSG_CONSOLE> ( "Loading ..." );
if( !SourceSdk::InterfacesProxy::Load ( gameServerFactory, _interfaceFactory ) )
{
Logger::GetInstance ()->Msg<MSG_ERROR> ( "SourceSdk::InterfacesProxy::Load failed" );
return false;
}
void* pinstance ( SourceSdk::InterfacesProxy::ICvar_FindVar ( "nocheatz_instance" ) );
if( pinstance )
{
if( SourceSdk::InterfacesProxy::ConVar_GetBool ( pinstance ) )
{
Logger::GetInstance ()->Msg<MSG_ERROR> ( "CNoCheatZPlugin already loaded" );
m_bAlreadyLoaded = true;
return false;
}
Assert ( "Error when testing for multiple instances" && 0 );
}
if( !ConfigManager::GetInstance ()->LoadConfig () )
{
Logger::GetInstance ()->Msg<MSG_ERROR> ( "ConfigManager::LoadConfig failed" );
return false;
}
if( SourceSdk::InterfacesProxy::m_game == SourceSdk::CounterStrikeGlobalOffensive )
{
ncz_cmd_ptr = new SourceSdk::ConCommand_csgo ( "ncz", BaseSystem::ncz_cmd_fn, "NoCheatZ", FCVAR_DONTRECORD | 1 << 18 );
nocheatz_instance = new SourceSdk::ConVar_csgo ( "nocheatz_instance", "0", FCVAR_DONTRECORD | 1 << 18 );
SourceSdk::ConVar_Register_csgo ( 0 );
}
else
{
// Fix IServerPluginCallbacks vtable, because CSGO added ClientFullyConnect in the middle ...
DWORD* vtable ( IFACE_PTR ( this ) );
int id ( 10 );
int const max_id ( 19 );
do
{
MoveVirtualFunction ( &vtable[ id + 1 ], &vtable[ id ] );
}
while( ++id != max_id );
ncz_cmd_ptr = new SourceSdk::ConCommand ( "ncz", BaseSystem::ncz_cmd_fn, "NoCheatZ", FCVAR_DONTRECORD );
nocheatz_instance = new SourceSdk::ConVar ( "nocheatz_instance", "0", FCVAR_DONTRECORD );
SourceSdk::ConVar_Register ( 0 );
}
UserMessageHookListener::HookUserMessage ();
BaseSystem::InitSystems ();
BanRequest::GetInstance ()->Init ();
NczPlayerManager::GetInstance ()->LoadPlayerManager (); // Mark any present player as PLAYER_CONNECTED
SourceSdk::InterfacesProxy::Call_ServerExecute ();
SourceSdk::InterfacesProxy::Call_ServerCommand ( "exec nocheatz.cfg\n" );
SourceSdk::InterfacesProxy::Call_ServerExecute ();
for( int i ( 1 ); i < MAX_PLAYERS; ++i )
{
PlayerHandler::const_iterator ph ( NczPlayerManager::GetInstance ()->GetPlayerHandlerByIndex ( i ) );
if( ph >= SlotStatus::BOT )
{
HookEntity ( ph->GetEdict () );
WeaponHookListener::HookWeapon ( ph );
if( ph >= SlotStatus::PLAYER_CONNECTED )
{
HookBasePlayer ( ph );
}
}
}
BaseSystem::ManageSystems ();
SourceSdk::InterfacesProxy::ConVar_SetValue<bool> ( nocheatz_instance, true );
Logger::GetInstance ()->Msg<MSG_CHAT> ( "Loaded" );
return true;
}
示例9: 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;
}