All pastes #243754 Raw Edit

Wonder

public cpp v1 · immutable
·published 2006-11-08 21:17 UTC
rendered paste body
bool CBanz0rPlugin::Load(CreateInterfaceFn interfaceFactory, CreateInterfaceFn gameServerFactory){	playerinfomanager = (IPlayerInfoManager*)gameServerFactory(INTERFACEVERSION_PLAYERINFOMANAGER, NULL);	if (!playerinfomanager)		Warning("[Banz0r] Unable to load playerinfomanager. Ignoring...\n"); // this isn't fatal, we just won't be able to access specific player data	botmanager = (IBotManager*)gameServerFactory(INTERFACEVERSION_PLAYERBOTMANAGER, NULL);	if (!botmanager)		Warning("[Banz0r] Unable to load botcontroller. Ignoring...\n"); // this isn't fatal, we just won't be able to access specific bot functions	// get the interfaces we want to use	if(	!(engine = (IVEngineServer*)interfaceFactory(INTERFACEVERSION_VENGINESERVER, NULL)) ||		!(gameeventmanager = (IGameEventManager*)interfaceFactory(INTERFACEVERSION_GAMEEVENTSMANAGER, NULL)) ||		!(filesystem = (IFileSystem*)interfaceFactory(FILESYSTEM_INTERFACE_VERSION, NULL)) ||		!(helpers = (IServerPluginHelpers*)interfaceFactory(INTERFACEVERSION_ISERVERPLUGINHELPERS, NULL)) || 		!(enginetrace = (IEngineTrace*)interfaceFactory(INTERFACEVERSION_ENGINETRACE_SERVER, NULL)) ||		!(randomStr = (IUniformRandomStream*)interfaceFactory(VENGINE_SERVER_RANDOM_INTERFACE_VERSION, NULL))		)	{		return false; // we require all these interface to function	}	if (playerinfomanager)		gpGlobals = playerinfomanager->GetGlobalVars();	InitCVars(interfaceFactory); // register any cvars we have defined	MathLib_Init(2.2f, 2.2f, 0.0f, 2.0f);	char path[1000];	char buffer[1000];	engine->GetGameDir(path, 999);	for (int i = (int)strlen(path) - 1; i >= 0; i--)	{			if (path[i] == '/' || path[i] == '\\')			{				i++;				for (int x = 0; x < (int)strlen(path) + i; x++)				{					buffer[x] = path[x+i];				}				buffer[x + 1] = '\0';				break;			}	}	if (CStrEq(Buffer, "cstrike", 7))		m_bCSS = true;	else		m_bCSS = false;	/*if (CStrEq(Buffer, "hl2mp", 5))		GAMETYPE = 2;	else if (CStrEq(Buffer, "dod", 3))		GAMETYPE = 3;*/	// GameName = strdup(Buffer); // what is this for?	return true;}