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

[TF2] gScramble Team Balancer/Scrambler -- 3.0.33 4/14/2015


Post New Thread Reply   
 
Thread Tools Display Modes
Phaiz
AlliedModders Donor
Join Date: Feb 2014
Location: USA
Old 03-04-2015 , 00:57   Re: [TF2] gScramble Team Balancer/Scrambler -- 3.0.29 3/2/2015
Reply With Quote #1441

It would seem that I do not have mp_autoteambalance 0 in the server.cfg, I must have missed that when setting this server up. I am going to try adding that in the morning and see if that works.
__________________
Phaiz is offline
BrutalGoerge
AlliedModders Donor
Join Date: Jul 2007
Old 03-04-2015 , 01:02   Re: [TF2] gScramble Team Balancer/Scrambler -- 3.0.29 3/2/2015
Reply With Quote #1442

ooooooooooooohhhhh
gscramble is supposed to set that covar to 0
Code:
	if (GetConVarBool(cvar_Enabled))
	{
		if (g_bAutoBalance)
		{
			if (GetConVarBool(FindConVar("mp_autoteambalance")))
			{
				LogAction(-1, 0, "set mp_autoteambalance to false");
				
				SetConVarBool(FindConVar("mp_autoteambalance"), false);
			}
		}
But someone could totally override it, like in a late exec cfg.
Maybe I will add a listener for that covar to yell at admins who try to enable it.

But yeah otherwise the plugin should be setting it to 0. If it's not saying the admins are being swapped in a [SM] tagged message, then its the default balancer.
__________________
My Pluggies If you like, consider to me.

Last edited by BrutalGoerge; 03-04-2015 at 01:23.
BrutalGoerge is offline
Phaiz
AlliedModders Donor
Join Date: Feb 2014
Location: USA
Old 03-04-2015 , 01:30   Re: [TF2] gScramble Team Balancer/Scrambler -- 3.0.29 3/2/2015
Reply With Quote #1443

Quote:
Originally Posted by BrutalGoerge View Post
ooooooooooooohhhhh
gscramble is supposed to set that covar to 0
Code:
    if (GetConVarBool(cvar_Enabled))
    {
        if (g_bAutoBalance)
        {
            if (GetConVarBool(FindConVar("mp_autoteambalance")))
            {
                LogAction(-1, 0, "set mp_autoteambalance to false");
                
                SetConVarBool(FindConVar("mp_autoteambalance"), false);
            }
        }
But someone could totally override it, like in a late exec cfg.
Maybe I will add a listener for that covar to yell at admins who try to enable it.

But yeah otherwise the plugin should be setting it to 0. If it's not saying the admins are being swapped in a [SM] tagged message, then its the default balancer.
I don't have it in the server.cfg at all, but just for the hell of it I am going to add it.
__________________
Phaiz is offline
BrutalGoerge
AlliedModders Donor
Join Date: Jul 2007
Old 03-04-2015 , 01:36   Re: [TF2] gScramble Team Balancer/Scrambler -- 3.0.29 3/2/2015
Reply With Quote #1444

well type in the console and see what mp_autoteambalance spits out, if thats set to 1, then you found the problem, but if its set to 0, then I duno wth is going on... :<
__________________
My Pluggies If you like, consider to me.
BrutalGoerge is offline
Phaiz
AlliedModders Donor
Join Date: Feb 2014
Location: USA
Old 03-04-2015 , 01:40   Re: [TF2] gScramble Team Balancer/Scrambler -- 3.0.29 3/2/2015
Reply With Quote #1445

Quote:
Originally Posted by BrutalGoerge View Post
well type in the console and see what mp_autoteambalance spits out, if thats set to 1, then you found the problem, but if its set to 0, then I duno wth is going on... :<
"mp_autoteambalance" = "0" ( def. "1" )
__________________
Phaiz is offline
Phaiz
AlliedModders Donor
Join Date: Feb 2014
Location: USA
Old 03-04-2015 , 01:53   Re: [TF2] gScramble Team Balancer/Scrambler -- 3.0.29 3/2/2015
Reply With Quote #1446

The balance immunity worked just fine with the redux version that david did. What's the difference between yours and his?
__________________
Phaiz is offline
BrutalGoerge
AlliedModders Donor
Join Date: Jul 2007
Old 03-04-2015 , 02:48   Re: [TF2] gScramble Team Balancer/Scrambler -- 3.0.29 3/2/2015
Reply With Quote #1447

Quote:
Originally Posted by Phaiz View Post
The balance immunity worked just fine with the redux version that david did. What's the difference between yours and his?
Id think that mine should work better than the redux version atm....

here

REDUX FORCE BALANCE PRIORITY READER
Code:
		else if (GetClientTeam(i) == team) 
		{
			if (GetConVarBool(cvar_Preference) && g_aPlayers[i][iTeamPreference] == smallTeam && !TF2_IsClientUbered(i))
			{
				iFatTeam[counter][1] = 3;
			}
			else if (IsValidTarget(i, balance))
			{
				iFatTeam[counter][1] = GetPlayerPriority(i);
			}
			else
			{
				iFatTeam[counter][1] = -5;
			}
			
			iFatTeam[counter][0] = i;
			counter++;
		}
	}
GSCRAMBLE
Code:
		else if (GetClientTeam(i) == team) 
		{
			// player wants to be on the other team, give him preference 
			if (GetConVarBool(cvar_Preference) && g_aPlayers[i][iTeamPreference] == smallTeam && !TF2_IsClientUbered(i))
			{
				iFatTeam[counter][1] = 100;
			}
			else
				iFatTeam[counter][1] = GetPlayerPriority(i);
			//else if (IsClientValidBalanceTarget(i))
			//{
			//}
			//else
			//{
				//iFatTeam[counter][1] = -5;
			//}
			iFatTeam[counter][0] = i;
			counter++;
		}
	}
REDUX
Code:
stock GetPlayerPriority(client)
{
	if (IsFakeClient(client))
	{
		return 0;
	}
	
	if (TF2_IsPlayerInDuel(client))
	{
		return -10;
	}
	
	if (g_bUseBuddySystem)
	{
		if (g_aPlayers[client][iBuddy])
		{
			if (GetClientTeam(client) == GetClientTeam(g_aPlayers[client][iBuddy]))
			{
				return -10;
			}
			else if (IsValidTeam(g_aPlayers[client][iBuddy]))
			{
				return 10;
			}
		}
		
		if (IsClientBuddy(client))
		{
			return -2;
		}
	}
	
	new iPriority;
	
	if (IsClientInGame(client) && IsValidTeam(client))
	{
		if (g_aPlayers[client][iBalanceTime] > GetTime())
		{
			return -5;
		}
		
		if (g_aPlayers[client][iTeamworkTime] >= GetTime())
		{
			iPriority -= 3;
		}
		
		if (g_RoundState != bonusRound)
		{
			if (TF2_HasBuilding(client)||TF2_IsClientUberCharged(client)||TF2_IsClientUbered(client)|| !IsNotTopPlayer(client, GetClientTeam(client))||TF2_IsClientOnlyMedic(client))
			{
				return -10;
			}
			
			if (!IsPlayerAlive(client))
			{
				iPriority += 5;
			}
			else
			{
				if (g_aPlayers[client][bHasFlag])
				{
					iPriority -= 20;
				}
				
				iPriority -= 1;
			}
		}		
		/**
		make new clients more likely to get swapped
		*/
		if (GetClientTime(client) < 180)		
		{
			iPriority += 5;	
		}
	}
	
	return iPriority;
}
GSCRAMBLE

Code:
GetPlayerPriority(client)
{
	if (IsFakeClient(client))
	{
		return 0;
	}
	new iPriority;
	if (!IsClientValidBalanceTarget(client, false))
		iPriority -=50;
	if (!IsPlayerAlive(client))
	{
		iPriority += 5;
	}
	
	
	if (GetConVarInt(cvar_BalanceImmunity) == 1 || GetConVarInt(cvar_BalanceImmunity) == 3)
	{
		char sFlags[32];
		GetConVarString(cvar_BalanceAdmFlags, sFlags, sizeof(sFlags));
		if (IsAdmin(client, sFlags))
			iPriority -=100;
	}
	if (g_aPlayers[client][iBalanceTime] > GetTime())
	{
		iPriority -=20;
	}
	if (GetClientTime(client) < 180)
	{
		iPriority += 5;	
	}
	return iPriority;
}
Can you answer me when exactly it's choosing your admins? On the death event? Or on the force-balance timeout, or both?
__________________
My Pluggies If you like, consider to me.

Last edited by BrutalGoerge; 03-04-2015 at 02:53.
BrutalGoerge is offline
Phaiz
AlliedModders Donor
Join Date: Feb 2014
Location: USA
Old 03-04-2015 , 02:56   Re: [TF2] gScramble Team Balancer/Scrambler -- 3.0.29 3/2/2015
Reply With Quote #1448

I will ask them to note that and inform me.
__________________
Phaiz is offline
BrutalGoerge
AlliedModders Donor
Join Date: Jul 2007
Old 03-04-2015 , 03:02   Re: [TF2] gScramble Team Balancer/Scrambler -- 3.0.29 3/2/2015
Reply With Quote #1449

I have also been re-writing functions for better syntax and new sourcepawn.

But I welcome people to double check my work. I really want to clean up the entire plugin evenutally.

Code for the 'is valid target' for on death balance'
Code:
bool IsClientValidBalanceTarget(client, bool CalledFromPrio = false)
{
	if (IsClientInGame(client) && IsValidTeam(client))
	{
		if (IsFakeClient(client))
		{
			if (GetConVarBool(cvar_AbHumanOnly) && !TF2_IsClientOnlyMedic(client))
			{
				return false;
			}
			return true;
		}

	// allow client's team prefence to override balance check
		if (GetConVarBool(cvar_Preference))
		{
			new big = GetLargerTeam(),
				pref = g_aPlayers[client][iTeamPreference];
			if (pref && pref != big)
				return true;
		}
		
		if (g_aPlayers[client][iBalanceTime] > GetTime())
		{
			return false;
		}
		
		if (GetConVarBool(cvar_TeamworkProtect) && g_aPlayers[client][iTeamworkTime] >= GetTime())
		{
			#if defined DEBUG
			LogToFile("addons/sourcemod/logs/gscramble.debug.txt", "Flagging immune: teamwork protection");
			#endif
			return false;
		}
		
		// hard coded protections no one wants to be swapped carrying objective or while ubered
		if (TF2_IsClientUberCharged(client) || TF2_IsClientUbered(client) || DoesClientHaveIntel(client))
			return false;

		if (GetConVarInt(cvar_TopProtect) && !IsNotTopPlayer(client, GetClientTeam(client)))
		{
			#if defined DEBUG
			LogToFile("addons/sourcemod/logs/gscramble.debug.txt", "Flagging immune top protect");
			#endif
			return false;
		}
		
		if (GetConVarBool(cvar_ProtectOnlyMedic) && TF2_IsClientOnlyMedic(client))
		{
			#if defined DEBUG
			LogToFile("addons/sourcemod/logs/gscramble.debug.txt", "Flagging immune only medic");
			#endif
			return false;
		}
		
		new iImmunity = e_Protection:GetConVarInt(cvar_BalanceImmunity),
			bool:bAdmin = false,
			bool:bEngie = false;
		switch (iImmunity)
		{
			case admin:
			{
				#if defined DEBUG
				LogToFile("addons/sourcemod/logs/gscramble.debug.txt", "Balance var read: admin");
				#endif
				bAdmin = true;
			}
			case uberAndBuildings:
			{
				#if defined DEBUG
				LogToFile("addons/sourcemod/logs/gscramble.debug.txt", "Balance var read: engie with buildings");
				#endif
				bEngie = true;
			}
			case both:
			{
				#if defined DEBUG
				LogToFile("addons/sourcemod/logs/gscramble.debug.txt", "Balance var read: Both engie + admin");
				#endif
				bAdmin = true;
				bEngie = true;
			}
		}

		if (bEngie)
		{
			if (TF2_HasBuilding(client))
			{
				#if defined DEBUG
				LogToFile("addons/sourcemod/logs/gscramble.debug.txt", "Detected building, flagging false");
				#endif
				return false;
			}
		}

		if (!CalledFromPrio && bAdmin)
		{
			new String:flags[32],
				bool:bSkip;
			GetConVarString(cvar_BalanceAdmFlags, flags, sizeof(flags));
			bSkip = CheckBalanceOverride();
				if (!bSkip && IsAdmin(client, flags))
				{
					#if defined DEBUG
					LogToFile("addons/sourcemod/logs/gscramble.debug.txt", "Detected admin: flagging false");
					#endif
					return false;
				}
			}
		}

		if (g_bUseBuddySystem)
		{
			new buddy;
			
			if ((buddy = g_aPlayers[client][iBuddy]))
			{
				if (GetClientTeam(buddy) == GetClientTeam(client))
				{
					LogAction(-1, 0, "Flagging client %L invalid because of buddy preference", client);
					return false;
				}
				else if (IsValidTeam(g_aPlayers[client][iBuddy]))
				{
					LogAction(-1, 0, "Flagging client %L valid because of buddy preference", client);
					return true;
				}
			}		
			if (IsClientBuddy(client))
			{
				return false;
			}
		}
		if (GetConVarBool(cvar_BalanceDuelImmunity) && TF2_IsPlayerInDuel(client))
			return false;
		return true;
	}
	return false;
}

bool CheckBalanceOverride()
{
	if (GetConVarFloat(cvar_BalanceImmunityCheck) > 0.0)
	{
		new	iTargets,
			iImmune,
			iTotal;
		for (new i = 1; i <= MaxClients; i++)
		{
			if (IsClientInGame(i) && IsValidTeam(i))
			{
				if (IsAdmin(i, flags))
				{
					iImmune++;
				}
				else
				{
					iTargets++;
				}
			}
		}
		if (iImmune)
		{
			float fPercent;
			iTotal = iImmune + iTargets;
			fPercent = FloatDiv(float(iImmune), float(iTotal));
			if (fPercent >= GetConVarFloat(cvar_BalanceImmunityCheck))
			{
				if (!g_bSilent && (GetTime() - g_iImmunityDisabledWarningTime) > 300)
				{
					PrintToChatAll("\x01\x04[SM]\x01 %t", "ImmunityDisabled", RoundFloat(fPercent));
					g_iImmunityDisabledWarningTime = GetTime();
					return false;
				}
			}
		}
	}
	return true;
}
__________________
My Pluggies If you like, consider to me.
BrutalGoerge is offline
Phaiz
AlliedModders Donor
Join Date: Feb 2014
Location: USA
Old 03-04-2015 , 03:18   Re: [TF2] gScramble Team Balancer/Scrambler -- 3.0.29 3/2/2015
Reply With Quote #1450

Alright we just did some testing, after forcing players to switch teams with the admin menu, engies with buildings and donors are being auto balanced. We were just standing outside of spawn and the engies had dispensers up so it wasn't an "on death" balance. It seemed to me that it was balancing the engies more than non engies.

edit-
I was also told by a donor that they were auto balanced earlier tonight while living.
__________________

Last edited by Phaiz; 03-04-2015 at 03:19.
Phaiz is offline
Reply


Thread Tools
Display Modes

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 04:51.


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