View Full Version : BotClient_CS_HLTV in HPB_template 4 does not work !
Rifleman
07-11-2004, 13:01
void BotClient_CS_HLTV(void *p, int bot_index)
{
static int state = 0; // current state machine state
static int players;
int index;
if (state == 0)
players = *(int *) p;
else if (state == 1)
{
// new round in CS 1.6
if ((players == 0) && (*(int *) p == 0))
{
for (index = 0; index < 32; index++)
{
if (bots[index].is_used)
BotSpawnInit (&bots[index]); // reset bots for new round
}
}
}
}
NOTE : This code does not work ! I have try it for many times ! Why this happen , please help me to fix this error !:'(
I't might help a bit if you would tell as what error&warning messages do you get ;)
Rifleman
07-11-2004, 16:49
void BotClient_CS_HLTV(void *p, int bot_index)
{
static int state = 0; // current state machine state
static int players;
int index;
if (state == 0)
players = *(int *) p;
else if (state == 1)
{
// new round in CS 1.6
if ((players == 0) && (*(int *) p == 0))
{
for (index = 0; index < 32; index++)
{
if (bots[index].is_used)
{
BotSpawnInit (&bots[index]); // reset bots for new round
PrintMessage("Round ended\n");
}
}
}
}
}
Okay okay , when I put a PrintMessage function (the function print some kind of text to a file) , I found that the botspawninit are not called for the bot , I dont know why , but I think the problem comes from the code since I sure that there are no problem with the function code
Pierre-Marie Baty
07-11-2004, 20:29
If you log the HLTV messages to a file with the packet details, especially the values for the 2 first packets (state = 0 and state = 1), you will figure out your problem more easily. Maybe the HLTV message changed recently in Counter-Strike.
Sending HLTV messages to players at each start of a new round is very CS specific, also.
Rifleman
08-11-2004, 06:25
Bug FIXED !!! w00t w00t !!!8D
First , I checked the engine function , the hltv is not sent with a edict.But why in hpb_template 4 , the
else if (msg_type == message_HLTV)
botMsgFunction = BotClient_CS_HLTV;
is under the if (ed) , I changed its position to
if (msg_type == message_WeaponList)
botMsgFunction = BotClient_CS_WeaponList;
else if (msg_type == message_HLTV)
botMsgFunction = BotClient_CS_HLTV;
and the bot dll intercept the hltv message correctly , then we come to the function code itself :
void BotClient_CS_HLTV(void *p, int bot_index)
{
static int state = 0; // current state machine state
static int players = 0;
int index;
if (state == 0)
{
players = *(int *) p; // check the byte
state++;
}
else if (state == 1)
{
if (players == 0)
{
for (index = 0; index < 32; index++)
{
if (bots[index].is_used)
{
BotSpawnInit (&bots[index]);
}
}
}
state = 0;
}
}
I changed the original code to the above one , and the result ? It worked ! w00t w00t !!! 8D
Pierre-Marie Baty
08-11-2004, 17:16
Thanks for the hint then, I will change the HPB_bot template ASAP. It's for Counter-Strike, right ? Not for Hostile Intent or anything ?
Rifleman
08-11-2004, 17:20
yes , its for cs , I want to try my luck in cs :D
I hope sourceforge will not reject my project :(
vBulletin® v3.7.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.