Try it:
PHP Code:
#pragma semicolon 1
#define PLUGIN_AUTHOR "CamerDisco"
#define PLUGIN_VERSION "1.00"
#include <sourcemod>
#include <sdktools>
#include <cstrike>
#pragma newdecls required
public Plugin myinfo =
{
name = "Kill all CT bots when CT players died",
author = PLUGIN_AUTHOR,
description = "",
version = PLUGIN_VERSION,
url = "http://max-play.pl"
};
public void OnPluginStart()
{
HookEvent("player_death", DeathEvent);
}
public Action DeathEvent(Event event, const char[] name, bool dontBroadcast)
{
int number = CountCTAlive();
if(number < 1)
KillCTBots();
}
public void KillCTBots()
{
for (int i = 0; i <= MaxClients; i++)
if(IsValidClient(i) && IsFakeClient(i) && IsPlayerAlive(i) && GetClientTeam(i) == CS_TEAM_CT)
ForcePlayerSuicide(i);
}
stock int CountCTAlive()
{
int l = 0;
for (int i = 0; i <= MaxClients; i++)
if(IsValidClient(i) && !IsFakeClient(i) && GetClientTeam(i) == CS_TEAM_CT && IsPlayerAlive(i))
l++;
return l;
}
stock bool IsValidClient(int client)
{
if(client >= 1 && client <= MaxClients && IsClientInGame(client))
return true;
return false;
}
__________________