View Single Post
Re: new CS update screws up intercepting chat messages!?
Old
  (#24)
Whistler
Summoner
 
Whistler's Avatar
 
Status: Offline
Posts: 1,499
Join Date: Feb 2004
Location: Mist Village
Default Re: new CS update screws up intercepting chat messages!? - 21-06-2004

Code:
void ClientCommand( edict_t *pEntity )
{
   const char *pcmd = CMD_ARGV(0);
   const char *arg1 = CMD_ARGV(1);

   static int iFillServerTeam = 5;

   if (isFakeClientCommand == 0)
   {
      if (FStrEq(pcmd, "say") || FStrEq(pcmd, "say_team"))
      {
         bool bAlive = IsAlive(pEntity);
         int iTeam = -1;
         if (FStrEq(pcmd, "say_team"))
            iTeam = UTIL_GetTeam(pEntity);

         for (int i = 0; i < gpGlobals->maxClients; i++)
         {
            if (!ThreatTab[i].IsUsed ||
               (iTeam != -1 && iTeam != ThreatTab[i].iTeam) ||
               bAlive != IsAlive(ThreatTab[i].pEdict))
               continue;
            CBaseBot *pBot = g_rgpBots[i];
            if (pBot)
            {
               pBot->m_SaytextBuffer.iEntityIndex = ENTINDEX(pEntity);
               strcpy(pBot->m_SaytextBuffer.szSayText, CMD_ARGS());
               pBot->m_SaytextBuffer.fTimeNextChat = gpGlobals->time + pBot->m_SaytextBuffer.fChatDelay;
            }
         }
      }
I prefer this one since it's much simpler, and the POD-Bot already has code to deal with what bots said.
The only problem is it won't catch other bots' messages if other bots use botman's chat code.
  
Reply With Quote