View Single Post
SM9
Veteran Member
Join Date: Sep 2013
Location: United Kingdom
Old 09-15-2013 , 17:57   Re: [CS:S/CS:GO] Bot Attack Control
Reply With Quote #24

Hello, I can't seem to get this working correctly.. I think I done it wrong

PHP Code:
public Action:OnShouldBotAttackPlayer(botplayer, &bool:result)
{
    
    for(new 
1<= MaxClientsi++)
    {
        if(
Client_IsValid(i))
        {
            if(
IsFakeClient(i))
            {
                
bot i;
            }
            else
            {
                
player i;
                
                if(
isSpawnKillProtected[player] == true){
                    
result false;
                }
                else
                {
                    
result true;
                }
            }
        }
    }

I'm trying to make all bots not attack players with the bool isSpawnKillProtected true. And when it goes false then attack again.

PHP Code:
EnableKillProtection(client
{
    if(
Client_IsValid(client))
    {
        if( !
IsFakeClientclient) )
        {
            
isKillProtected[client] =  true;
            
lastPlayerHealth[client] = Entity_GetHealth(client);
            
Entity_SetHealth(clientPROTECTED_HEALTHtrue);
            
            
CreateTimer(GetConVarFloat(zr_protect_time), Timer_DisableSpawnProtectionclientTIMER_FLAG_NO_MAPCHANGE);
        }
    }
}

DisableKillProtection(client)
{    
    
isKillProtected[client] =  false;
    
isSpawnKillProtected[client] = false;
    
Entity_SetHealth(clientlastPlayerHealth[client], true);
    
    
PrintHintText(client"[WARNING] Spawn Protection is now OFF!");

SM9 is offline