AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Extensions (https://forums.alliedmods.net/forumdisplay.php?f=134)
-   -   Team Balance Immunity (https://forums.alliedmods.net/showthread.php?t=129626)

Afronanny 06-14-2010 23:33

Team Balance Immunity
 
Team Balance Immunity

This extension allows you to use Valve's autobalance system, which is, in my opinion the best one, and give certain people immunity to it. A basic sample immunity plugin is included that gives people with the 'a' flag immunity to autobalance.

The regular version will download an updated version of the gamedata if it changes. I have added versions of the extension so that you can opt-out of automatic gamedata updates if you wish.


Instructions
  1. Extract the contents of the archive to your game folder (tf or cstrike)
  2. Give yourself (and any others) admin flag 'a', or whatever you change it to in the example plugin using the 'sm_teambalance_flags' cvar
  3. Load the example plugin
Download:

TF2:
Regular: 1.0
No Automatic Gamedata Updater (Not recommended): 1.0

CSS (Linux version does not work at the moment):
Regular: 1.0
No Automatic Gamedata Updater (Not recommended): 1.0
The Linux CS:S version has a very nasty crash that I have been unable to track down. All debug and crash data I have collected has been utterly useless. I don't forsee a fix in the near future.

Source code available
Here
The source code is the same for all versions, TF2 and CS:S. They are compiled using defines, so you need only un-comment or comment out whichever options you want in extension.cpp if you are compiling this yourself.

SourcePawn Forwards:
PHP Code:

/**  
 * @brief Called when the balancer wants to know if a player can be autobalanced  *  
 * @param client    Index of the client
 * @param actual    Result as determined by the server. Overwrite and return Plugin_Handled to force a value.  
 * @return         True to allow player to be seen, false to disallow player being seen  
 */ 

forward Action:OnBalanceCheck(client, &bool:actual); 

How to use in a plugin:
PHP Code:

#include <teambalance>
#include <sourcemod>

public Action:OnBalanceCheck(client, &bool:actual)
{
    if (
GetUserFlagBits(client) & ADMFLAG_GENERIC)
    {
        
actual false;
        return 
Plugin_Handled;
    }
    return 
Plugin_Continue;



DontWannaName 06-15-2010 01:54

Re: [EXTENSION] TF2 Team Balance Immunity
 
Nice, I wish I knew how TF2's autobalancer chooses players to be balanced?

pheadxdll 06-15-2010 02:39

Re: [EXTENSION] TF2 Team Balance Immunity
 
It's based on how recently you joined the server and how much time has passed since the last time you were switched.

Source code needs to be cleaned up. Check line 46. :) Not being able to respawn kind of sucks- should be fixable. A forward for sourcepawn would be useful. Then you could use a plugin to check immunity.

Wazz 06-15-2010 08:57

Re: [EXTENSION] TF2 Team Balance Immunity
 
I'm fairly sure it just chooses the next player to die after it decides that teams need balancing.

Afronanny 06-15-2010 08:59

Re: [EXTENSION] TF2 Team Balance Immunity
 
Quote:

Originally Posted by DontWannaName (Post 1209125)
Nice, I wish I knew how TF2's autobalancer chooses players to be balanced?

Code:

CBaseMultiplayerPlayer::CalculateTeamBalanceScore(void)
CBaseEntity::IsAlive(void)
CTeamplayRoundBasedRules::AreTeamsUnbalanced(int, int)


bl4nk 06-15-2010 11:18

Re: [EXTENSION] TF2 Team Balance Immunity
 
Quote:

Originally Posted by Afronanny (Post 1209378)
Code:

CBaseMultiplayerPlayer::CalculateTeamBalanceScore(void)
CBaseEntity::IsAlive(void)
CTeamplayRoundBasedRules::AreTeamsUnbalanced(int, int)


Only the first two are needed, the third isn't necessary for this to work, and might be the cause of the respawn bug.

Afronanny 06-15-2010 12:11

Re: [EXTENSION] TF2 Team Balance Immunity
 
Quote:

Originally Posted by bl4nk (Post 1209482)
Only the first two are needed, the third isn't necessary for this to work, and might be the cause of the respawn bug.

bl4nk, you're right, AreTeamsUnbalanced wasn't needed at all :P.If the player is alive, they won't be balanced, right? I don't think CalculateTeamBalanceScore would be required, if the player is reported as alive.

By the way, I now have a forward for sourcepawn coded in, and the respawn bug is fixed. All I need to do is figure out why I always get "file not found" errors when trying to compile on Windows and fix them >.<

Afronanny 06-15-2010 12:36

Re: [EXTENSION] TF2 Team Balance Immunity
 
Updated source and binaries:

  • Fixed respawn bug.
  • Added Windows binary (not tested)
  • Added sourcepawn forward.

asherkin 06-15-2010 13:33

Re: [EXTENSION] TF2 Team Balance Immunity
 
Nice work on this Afronanny, glad to see there is finally a public one :D.

blik 06-15-2010 15:39

Re: [EXTENSION] TF2 Team Balance Immunity
 
Windows servers crash as they start :(

Quote:

L 06/15/2010 - 20:37:38: [AUTOIMMUNITY] Sigscan for Balance failed - Disabling detour to prevent crashes
Look forward to fixed/tested windows binary.


All times are GMT -4. The time now is 10:01.

Powered by vBulletin®
Copyright ©2000 - 2018, vBulletin Solutions, Inc.