View Single Post
Author Message
Afronanny
Veteran Member
Join Date: Aug 2009
Old 06-14-2010 , 23:33   Team Balance Immunity
Reply With Quote #1

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;


Last edited by Afronanny; 09-07-2012 at 09:13.
Afronanny is offline