Forum Discussion

Anonymous's avatar
Anonymous
12 years ago

Ranked custom server code

A server that I play on has a coding-error in their server and I'm looking for help on it.

The Server runs vanilla/ normal.

All maps, every map with 2 rounds/ twice.

Side played on switches on the next round. By default, you are not playing the same faction twice, applies to next map aswell.

There are team-scrambles /w or wihout squads intact (depending on severity) should tick-difference be too big.

The goal is to have:

- US vs RU on all Attack-Helicopter maps: Dawnbreaker, Siege of Shangai, Golmud Railway, Rogue Transmission and Lancang Dam.

- Implentation of RU vs CN on Attack Boat & MBT maps is not to be considered should the above be true.

- Randomized spawn bases is okay. Variation of teams on other maps is not essential, but be aimed for.

Problem is:

- Something is overwriting something previous code.

- Teams are stuck on two factions for ALL maps unless hard changed by admin.

Code is:

plugin.ServerCommand("mapList.getMapIndices");
int nextRound = server.CurrentRound + 2;
if (nextRound > server.TotalRounds) nextRound = 1;

if ((server.CurrentRound +1) < server.TotalRounds) {
    plugin.ConsoleWrite("^2Next round is ^b" + plugin.FriendlyMapName(server.MapFileName) + "^n, round " + (server.CurrentRound+1) + " of " + server.TotalRounds + ", with " + server.PlayerCount + " players remaining");
    return false;
}

plugin.ConsoleWrite("^2Next map is ^b" + plugin.FriendlyMapName(server.NextMapFileName) + "^n, round " + nextRound + ", with " + server.PlayerCount + " players remaining");

String msg = "none";

int Team1 = 0;
int Team2 = 0;

Dictionary<int,String> Teams = new Dictionary<int,String>();
Teams.Add(0, "US");
Teams.Add(1, "RU");
Teams.Add(2, "CN");

switch (server.NextMapFileName)
{
    case "MP_Tremors":
    case "MP_Siege":
    case "MP_Damage":
    case "MP_Journey":
        Team1 = 1;
        Team2 = 0;
        break;
    case "MP_Naval":
    case "MP_Resort":
        Team1 = 2;
        Team2 = 1;
        break;
    default:
        Random rnd = new Random();
        Team1 = rnd.Next(0, 3);
        Team2 = rnd.Next(0, 3);

        while (Team1 == Team2)
        {
            Team2 = rnd.Next(0, 3);
        }
        break;
}

plugin.ServerCommand("vars.teamFactionOverride", "1", Convert.ToString(Team1));
plugin.ServerCommand("vars.teamFactionOverride", "2", Convert.ToString(Team2));
msg = "Next map is: " + plugin.FriendlyMapName(server.NextMapFileName) + ", Setting factions to " + Teams[Team1] + " vs " + Teams[Team2] + " on next round...";

plugin.SendGlobalMessage(msg, 12);
plugin.ConsoleWrite("^b^1ADMIN FACTIONS >^0^n " + msg);
plugin.PRoConChat("^b^1ADMIN FACTIONS >^0^n " + msg);
plugin.PRoConEvent(msg, "Insane Limits");

return false;

1 Reply

  • Anonymous's avatar
    Anonymous
    12 years ago

    Bounding Underestimated Meta Players.

About Battlefield Franchise Discussion

Discuss the Battlefield games in this community forum.133,559 PostsLatest Activity: 28 minutes ago