本文整理汇总了C++中playerhandler::const_iterator类的典型用法代码示例。如果您正苦于以下问题:C++ const_iterator类的具体用法?C++ const_iterator怎么用?C++ const_iterator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了const_iterator类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
}
开发者ID:L-EARN,项目名称:NoCheatZ-4,代码行数:30,代码来源:RadarHackBlocker.cpp
示例2: 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" );
}
开发者ID:askovpen,项目名称:NoCheatZ-4,代码行数:35,代码来源:plugin.cpp
示例3: 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
示例4: 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 );
}
开发者ID:askovpen,项目名称:NoCheatZ-4,代码行数:8,代码来源:OnGroundHookListener.cpp
示例5: 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
示例6: 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
示例7: 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 );
}
开发者ID:L-EARN,项目名称:NoCheatZ-4,代码行数:10,代码来源:WeaponHookListener.cpp
示例8: 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
示例9: 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
示例10: 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
示例11: GetPlayerHandlerBySteamID
PlayerHandler::const_iterator NczPlayerManager::GetPlayerHandlerBySteamID ( const char * steamid ) const
{
const char * tSteamId;
for( PlayerHandler::const_iterator it ( PlayerHandler::begin () ); it != PlayerHandler::end (); ++it )
{
if( it )
{
tSteamId = it->GetSteamID ();
if( strcmp ( tSteamId, steamid ) == 0 ) return it;
}
}
return PlayerHandler::end ();
}
开发者ID:L-EARN,项目名称:NoCheatZ-4,代码行数:15,代码来源:NczPlayerManager.cpp
示例12: GetPlayerHandlerByName
PlayerHandler::const_iterator NczPlayerManager::GetPlayerHandlerByName ( const char * playerName ) const
{
const char * tName;
for( PlayerHandler::const_iterator it ( PlayerHandler::begin () ); it != PlayerHandler::end (); ++it )
{
if( it )
{
tName = it->GetName ();
if( strcmp ( tName, playerName ) ) return it;
}
}
return PlayerHandler::end ();
}
开发者ID:L-EARN,项目名称:NoCheatZ-4,代码行数:15,代码来源:NczPlayerManager.cpp
示例13: 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 ();
}
开发者ID:askovpen,项目名称:NoCheatZ-4,代码行数:20,代码来源:plugin.cpp
示例14: 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 ();
}
开发者ID:L-EARN,项目名称:NoCheatZ-4,代码行数:17,代码来源:NczPlayerManager.cpp
示例15: 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
示例16: 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
示例17: FireGameEvent
void NczPlayerManager::FireGameEvent ( SourceSdk::IGameEvent* ev )
/*
player_death
player_team
player_spawn
player_connect
player_disconnect
round_freeze_end
round_end
bot_takeover
*/
{
const char* event_name ( ev->GetName () + 6 );
const int maxcl ( m_max_index );
if( *event_name == 'e' ) // round_end
{
DebugMessage("event round_end");
for( int x ( 1 ); x <= maxcl; ++x )
{
PlayerHandler::const_iterator ph ( x );
if( ph == SlotStatus::PLAYER_IN_TESTS )
{
ph.GetHandler()->status = SlotStatus::PLAYER_CONNECTED;
ph.GetHandler()->in_tests_time = std::numeric_limits<float>::max ();
DebugMessage(Helpers::format("Players %s : Status changed from PLAYER_IN_TESTS to PLAYER_CONNECTED", ph->GetName()));
}
/*else if( ph == SlotStatus::PLAYER_IN_TESTS_TAKEOVER )
{
ph->GetTakeover ()->StopBotTakeover ();
ph->StopBotTakeover ();
ph.GetHandler ()->status = SlotStatus::PLAYER_CONNECTED;
ph.GetHandler ()->in_tests_time = std::numeric_limits<float>::max ();
}*/
}
ProcessFilter::HumanAtLeastConnected filter_class;
if( GetPlayerCount ( &filter_class ) == 0 ) AutoTVRecord::GetInstance ()->StopRecord ();
BaseSystem::ManageSystems ();
Logger::GetInstance ()->Flush ();
return;
}
/*else*/ if( *event_name == 'f' ) // round_freeze_end = round_start
{
DebugMessage("event round_freeze_end");
for( int x ( 1 ); x <= maxcl; ++x )
{
PlayerHandler& ph ( FullHandlersList[ x ] );
if( ph.status == SlotStatus::INVALID ) continue;
if( ph.status >= SlotStatus::PLAYER_CONNECTED )
{
ph.status = SlotStatus::PLAYER_CONNECTED;
SourceSdk::IPlayerInfo * const pinfo ( ph.playerClass->GetPlayerInfo () );
if( pinfo )
{
if( pinfo->GetTeamIndex () > 1 )
{
DebugMessage(Helpers::format("Players %s : Will enter in status PLAYER_IN_TESTS in 1 second", ph.playerClass->GetName()));
ph.in_tests_time = Plat_FloatTime () + 1.0f;
}
else
{
ph.in_tests_time = std::numeric_limits<float>::max ();
}
}
}
}
BaseSystem::ManageSystems ();
return;
}
PlayerHandler::const_iterator ph ( GetPlayerHandlerByUserId ( ev->GetInt ( "userid" ) ) );
if( *event_name == 'k' ) // bot_takeover
{
DebugMessage(Helpers::format("event bot_takeover : %s -> %s", ph->GetName (), GetPlayerHandlerByUserId ( ev->GetInt ( "botid" ) )->GetName ()));
//PlayerHandler::const_iterator bh1 ( GetPlayerHandlerByUserId ( ev->GetInt ( "botid" ) ) );
//PlayerHandler::const_iterator bh2 ( GetPlayerHandlerByUserId ( ) );
//DebugMessage ( Helpers::format ( "Player %s taking control of bot %s or bot %d", ph->GetName (), bh1->GetName (), ev->GetInt ( "index" ) ));
//ph->EnterBotTakeover ( ev->GetInt ( "index" ) );
//bh2->EnterBotTakeover ( ph.GetIndex () );
//ph.GetHandler ()->status = SlotStatus::PLAYER_IN_TESTS_TAKEOVER;
//ph.GetHandler ()->in_tests_time = std::numeric_limits<float>::max ();
return;
}
++event_name;
if( *event_name == 'c' ) // player_connect
{
if( ev->GetBool ( "bot" ) == false )
{
if( SourceSdk::InterfacesProxy::m_game == SourceSdk::CounterStrikeGlobalOffensive )
{
//.........这里部分代码省略.........
开发者ID:L-EARN,项目名称:NoCheatZ-4,代码行数:101,代码来源:NczPlayerManager.cpp
示例18: 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;
}
开发者ID:askovpen,项目名称:NoCheatZ-4,代码行数:92,代码来源:plugin.cpp
示例19: 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
示例20: 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
注:本文中的playerhandler::const_iterator类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论