View Single Post
Author Message
yellowblood
Member
Join Date: May 2010
Old 12-08-2011 , 15:04   Data is persistent over map changes, when I don't want it to be
Reply With Quote #1

Hey,

I have a simple TF2 plugins that deals with balancing teams.

Sadly, it keeps some data between maps and it causes some bugs. In other words, the method that clears this data isn't called -
Code:
public OnMapStart()
{
	if (_enabled) Enable();
}

public Enable()
{
	ServerCommand("mp_autoteambalance 0");
	ServerCommand("mp_teams_unbalance_limit 0");
	
	_isShouldBalance = false;
	_winningTeam = 0;
	_teamWins[TEAM_RED] = 0;
	_teamWins[TEAM_BLUE] = 0;

	for (new i = 0; i < sizeof(_playerKills) ; i++)
	{
		_playerKills[i] = 0;
		_playerTeams[i] = 0;
	}
}
What am I missing? I want the "Enable" method to be called every time a map changes, so the plugin will start fresh.

Thanks
yellowblood is offline