Hello, I can't seem to get this working correctly.. I think I done it wrong
PHP Code:
public Action:OnShouldBotAttackPlayer(bot, player, &bool:result)
{
for(new i = 1; i <= MaxClients; i++)
{
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( !IsFakeClient( client) )
{
isKillProtected[client] = true;
lastPlayerHealth[client] = Entity_GetHealth(client);
Entity_SetHealth(client, PROTECTED_HEALTH, true);
CreateTimer(GetConVarFloat(zr_protect_time), Timer_DisableSpawnProtection, client, TIMER_FLAG_NO_MAPCHANGE);
}
}
}
DisableKillProtection(client)
{
isKillProtected[client] = false;
isSpawnKillProtected[client] = false;
Entity_SetHealth(client, lastPlayerHealth[client], true);
PrintHintText(client, "[WARNING] Spawn Protection is now OFF!");
}