View Single Post
NgBUCKWANGS
Senior Member
Join Date: Dec 2014
Old 12-18-2016 , 00:21   Re: [L4D2] ABM: A L4D2 5+ Player Enhancement for Campaign
Reply With Quote #15

This is the code I've added to support Vs and Scavenge and distributing bots evenly across teams. Before... this function just added new bots to team 2 (survivors) as I was considering campaign only in my development but I love abstraction and this in theory (I've only tested to make sure it didn't break campaign) works. I'm gonna leave this in but it might need a tweak or two. I don't unfortunately have enough friends that would enjoy wasting an evening on testing.

If anyone is interested in helping me make this solid, friend me on Steam at http://steamcommunity.com/id/buckwangs/

Code:
public OnClientPostAdminCheck(int client) {
	DebugToFile(1, "OnClientPostAdminCheck: %d", client);

	if (!GetQRecord(client)) {
		if (SetQRecord(client) >= 0) {
			PrintToServer("AUTH ID: %s, ADDED TO QDB.", g_QKey);

			int onteam = 2;
			bool isVs = false;

			if (StrEqual(g_GameMode, "versus") || StrEqual(g_GameMode, "scavenge")) {
				if (GetTeamClientCount(3) < GetTeamClientCount(2)) {
					onteam = 3;
					isVs = true;
				}
			}

			if (CountTeamMates(onteam, 0) == 0) {
				if (onteam == 2 && !isVs) {
					g_ExtPlayers++;
				}

				NewBotTakeOver(client, onteam);
			}
		}
	}
}
NgBUCKWANGS is offline