Thread: CS:GO
View Single Post
Zephyrus
Cool Pig B)
Join Date: Jun 2010
Location: Hungary
Old 06-02-2012 , 15:32   Re: CS:GO
Reply With Quote #8

Quote:
Originally Posted by PMA.Predator View Post
Having a few problems on Load, The plugin is compiling (with quite a few warnings, I'll add those in too).

Basically, here's my load function:

Code:
bool CMatchAdmin::Load(    CreateInterfaceFn interfaceFactory, CreateInterfaceFn gameServerFactory )
{
    Msg("**************************************************************************************************\n");
    Msg("PMA ~ Loading (Version "PMAVersion", "PMAHost", "PMAAuthor") \n");
    Msg("**************************************************************************************************\n");
    Msg("S1\n");

    pEngine = (IVEngineServer*)interfaceFactory(INTERFACEVERSION_VENGINESERVER, NULL);
    pEvent = (IGameEventManager2*)interfaceFactory(INTERFACEVERSION_GAMEEVENTSMANAGER2,NULL);
    pHelpers = (IServerPluginHelpers*)interfaceFactory(INTERFACEVERSION_ISERVERPLUGINHELPERS, NULL);
    pEngineTrace = (IEngineTrace *)interfaceFactory(INTERFACEVERSION_ENGINETRACE_SERVER,NULL);
    pCvar = (ICvar*)interfaceFactory(CVAR_INTERFACE_VERSION, NULL);
    pPlayerManager = (IPlayerInfoManager*)gameServerFactory(INTERFACEVERSION_PLAYERINFOMANAGER,NULL);
    pBotManager = (IBotManager*)gameServerFactory(INTERFACEVERSION_PLAYERBOTMANAGER, NULL);
    pRandomGenerator = (IUniformRandomStream*)interfaceFactory(VENGINE_SERVER_RANDOM_INTERFACE_VERSION, NULL);
    pVoiceServer = (IVoiceServer*)interfaceFactory(INTERFACEVERSION_VOICESERVER,NULL);
    pGameDLL = (IServerGameDLL*)gameServerFactory(INTERFACEVERSION_SERVERGAMEDLL,NULL);
    pGameEnts = (IServerGameEnts*)gameServerFactory(INTERFACEVERSION_SERVERGAMEENTS,NULL);
    pServerTools = (IServerTools*)gameServerFactory(VSERVERTOOLS_INTERFACE_VERSION,NULL);
    g_pFullFileSystem = (IFileSystem*)interfaceFactory(FILESYSTEM_INTERFACE_VERSION,NULL);
    Msg("S2\n");

    if ( !pEngine ) { Msg("PMA ~ FATAL ERROR: IVEngineServer Failed\n"); return false; }
    if ( !pEvent ) {    Msg("PMA ~ FATAL ERROR: IGameEventManager2 Failed\n"); return false; }
    if ( !pHelpers ) { Msg("PMA ~ FATAL ERROR: IServerPluginHelpers Failed\n"); return false; }
    if ( !pEngineTrace ) { Msg("PMA ~ FATAL ERROR: IEngineTrace Failed\n"); return false; }
    if ( !pCvar ) { Msg("PMA ~ FATAL ERROR: ICvar Failed\n"); return false; }
    if ( !pPlayerManager ) { Msg("PMA ~ FATAL ERROR: IPlayerInfoManager Failed\n"); return false; }
    if ( !pBotManager ) {    Msg("PMA ~ FATAL ERROR: IBotManager Failed\n"); return false; }
    if ( !pRandomGenerator ) { Msg("PMA ~ FATAL ERROR: IUniformRandomStream Failed\n"); return false; }
    if ( !pVoiceServer ) { Msg("PMA ~ FATAL ERROR: IVoiceServer Failed\n"); return false; }
    if ( !pGameDLL ) { Msg("PMA ~ FATAL ERROR: IServerGameDLL Failed\n"); return false; }
    if ( !pGameEnts ) { Msg("PMA ~ FATAL ERROR: IServerGameEnts Failed\n"); return false; }
    if ( !pServerTools ) { Msg("PMA ~ FATAL ERROR: IServerTools Failed\n"); return false; }
    if ( !g_pFullFileSystem ) { Msg("PMA ~ FATAL ERROR: g_pFullFileSystem Failed\n"); return false; }
    Msg("S3\n");

    int iStartTime = gpGlobals->realtime;
    Msg("S4\n");

    ConnectTier1Libraries( &interfaceFactory, 1 );
    Msg("S5\n");
    ConnectTier2Libraries( &interfaceFactory, 1 );
    Msg("S6\n");

    MathLib_Init( 2.2f, 2.2f, 0.0f, 2.0f );
    Msg("S7\n");
    ConVar_Register( 0 );
    Msg("S8\n");

    gpGlobals = pPlayerManager->GetGlobalVars();
    Msg("S9\n");

    bool bFailed = false;
    // Check PMA folders 
    if ( !File.CheckDirectory("cfg/%s/", pCvar->FindVar("pma_basepath")->GetString()) ) bFailed = true;
    if ( !File.CheckDirectory("cfg/%s/configs/", pCvar->FindVar("pma_basepath")->GetString()) ) bFailed = true;
    if ( !File.CheckDirectory("cfg/%s/demos/", pCvar->FindVar("pma_basepath")->GetString()) ) bFailed = true;
    if ( !File.CheckDirectory("cfg/%s/logs/", pCvar->FindVar("pma_basepath")->GetString()) ) bFailed = true;
    if ( !File.CheckDirectory("cfg/%s/logs/admin", pCvar->FindVar("pma_basepath")->GetString()) ) bFailed = true;
    // Check PMA files
    if ( !File.CheckFile("cfg/%s/pma_server.cfg", pCvar->FindVar("pma_basepath")->GetString()) ) bFailed = true;
    if ( !File.CheckFile("cfg/%s/admins.txt", pCvar->FindVar("pma_basepath")->GetString()) ) bFailed = true;
    if ( !File.CheckFile("cfg/%s/bindconfigs.txt", pCvar->FindVar("pma_basepath")->GetString()) ) bFailed = true;
    if ( !File.CheckFile("cfg/%s/commands.txt", pCvar->FindVar("pma_basepath")->GetString()) ) bFailed = true;
    if ( !File.CheckFile("cfg/%s/configs.txt", pCvar->FindVar("pma_basepath")->GetString()) ) bFailed = true;
    if ( !File.CheckFile("cfg/%s/cvars.txt", pCvar->FindVar("pma_basepath")->GetString()) ) bFailed = true;
    if ( !File.CheckFile("cfg/%s/maplist.txt", pCvar->FindVar("pma_basepath")->GetString()) ) bFailed = true;
    if ( !File.CheckFile("cfg/%s/passwords.txt", pCvar->FindVar("pma_basepath")->GetString()) ) bFailed = true;
    // Check Autowar folders
    if ( !File.CheckDirectory("cfg/%s/", pCvar->FindVar("autowar_basepath")->GetString()) ) bFailed = true;
    if ( !File.CheckDirectory("cfg/%s/configs/", pCvar->FindVar("autowar_basepath")->GetString()) ) bFailed = true;
    // Check Autowar files
    if ( !File.CheckFile("cfg/%s/autowar_server.cfg", pCvar->FindVar("autowar_basepath")->GetString()) ) bFailed = true;
    Msg("S10\n");

    if ( bFailed ) return false;
    Msg("S11\n");

    // Execute plugin config files
    File.ExecuteConfig("%s/pma_server.cfg", pCvar->FindVar("pma_basepath")->GetString());
    File.ExecuteConfig("%s/autowar_server.cfg", pCvar->FindVar("autowar_basepath")->GetString());
    Msg("S12\n");
    // Load files into the system
    DataControl.LoadFromFiles();
    Msg("S13\n");

    // Register CVar listener
    pCvar->InstallGlobalChangeCallback( CVarChanged ); 
    Msg("S14\n");

    // Register CVars
    sv_pausable = pCvar->FindVar("sv_pausable");
    if (!sv_pausable) { Msg("PMA ~ FATAL ERROR: Failed to find CVAR sv_pausable\n"); return false; }
    sv_pausable_flags = sv_pausable->GetFlags();
    Msg("S15\n");

    // Load Autowar and Anti-Cheat modules
    PAC->Load();
    Msg("S16\n");
    PAM->Load();
    Msg("S17\n");

    Msg("**************************************************************************************************\n");
    Msg("PMA ~ Loaded (Time to load: %4.5f seconds)\n", (gpGlobals->realtime - iStartTime));
    Msg("**************************************************************************************************\n");
    return true;
}
It's crashing on the following lines:
Code:
int iStartTime = gpGlobals->realtime;
Code:
ConnectTier1Libraries( &interfaceFactory, 1 );
Code:
ConnectTier2Libraries( &interfaceFactory, 1 );
Code:
if ( !File.CheckDirectory("cfg/%s/", pCvar->FindVar("pma_basepath")->GetString()) ) bFailed = true;
I stopped here, I would comment out each line and see how much further in load it managed to get, but the fact it fails on so much so far makes me think I've probably done something very wrong!

Here's the warnings (They're replicated quite a bit on compile):
This first warning is here on source too, but it does load fine there.
Code:
Warning    1    warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc    C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\xlocale    342
From tier1.lib
Code:
Warning    26    warning LNK4099: PDB 'vc100.pdb' was not found with '..\..\lib\public\tier1.lib' or at 'c:\Users\Edmund-360\Desktop\hl2sdk-csgo-945f5a1e3e74\utils\serverplugin_sample\Release\vc100.pdb'; linking object as if no debug info    tier1.lib

Warning    15    warning LNK4229: invalid directive '/FAILIFMISMATCH:_ITERATOR_DEBUG_LEVEL=0' encountered; ignored    tier1.lib

Warning    20    warning LNK4229: invalid directive '/FAILIFMISMATCH:_MSC_VER=1600' encountered; ignored    tier1.lib
mathlib.lib
Code:
Warning    3    warning LNK4229: invalid directive '/FAILIFMISMATCH:_ITERATOR_DEBUG_LEVEL=0' encountered; ignored    mathlib.lib

Warning    11    warning LNK4229: invalid directive '/FAILIFMISMATCH:_ITERATOR_DEBUG_LEVEL=0' encountered; ignored    mathlib.lib

Warning    2    warning LNK4229: invalid directive '/FAILIFMISMATCH:_MSC_VER=1600' encountered; ignored    mathlib.lib
I'm using VS2008 to compile this
Any idea what's causing the problems?
- Edd
about gpGlobals, its probably not initialized at that point, about the interfaces you may have to change something since there was that interfaces library added
__________________
Taking private C++/PHP/SourcePawn requests, PM me.
Zephyrus is offline