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

DM Team Balance


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Server Management       
Chill it BanG
Junior Member
Join Date: Nov 2013
Location: Latvia
Old 03-18-2014 , 09:52   DM Team Balance
Reply With Quote #1

DM Team Balance
Simple team balance plugin for deathmatch
Current version: 1.44b


What it does?
It balances teams in deathmatch game. Seems legit.

But... why?
Ok, at first, I know that there is plugin called "CSDM Team balance" or somthing like that.
It works by counting deaths. Frankly, I realised that it is not the best way to quickly balance teams, because of time that is needed to start balance.
That is why I made this plugin!

OK, what is the difference?
Firstly - this plugin checks count of players everytime when players disconnect or everytime new round begins (if there ar 1 player versus many players, it happens very often) and if teams are not well balanced it transfers one, randomly chosen, player to weakest team. I belive that detecting disconect is a bit better, but, frankly, I think I will improve this plugin somehow, so teams could be checked more often.
Secondly - there is an admin command to manually start algorythm to switch players to weakst team
Last, but not least - chat command to check if balance is needed (can be dissabled by cvar)

Where it can be used?
I tested this plugin in surf server,that had auto respawn, so I guess it can be used as well as in GunGame, as in CSDM (Have not tested, but it should work...)
But, if you want, you can put in server that doesn`t have respawn, just remember that transfer will happen while player is alive and possible standing next to his ex-teammates OR enable respawn on transfer!

Have something more to say?
Emm, yeah, it also prints colored chat messages with information about player being transfered, e.t.c. No worries, they are not p0k3-colored.
What else, frankly, this is my second plugin, so, go on - tell everything that I could do better!

Can this plugin do tricks?
Well, since it is not old dog it learns new tricks very quickly. Every next verison has bunch of new "tricks"
For instance,
* it can, respawn player when it is transfered, useful if you hate when transfered players steals ex-teams flag (CTF) or even stabs ex-teammates (GG).
* It can also limit team joinment, if you are not sure how to set up mp_limitteams cvar that is included in game and other tricks
* Checks if team balance is needed if someone leaves or goes to spectator

Commands
* say /balance (starts balance... NOTE: if there is enough players (dmb_minplayers) AND can be dissabled by dmb_saybalance)
* dmb_balance (starts balance... NOTE: Admin only (ADMIN_KICK) AND if there is enough players (dmb_minplayers) )

Cvars
dmb_saybalance - (1) enables / (0) disables "say /balance" command (default 1)
dmb_minplayers - Players needed to start balance (default 2)
dmb_roundstarttime - Time (seconds) after round start when team balance can be checked (deafult 10)
dmb_printinchat - (1) enables / (0) disables chat announcments (default 1)
dmb_printincenter - (1) enables / (0) disables screen center messages (default 1)
dmb_printincons - (1) enables / (0) disables console debug informationm shouldn`t be used if plugin since it has bunch of messages (default 0)
dmb_teamlimit - (1) enables / (0) disables team limit. It forces player to join to the weakest team
dmb_respawn - (1) enables / (0) disables respawn after transfer - so players won`t grab ex-team flag (CTF) or stab ex-teammates (GG) (defualt 0)
dmb_infodelay - Time in seconds. How often is "[DMB] Opponents team has more players than yours? Type '/balance' in chat to fix it!" message showed. If less than 20 or "dmb_saybalance 0" - disabled (default 120)
dmb_playsound - (1) enables / (0) disables sound on transfer. Sound is just like "beep" (default 1)
dmb_fadescreen - (1) enables / (0) disables transparent screen fade in color of players new team. Only for transfered player (default 1)
dmb_botimunity - (1) enables / (0) disables Bot immunity, so bots are not included in team checks/ transfers (default 1)
dmb_version - shows version of plugin, you shouldn`t touch this...

Changelog
v1.44b -
* Since I have abondoned CS1.6 and most of game scripting related stuff, not tested and postfixed as beta
* Add dmb_botimunity cvar

v1.43 -
* Fixed "U_R_CT" ML message, why anyone told me about it?
* Little optimization.

v1.41 -
* Added ML support, now you can translate messages into your language and switch them with amx_langmenu! Just edit DM_Balance.txt file.

v1.4 -
* Again, fixed bugs in teamlimit part
* Added sound on tranfer for transfered player (dmb_playsound)
* Added transparent screen fade on transfer for transferd player, in color of his/her new team (dmb_fadescreen)
* Added notification of "say /balance" command:"[DMB] Opponents team has more players than yours? Type '/balance' in chat to fix it!"
(dmb_infodelay). NOTE: if less than 20, it is turned off, and, no, this is not related to "dmb_printinchat"


Older...
Spoiler

To do list
* Add team limit
* Add cvars for game announcments
* Add option to print useful info in console, mostly info for debbuging.
* Add option to respawn player after transfer
* Make better way to search for random player
* "Louder" announcments when player gets transfered, like sound or HUD message
* ML support
* Smart balance, that transfers strongest players to weakest team (some day)


Credits Since I am just begginer (:
* Most of code used in team limit part is taken from ConnorMcLeod, from thread -https://forums.alliedmods.net/showthread.php?t=63818
Thanks to
* DonKisgot (https://forums.alliedmods.net/member.php?u=100584) for great ideas and feedback

More than 250 downloads for previous versions.
DM_Balance.txt goes on data/lang folder. DM_balance.amxx on plugins folder... as always plugins do
Attached Files
File Type: txt DM_balance.txt (358 Bytes, 820 views)
File Type: sma Get Plugin or Get Source (DM_balance.sma - 1833 views - 19.5 KB)
File Type: sma Get Plugin or Get Source (DM_balance._1_44b.sma - 1528 views - 20.0 KB)
__________________
Author of deathrun_ezyKore / fy_NewWorldOrder and some other maps

Last edited by Chill it BanG; 04-03-2016 at 16:52. Reason: Added 1.44b
Chill it BanG is offline
DonKisgot
Senior Member
Join Date: Dec 2010
Old 03-18-2014 , 16:58   Re: DM Team Balance
Reply With Quote #2

Hi,

first of all thank you for releasing this plugin. Why I thanked? Because other team balance plugins that you mentioned now they are become "not supported" because of their owners left this forum. (PTB Team Balance for ex.)

So we need other team balancer plugin that can be supported. So first of all ı have CTF (Capture the flag) server , so in CTF there is "NO ROUND" , players respawned after death... So all of other plugins stop working after first round or just making balance once.

I'm gonna test it , and report you back my results.

Suggestions ;

will you please add teamlimit ?

if there is 15T and 14CT so make the player who joined the server forcing to team CT.

Also can you please make chat messages via cvar ? the last thing we CTF users need is more chat messeges.

Thanks.
DonKisgot is offline
tonykaram1993
Senior Member
Join Date: Mar 2013
Location: This World
Old 03-18-2014 , 18:30   Re: DM Team Balance
Reply With Quote #3

PHP Code:
//changes used_say to false...
public say_false(){
used_say false
}
//changes say to true
public say_true(){
used_say true

Can be written as:
PHP Code:
public say_truebool:value true ) {
    
used_say value;

Note: this changes nothing more than readability

------------------------------------------

Also you can cache the value of the cvars that way you do not retrieve the value each time you want to check for it's value.

-----------------------------------------

You should state that this plugin will only run amxmodx 1.8.3 (dev builds) as it contains client_print_color that does not exist is amxmodx 1.8.2.

-----------------------------------------

Use a better system to indent your code. Your indent technique is not consistent and might confuse the readers.

-----------------------------------------

I don't understand why you are delaying the get_pcount for 10 seconds after round start. Can you please explain?
__________________
My Plugins:
UltimatePlugin
UltimateSurf
UltimateAdmin
Code:
rcon version | rcon amxx version | rcon meta version
rcon amxx plugins | rcon meta list | rcon status
I AM INACTIVE ON THIS FORUM - For direct contact: [email protected]

Last edited by tonykaram1993; 03-18-2014 at 18:31.
tonykaram1993 is offline
Chill it BanG
Junior Member
Join Date: Nov 2013
Location: Latvia
Old 03-19-2014 , 03:04   Re: DM Team Balance
Reply With Quote #4

Quote:
Originally Posted by DonKisgot View Post
Hi,

So we need other team balancer plugin that can be supported. So first of all ı have CTF (Capture the flag) server , so in CTF there is "NO ROUND" , players respawned after death... So all of other plugins stop working after first round or just making balance once.

I'm gonna test it , and report you back my results.

Suggestions ;

will you please add teamlimit ?

if there is 15T and 14CT so make the player who joined the server forcing to team CT.

Also can you please make chat messages via cvar ? the last thing we CTF users need is more chat messeges.

Thanks.
It should work for you, anyway I would be glad if you report results!
Teamlimit? Good idea, I will try to make it and add it in next version. The same for chat messages.
Thanks for ideas!

Quote:
Originally Posted by tonykaram1993 View Post
PHP Code:
public say_truebool:value true ) {
    
used_say value;

Note: this changes nothing more than readability

------------------------------------------

Also you can cache the value of the cvars that way you do not retrieve the value each time you want to check for it's value.

-----------------------------------------

You should state that this plugin will only run amxmodx 1.8.3 (dev builds) as it contains client_print_color that does not exist is amxmodx 1.8.2.

-----------------------------------------

Use a better system to indent your code. Your indent technique is not consistent and might confuse the readers.

-----------------------------------------

I don't understand why you are delaying the get_pcount for 10 seconds after round start. Can you please explain?
1. Ok, I will add it in next version
2. Hmm, ok, will search how to
3. Ou,in server that I used for testing it was working, didn`t thought about it, well I will make it 1.8.2 compatible
4. I agree, it is really messed up and confusing, I will do my best to make it easier to read!
5. Because, if there was not delay, player would be in deep trouble when round starts, when all his ex-teammates would attack him/her, I think, I will add cvar for that, since it might be useless in some servers.

Thanks!
__________________
Author of deathrun_ezyKore / fy_NewWorldOrder and some other maps
Chill it BanG is offline
tonykaram1993
Senior Member
Join Date: Mar 2013
Location: This World
Old 03-19-2014 , 07:06   Re: DM Team Balance
Reply With Quote #5

Quote:
Originally Posted by Chill it BanG View Post
5. Because, if there was not delay, player would be in deep trouble when round starts, when all his ex-teammates would attack him/her, I think, I will add cvar for that, since it might be useless in some servers.
After changing his team, you can make him respawn in his team's spawn point.
__________________
My Plugins:
UltimatePlugin
UltimateSurf
UltimateAdmin
Code:
rcon version | rcon amxx version | rcon meta version
rcon amxx plugins | rcon meta list | rcon status
I AM INACTIVE ON THIS FORUM - For direct contact: [email protected]
tonykaram1993 is offline
Chill it BanG
Junior Member
Join Date: Nov 2013
Location: Latvia
Old 03-19-2014 , 11:13   Re: DM Team Balance
Reply With Quote #6

New verison awailable, as beta. Made quick test, everything seems to work fine.

So...
--ChangeLog
v1.2 -
* Added teamlimit, that forces to join the weakest team (dmb_teamlimit)
* Added cvar to control time after round start when balance is checked
* Added cvars to enable / disable chat announcments
* Little code optimization
* Removed ColorChat, since client_print_color is not awailable in amxx 1.8.2
* Improved system to indent code, well I feel like I suck at it

Quote:
Originally Posted by tonykaram1993 View Post
After changing his team, you can make him respawn in his team's spawn point.
I don`t want to respawn player because he will lose weapon, unless I use some kind of teleport...
But good idea, I will work for it, it could be helpful in some mods ;)
__________________
Author of deathrun_ezyKore / fy_NewWorldOrder and some other maps

Last edited by Chill it BanG; 03-19-2014 at 11:26.
Chill it BanG is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 03-19-2014 , 13:37   Re: DM Team Balance
Reply With Quote #7

What about if a round end doesn't happen? If you are not aware there are plugins to avoid round end happening. Used often in DM. With that, your plugin is basically pointless. Also, I don't remember other plugin but how waiting on new round is quicker than doing thing on death?

It seems others plugins are old, maybe you should try to cover all cases, providing different ways ; then you would replace all plugins.
__________________
Arkshine is offline
Chill it BanG
Junior Member
Join Date: Nov 2013
Location: Latvia
Old 03-19-2014 , 14:46   Re: DM Team Balance
Reply With Quote #8

Quote:
Originally Posted by Arkshine View Post
What about if a round end doesn't happen? If you are not aware there are plugins to avoid round end happening. Used often in DM. With that, your plugin is basically pointless. Also, I don't remember other plugin but how waiting on new round is quicker than doing thing on death?

It seems others plugins are old, maybe you should try to cover all cases, providing different ways ; then you would replace all plugins.
Round end is not the main, I added it just in case, if there is an extreme difference.
And, I thought about "never ending round", so I added admin and chat command, so players can do balance manually.

But mainly this plugin works when someone disconects.
Because, difference in count of players in most of cases is started by players who disconects.
So there is -1 player, when someone leaves, right? Then team balance turns on and transfers one player from strongest team, if the difference is two players...
And for safety I added team limitter, that forces player to join the weakest team

So, I believe I have used all possible ways to prevent huge difference in teams.

BTW, this will never be as smart as PTB (Ptahhotep's Team Balancer) that even transfers the strongest players to weakest team. But maybe, some day I will be so crazy that I will do it
__________________
Author of deathrun_ezyKore / fy_NewWorldOrder and some other maps

Last edited by Chill it BanG; 03-19-2014 at 14:49.
Chill it BanG is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 03-19-2014 , 15:02   Re: DM Team Balance
Reply With Quote #9

If your plugin does only that, then it's redundant, the game includes already such team balance system. So except the commands, I'm not sure how your plugin is useful.
__________________

Last edited by Arkshine; 03-19-2014 at 15:02.
Arkshine is offline
Chill it BanG
Junior Member
Join Date: Nov 2013
Location: Latvia
Old 03-20-2014 , 02:08   Re: DM Team Balance
Reply With Quote #10

Quote:
Originally Posted by Arkshine View Post
If your plugin does only that, then it's redundant, the game includes already such team balance system. So except the commands, I'm not sure how your plugin is useful.
As I know balance system that is included in game doesn`t work in DM, since there is possible never ending round. And even if new round starts it not always works properly.

AFAIK most of servers keep "mp_limitteams" to the default value "2" so there is always allowed difference equal to 2 players when someone joins to team. That is why I added mine team limitter (can be disabled, if people know how to use "mp_limitteams")

So that is why this plugin is not redundant, it is is simple plugin, intended for deatchmatch. As people say “The greatest ideas are the simplest.” So why should I confuse players that are transfered just because they play a bit better than others, like PTB plugin does?

The main idea is to keep equal amounts in both of teams.

EDiT:
New version, mainly bug fix, didn`t notice it till this morning

v1.21 -
* Found bug, that "disabled" balance plugin if teamlimit was turned on, but noone got forced to weakest team.
* Made "if" tests easier to read in some parts of code.
__________________
Author of deathrun_ezyKore / fy_NewWorldOrder and some other maps

Last edited by Chill it BanG; 03-20-2014 at 05:49. Reason: New version added...
Chill it BanG 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 20:48.


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