Raised This Month: $51 Target: $400
 12% 

[req] weakest round player in spectators


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PoW3rKj
Junior Member
Join Date: Sep 2015
Old 08-19-2017 , 08:30   [req] weakest round player in spectators
Reply With Quote #1

A plugin for my retake server that every round replace the weakest player with a spectator.

I saw a plugin like this in a ESEA retake server.

Thanks for answering/helping!
PoW3rKj is offline
ofek1236
Junior Member
Join Date: Jul 2017
Old 08-27-2017 , 19:52   Re: [req] weakest round player in spectators
Reply With Quote #2

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)

Last edited by ofek1236; 08-27-2017 at 22:20.
ofek1236 is offline
OSWO
Senior Member
Join Date: Jul 2015
Location: United Kingdom, London
Old 08-28-2017 , 10:11   Re: [req] weakest round player in spectators
Reply With Quote #3

Define "weakest" player. Weakest player in a round, or weakest player in all rounds collectively. Cause if you're on 0 points, get swapped in against people who already have 20 points+ you'll always get swapped back to spec since you can never reach their score.
__________________
SourceTimer | WeaponSkins++ | BasePlugins++ https://github.com/OSCAR-WOS
OSWO is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:32.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode