CS_InternalCommand and client_command is not work for bot.
I want to break "ammo1", "ammo2", "primammo", "secammo" command for czbot.
Code:
static cell AMX_NATIVE_CALL client_cmd(AMX *amx, cell *params) /* 2 param */
{
int len;
char* cmd = format_amxstring(amx, params, 2, len);
cmd[len++] = '\n';
cmd[len] = 0;
if (params[1] == 0)
{
for (int i = 1; i <= gpGlobals->maxClients; ++i)
{
CPlayer* pPlayer = GET_PLAYER_POINTER_I(i);
if (!pPlayer->IsBot() && pPlayer->initialized /*&& pPlayer->ingame*/)
CLIENT_COMMAND(pPlayer->pEdict, "%s", cmd);
}
} else {
int index = params[1];
if (index < 1 || index > gpGlobals->maxClients)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index);
return 0;
}
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
if (!pPlayer->IsBot() && pPlayer->initialized /*&& pPlayer->ingame*/)
CLIENT_COMMAND(pPlayer->pEdict, "%s", cmd);
}
return len;
}