havent checked that yet but you can try to see if it works
Code:
#include <sourcemod>
#include cstrike.inc
public Plugin myinfo =
{
name = "switch the worst player each round",
author = "ofeksh1236",
description = "switch the worst",
version = "1.0",
url = ""
};
public OnPluginStart()
{
HookEvent("round_end",switch_weakest);
}
public Action switch_weakest(Event event, const char[] name, bool dontBroadcast)
{
int places[32];
int p=0;
int worst_T_score=100;
int worst_CT_score=100;
int worst_T_place=1;
int worst_CT=100;
int worst_CT_place=1;
int players_spectating=0;
for (new i = 1; i <= MaxClients; i++)
{
if (CS_GetClientContributionScore(i)<worst_T_score&&GetClientTeam(i)==2)
{
worst_T_place=i;
}
if (CS_GetClientContributionScore(i)<worst_CT_score&&GetClientTeam(i)==3)
{
worst_CT_place=i;
}
if (GetClientTeam(i)==1)
{
players_spectating++;
places[p]=i;
p++;
}
}
if(players_spectating==0)
{
return Plugin_Handled;
}
if (players_spectating==2)
{
ChangeClientTeam(worst_T_place,1);
ChangeClientTeam(worst_CT_place,1);
ChangeClientTeam(places[0],2);
ChangeClientTeam(places[1],3);
return Plugin_Handled;
}
if (players_spectating==1)
{
ChangeClientTeam(worst_T_place,1);
ChangeClientTeam(places[0],2);
return Plugin_Handled;
}
return Plugin_Handled;
}
edit: it only works atm if you have allready people in spectate and will allways replace the same people unless they get their scores reseted (which i didnt know if you want)