Can u guys say me why this is not working?
It should swap a player to CT if there are more Terrorists than the sm_max_terror says.
Code:
#include <sourcemod>
new Handle:g_CvarIgnoreTeamChange = INVALID_HANDLE;
new Handle:g_CvarMax_Terror = INVALID_HANDLE;
public OnPluginStart()
{
g_CvarIgnoreTeamChange = CreateConVar("sm_ignoreteamchange", "0","Ein- oder Ausschalten!");
g_CvarMax_Terror = CreateConVar("sm_max_terror", "1","Maximale Anzahl Terroristen");
AutoExecConfig(true, "TeamLimiter");
}
public Action:Event_PlayerTeam(Handle:event, const String:name[], bool:dontBroadcast)
{
PrintToChatAll("Jemand ist zu T gegangen!");
new client = GetClientOfUserId(GetEventInt(event, "userid"));
new team2 = GetEventInt(event, "team");
new team;
new team3;
for(new i=1;i<=MaxClients;++i)
{
if(IsClientInGame(i) && i != client)
{
team = GetClientTeam(i);
if(team == 2)
{
team3=team3+1;
}
}
}
if(!GetConVarBool(g_CvarIgnoreTeamChange))
{
if(team2 == 2)
{
if(GetConVarInt(g_CvarMax_Terror)<team3)
{
ChangeClientTeam(client, 3);
}
}
}
return Plugin_Continue;
}