View Single Post
pfnAddServerCommand
Old
  (#1)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default pfnAddServerCommand - 24-12-2003

Okay, so i have been diggin into this piece of junk I have this code, and it does not work in CS 1.5 listen server or dedicated server. I issue the command:

rbcm rb_addbot

which should add a bot

ps. do not mind the CVAR_REGISTER function....
Code:
// SERVER Command: RealBot
void rbcm ( void )
{
    const char *pcmd = Cmd_Argv(0);
    const char *arg1 = Cmd_Argv(1);
    const char *arg2 = Cmd_Argv(2);
    const char *arg3 = Cmd_Argv(3);
    const char *arg4 = Cmd_Argv(4);

    edict_t *pEntity = listenserver_edict; //
      
    // Handle command here
    if (FStrEq(pcmd, "rb_addbot"))
    {
        Game.CreateBot( pEntity, arg1, arg2, arg3, arg4 );
        bot_check_time = gpGlobals->time + 5.0;
        return;
    }

    return;
}


void GameDLLInit( void )
{

   CVAR_REGISTER (&sv_bot);

   for (int i=0; i<32; i++)
      clients[i] = NULL;   

   // initialize the bots array of structures...
   memset(bots, 0, sizeof(bots));

   Game.LoadNames();
   Game.LoadChat();
   Game.LoadBuyTable();

   // NodeMachine
   NodeMachine.init(); // INIT on load up
   NodeMachine.init_players();

   // Register server command
   (*g_engfuncs.pfnAddServerCommand)( "rbcm", rbcm ); 

   (*other_gFunctionTable.pfnGameInit)();
}
  
Reply With Quote