コード例 #1
0
ファイル: plugin.cpp プロジェクト: askovpen/NoCheatZ-4
//---------------------------------------------------------------------------------
// 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" );
}
コード例 #2
0
ファイル: plugin.cpp プロジェクト: kanekikun420/NoCheatZ-3
//---------------------------------------------------------------------------------
// Purpose: called when a client spawns into a server (i.e as they begin to play)
//---------------------------------------------------------------------------------
void CNoCheatZPlugin::ClientActive( edict_t *pEntity )
{
	Msg("%f : CNoCheatZPlugin::ClientActive\n", Plat_FloatTime());
	NczPlayerManager::GetInstance()->ClientActive(pEntity);

	PlayerHandler* ph = NczPlayerManager::GetInstance()->GetPlayerHandlerByEdict(pEntity);
	if(ph->status > BOT) HookBasePlayer(ph->playerClass);
}
コード例 #3
0
ファイル: plugin.cpp プロジェクト: kanekikun420/NoCheatZ-3
//---------------------------------------------------------------------------------
// Purpose: called when the plugin is loaded, load the interface we need from the engine
//---------------------------------------------------------------------------------
bool CNoCheatZPlugin::Load(CreateInterfaceFn _interfaceFactory, CreateInterfaceFn gameServerFactory )
{
	ConnectTier1Libraries( &_interfaceFactory, 1 );
	if(g_pCVar->FindVar("nocheatz_instance"))
	{
		if(g_pCVar->FindVar("nocheatz_instance")->GetInt() == 1)
		{
			Error("[NoCheatZ 4] CNoCheatZPlugin - Error : CNoCheatZPlugin already loaded.\n");
			m_bAlreadyLoaded = true;
			return false;
		}
	}
	//ConnectTier2Libraries( &interfaceFactory, 1 );

	CIFaceManager::GetInstance()->UpdateIFactoryPtr(interfaceFactory, (void*)_interfaceFactory);
	CIFaceManager::GetInstance()->UpdateIFactoryPtr(gameFactory, (void*)gameServerFactory);
	NczPlayerManager::GetInstance()->LoadPlayerManager(); // Mark any present player as PLAYER_CONNECTED

	ConVar_Register( 0 );

	EyeAnglesTester::GetInstance();
	JumpTester::GetInstance();
	ValidationTester::GetInstance();
	ConVarTester::GetInstance();
	ShotTester::GetInstance();
	SpeedTester::GetInstance();

	CIFaceManager::GetInstance()->GetIengine()->ServerExecute();
	CIFaceManager::GetInstance()->GetIengine()->ServerCommand("exec nocheatz.cfg\n");
	CIFaceManager::GetInstance()->GetIengine()->ServerExecute();

	for(int i = 0; i < MAX_PLAYERS; ++i)
	{
		PlayerHandler* ph = NczPlayerManager::GetInstance()->GetPlayerHandlerByIndex(i);
		if(ph->status == PLAYER_CONNECTED)
		{
			HookBasePlayer(ph->playerClass);
			LoadTestersByConfig();
			ValidationTester::GetInstance()->ResetPlayerDataStruct(ph->playerClass);
			JumpTester::GetInstance()->ResetPlayerDataStruct(ph->playerClass);
			EyeAnglesTester::GetInstance()->ResetPlayerDataStruct(ph->playerClass);
			ConVarTester::GetInstance()->ResetPlayerDataStruct(ph->playerClass);
			ShotTester::GetInstance()->ResetPlayerDataStruct(ph->playerClass);
			SpeedTester::GetInstance()->ResetPlayerDataStruct(ph->playerClass);
		}
	}

	//---------------

	//MathLib_Init( 2.2f, 2.2f, 0.0f, 2 );
	
	g_pCVar->FindVar("nocheatz_instance")->SetValue("1");
	return true;
}
コード例 #4
0
ファイル: plugin.cpp プロジェクト: askovpen/NoCheatZ-4
//---------------------------------------------------------------------------------
// 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 ();
}
コード例 #5
0
ファイル: plugin.cpp プロジェクト: askovpen/NoCheatZ-4
//---------------------------------------------------------------------------------
// 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;
}