![]() |
|
[Request] Map Rotation - Printable Version +- ItsMods (https://www.itsmods.com) +-- Forum: Archive (https://www.itsmods.com/Forum-Archive.html) +--- Forum: Archive (https://www.itsmods.com/Forum-Archive--64.html) +--- Thread: [Request] Map Rotation (/Thread-Request-Map-Rotation.html) Pages:
1
2
|
Map Rotation - fookaa - 02-04-2012 Ello ... Would it be possible to make a plugin that can set a certain map rotation perfectly with no random map changing at all ?? I have kinda got my rotation almost flawless BUT i do occasionally have the same map pop up every few maps.. Hope someone can make this as it drives me mad... RE: Map Rotation - Yurio - 02-04-2012 Code: const int MAPS = 16;
string[] mapdev = { "mp_alpha", "mp_bootleg", "mp_bravo", "mp_carbon", "mp_dome", "mp_exchange", "mp_hardhat", "mp_interchange", "mp_lambeth", "mp_mogadishu", "mp_paris", "mp_plaza2", "mp_radar", "mp_seatown", "mp_underground", "mp_village" };
string[] mapuser = { "lockdown", "bootleg", "mission", "carbon", "dome", "downturn", "hardhat", "interchange", "fallen", "bakaara", "resistance", "arkaden", "outpost", "seatown", "underground", "village" };
int[] mapweight = { 3, 2, 5, 3, 5, 2, 5, 3, 2, 5, 5, 3, 2, 3, 2, 5 };
int[] maprange = new int[MAPS];
int range;
int nextmap = -1;
Random rnd = new Random(unchecked((int)DateTime.Now.Ticks));
public override void OnServerLoad()
{
for (int i = 0; i < MAPS; i++)
{
range += mapweight[i];
maprange[i] = range;
}
}
public override void OnMapChange()
{
int prevmap = nextmap;
repeat:
nextmap = FindMap(1 + rnd.Next(range));
if (prevmap == nextmap) { goto repeat; }
File.WriteAllText(@"admin/default.dspl", mapdev[nextmap] + ",FFA_All,1");
}
int FindMap(int r)
{
for (int i = 0; i < MAPS; i++)
if (r <= maprange[i])
return i;
return -1;
}RE: Map Rotation - zxz0O0 - 02-04-2012 (02-04-2012, 15:50)fookaa Wrote: Ello ... Not sure if this is possible since game is always checking default.dspl after each map. RE: Map Rotation - fookaa - 02-04-2012 (02-04-2012, 17:11)Yurio Wrote: So what do i do with this ? RE: Map Rotation - kokole - 02-04-2012 lol, maybe compile it? RE: Map Rotation - Pozzuh - 02-04-2012 @Yurio if you don't pass a constructor parameter in the random class it will automatically take the current time as a seed. RE: Map Rotation - Yurio - 02-04-2012 @Pozzuh OK. But if we want to create multiple instances with different number series?
RE: Map Rotation - Pozzuh - 02-04-2012 (02-04-2012, 22:20)Yurio Wrote: @Pozzuh Just keep using rnd.next() and it will be fine RE: Map Rotation - fookaa - 02-13-2012 Any development on this chapz
RE: Map Rotation - Dumas - 02-24-2012 and.. Yurio code work? |