Thanks for your help. However I'm having some problems, namely:

void C_World::InstallGameRules()
{
        char mapN[64];
        V_FileBase( engine->GetLevelName( ), mapN, 64 );

        string  mapName = mapN;

   mapName = mapName.substr( 0, 3 );

   if (mapName == "dm_") // Classic SourceForts CTF
   {
          CreateGameRulesObject( "C_HL2MPRules" );
   }
   else if (mapName == "ctf_") // Core Run map
   {
          CreateGameRulesObject( "C_CTFRules" );
   }
   else if (mapName == "mbs_") // Conquest map
   {
          CreateGameRulesObject( "C_MBSRules" );
   }
   else
          CreateGameRulesObject( "C_HL2MPRules" );
}

I use following code, yet it gives me errors:

error C3861: 'CreateGameRulesObject': identifier not found

And some warning about malloc redefinition. I use #include <string> and
using std::string; .

--
[ Picked text/plain from multipart/alternative ]
Hi emiel,

For SourceForts, I use this : (i use hl2mp sdk)
In hl2mp_client.cpp :

//=========================================================
// instantiate the proper game rules object
//=========================================================
void InstallGameRules()
{
       std::string mapName = STRING( gpGlobals->mapname );

       mapName = mapName.substr( 0, 3 );

       if (mapName == "sf_") // Classic SourceForts CTF
       {
              CreateGameRulesObject( "CSFCTFGamerules" );
       }
       else if (mapName == "cr_") // Core Run map
       {
              CreateGameRulesObject( "CSFCRGamerules" );
       }
       else if (mapName == "cq_") // Conquest map
       {
              CreateGameRulesObject( "CHL2MPRules" );
       }
       else
              CreateGameRulesObject( "CSFCTFGamerules" );
}

InstallGamerules is already called automatically. Thought (note to
valve) it
seems client side the networktable is not updated for gamerules object.So
 when it's creating a new one server side, client side it remains the
old one. So you'll have to make the samefunction client side
in C_World::Precache( ) and use

char mapN[64];
V_FileBase( engine->GetLevelName( ), mapN, 64 );

std::string mapName = mapN;
mapName = mapName.substr( 0, 3 );

instead of std::string mapName = STRING( gpGlobals->mapname );
I hope I helped you.

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to