#include <cstrike>
#include <sdktools_functions>
public Plugin:myinfo =
{
name = "HalfTime Replacer",
author = "Danyas / AlmazON"
}
new iNumRound;
new iTargRound;
public OnPluginStart()
{
decl Handle:hRounds;
if ((hRounds = FindConVar("mp_maxrounds")) == INVALID_HANDLE) SetFailState("somethink wrong");
HookEvent("round_end", Event_Round_End, EventHookMode_PostNoCopy);
iTargRound = GetConVarInt(hRounds) / 2;
HookConVarChange(hRounds, Change_CvarRounds);
}
public Change_CvarRounds(Handle:hRounds, String:oldValue[], String:newValue[]) iTargRound = GetConVarInt(hRounds) / 2;
public OnConfigsExecuted() iNumRound = 0;
public Event_Round_End(Handle:event, const String:name[], bool:dontBroadcast)
{
if (++iNumRound == iTargRound)
{
decl i;
for (i = 1; i <= MaxClients; ++i)
{
if (IsClientInGame(i))
{
switch (GetClientTeam(i))
{
case 3:
{
CS_SwitchTeam(i, 2);
//PrintToChat(i, "Вы перемещены за команду Т.");
}
case 2:
{
CS_SwitchTeam(i, 3);
//PrintToChat(i, "Вы перемещены за команду КТ.");
}
}
PrintCenterText(i, "Смена сторон!");
PrintToChat(i, "Смена сторон!");
}
}
SetTeamScore(2, i = GetTeamScore(3));
CS_SetTeamScore(2, i);
SetTeamScore(3, i = GetTeamScore(2));
CS_SetTeamScore(3, i);
}
}