.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   HPB_bot (http://forums.bots-united.com/forumdisplay.php?f=35)
-   -   BotClient_CS_HLTV in HPB_template 4 does not work ! (http://forums.bots-united.com/showthread.php?t=2931)

Rifleman 07-11-2004 12:01

BotClient_CS_HLTV in HPB_template 4 does not work !
 
Code:

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 !:'(

sten 07-11-2004 13:29

Re: BotClient_CS_HLTV in HPB_template 4 does not work !
 
I't might help a bit if you would tell as what error&warning messages do you get ;)

Rifleman 07-11-2004 15:49

Re: BotClient_CS_HLTV in HPB_template 4 does not work !
 

Code:

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 19:29

Re: BotClient_CS_HLTV in HPB_template 4 does not work !
 
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 05:25

Re: BotClient_CS_HLTV in HPB_template 4 does not work !
 
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

Code:

                        else if (msg_type == message_HLTV)
                                botMsgFunction = BotClient_CS_HLTV;

is under the
Code:

if (ed)
, I changed its position to

Code:

                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 :

Code:

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 16:16

Re: BotClient_CS_HLTV in HPB_template 4 does not work !
 
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 16:20

Re: BotClient_CS_HLTV in HPB_template 4 does not work !
 
yes , its for cs , I want to try my luck in cs :D

I hope sourceforge will not reject my project :(


All times are GMT +2. The time now is 02:57.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.