#include <sourcemod>
#include <sdktools>
#include <cstrike>
public OnPluginStart()
{
HookEvent("player_team", EventTeam);
HookEvent("player_death",EventDeath);
}
public Action:EventTeam(Handle:Event, const String:Name[], bool:Broadcast)
{
new Client = GetClientOfUserId(GetEventInt(Event, "userid"));
new Team = GetEventInt(Event, "team");
if(Team == 2)
{
if(GetTeamClientCount(2) >= 2)
{
CS_SwitchTeam(Client, 1)
PrintToChat(Client, "\x04[Melong]\x03 T가 꽉 찼습니다.");
}
}
}
public Action:EventDeath(Handle:event,const String:name[],bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event,"userid"));
new attackerId = GetEventInt(event, "attacker");
new attacker = GetClientOfUserId(attackerId);
if (client != 0 && attacker != 0)
{
if (GetClientTeam(client) == 2)
{
new tplayers = GetTeamClientCount(2);
if (tplayers == 1)
{
CS_SwitchTeam(client, 3)
CS_SwitchTeam(attacker, 2)
}
}
}
}