Thank for the quick reply Pierre, but I did not found any ServerActivate(), do you mean the StartFrame () ? If yes here is the code :
Quote:
void StartFrame( void )
{
if (gpGlobals->deathmatch)
{
edict_t *pPlayer;
static int i, index, player_index, bot_index;
static float previous_time = -1.0;
char msg[256];
int count;
// if a new map has started then (MUST BE FIRST IN StartFrame)...
if ((gpGlobals->time + 0.1) < previous_time)
{
char filename[256];
char mapname[64];
// check if mapname_bot.cfg file exists...
strcpy(mapname, STRING(gpGlobals->mapname));
strcat(mapname, "_HPB_bot.cfg");
UTIL_BuildFileName(filename, "maps", mapname);
if ((bot_cfg_fp = fopen(filename, "r")) != NULL)
{
sprintf(msg, "Executing %s\n", filename);
ALERT( at_console, msg );
for (index = 0; index < 32; index++)
{
bots[index].is_used = FALSE;
bots[index].respawn_state = 0;
bots[index].f_kick_time = 0.0;
}
if (IsDedicatedServer)
bot_cfg_pause_time = gpGlobals->time + 5.0;
else
bot_cfg_pause_time = gpGlobals->time + 20.0;
}
else
{
count = 0;
// mark the bots as needing to be respawned...
for (index = 0; index < 32; index++)
{
if (count >= prev_num_bots)
{
bots[index].is_used = FALSE;
bots[index].respawn_state = 0;
bots[index].f_kick_time = 0.0;
}
if (bots[index].is_used) // is this slot used?
{
bots[index].respawn_state = RESPAWN_NEED_TO_RESPAWN;
count++;
}
// check for any bots that were very recently kicked...
if ((bots[index].f_kick_time + 5.0) > previous_time)
{
bots[index].respawn_state = RESPAWN_NEED_TO_RESPAWN;
count++;
}
else
bots[index].f_kick_time = 0.0; // reset to prevent false spawns later
}
// set the respawn time
if (IsDedicatedServer)
respawn_time = gpGlobals->time + 5.0;
else
respawn_time = gpGlobals->time + 20.0;
}
bot_check_time = gpGlobals->time + 60.0;
}
|
It did run this StartFrame when start a new map but not anymore for the next map, Pierre could you have a quick look to see what problem of this code ?
PS: this code is from HPB_Bot 4.0 and I didn't change it at all, thank.