View Single Post
nikooo777
AlliedModders Donor
Join Date: Apr 2010
Location: Lugano, Switzerland
Old 07-04-2021 , 14:30   Re: [CS:S/CS:GO] Bot Attack Control
Reply With Quote #72

Alright so I ended up compiling my own version for CS:S again, I wrote a simple plugin against it and for whatever reason it's not working as intended. Am I doing something wrong or is the extension bugged?


Here is the dumbed down code (see attached for full source)
PHP Code:
public Action OnShouldBotAttackPlayer(int botint playerbool &result)
{
    if (!
IsPlayerAlive(player) || !IsPlayerAlive(bot))
    {
        return 
Plugin_Continue;
    }
    
bool isBotZombie ZR_IsClientZombie(bot);
    
bool isTargetZombie ZR_IsClientZombie(player);
    if (
isBotZombie != isTargetZombie)
    {
        if (!
result)
        {
            
result true;
        }
        return 
Plugin_Changed;
    }
    
result false;
    return 
Plugin_Changed;

And this is what I end up seeing in console:
Code:
Reaper (2) wants to attack Cabbie (2)
Cabbie (2) wants to attack Reaper (2)
With both bots being Zombies.

It makes no sense as the plugin correctly detects that they're both on the same team and sets the result to false, yet they still end up stabbing each other non stop. What am I doing wrong?
Attached Files
File Type: sp Get Plugin or Get Source (zm_bots.sp - 156 views - 1.1 KB)
__________________

Last edited by nikooo777; 07-04-2021 at 14:32.
nikooo777 is offline