Hello i have a timer for my script to choose a random ct but want i timer for swap all player in Terrorist.
If you can help me
Code:
#include <sourcemod>
#include <cstrike>
#include <sdktools>
public void OnPluginStart()
{
HookEvent("round_end", round_end);
}
public Action round_end(Handle event, const char[] name, bool dontbroadcast)
{
ServerCommand("mp_autoteambalance 0");
new ctone = GetRandomPlayer();
CreateTimer(2.0, goct, ctone);
for (new i = 1; i <= MaxClients; i++)
{
ChangeClientTeam(i, CS_TEAM_T);
}
}
public Action goct(Handle timer, ctone)
{
ChangeClientTeam(ctone, CS_TEAM_CT);
}
GetRandomPlayer()
{
new clients[MaxClients+1], clientCount;
for (new i = 1; i <= MaxClients; i++)
if (IsClientInGame(i) && GetClientTeam(CS_TEAM_T))
clients[clientCount++] = i;
return (clientCount == 0) ? -1 : clients[GetRandomInt(0, clientCount-1)];
}