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.