AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   how to hook primammo for bot? (https://forums.alliedmods.net/showthread.php?t=333593)

Leech_v2 07-23-2021 22:06

how to hook primammo for bot?
 
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;
}


Leech_v2 07-24-2021 01:48

Re: how to hook primammo for bot?
 
amx1.9.3

Leech_v2 07-24-2021 05:16

Re: how to hook primammo for bot?
 
Is this not allowed?


All times are GMT -4. The time now is 02:37.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.