Перейти к содержимому
View in the app

A better way to browse. Learn more.

Zloplay community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Опубликовано:

This plugin replaces the MW3 random rotation with the old cod4-style rotation. That means the server rotates the way you want, not just randomly, also you can set up more than 16 maps.

 

You must create a file called OldRotation.cfg in your scripts folder.

Syntax:

playlist [playlistname] map [mapname]

Example:

playlist ffa_default map mp_dome playlist sd_default map mp_alpha playlist jug_default map mp_carbon

Note: You must not create a new line in OldRotation.cfg. The whole rotation has to be on a single line! (Thanks Paulofonta)

Source:

Simple version:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using InfinityScript;
using System.IO;

namespace OldRotation
{
   public class OldRot : BaseScript
   {
       public OldRot()
       {
           Log.Write(LogLevel.Info, "\n OldRotation Plugin loaded\n Author: zxz0O0");

           if (!File.Exists(@"scripts\OldRotation.cfg"))
           {
               Log.Write(LogLevel.Error, "File OldRotation.cfg not found. OldRotation Plugin will not work");
               return;
           }

           string content = File.ReadAllText(@"scripts\OldRotation.cfg");
           if (content.Length < 5)
           {
               Log.Write(LogLevel.Error, "Syntax error in OldRotation. OldRotation Plugin will not work");
               return;
           }

           Call("setdvarifuninitialized", "sv_old_mapRotation", content);
           Call("setdvar", "sv_maprotation", "temp-pl");

           if (HasRotated())
           {
               SetRotation();
               Log.Write(LogLevel.Info, "rotating");
           }
       }

       private void SetRotation()
       {
           string val = Call("getdvar", "sv_old_mapRotation");
           string map;
           string playlist;
           string[] valSplit = val.Split(' ');
           if (valSplit.Length < 3 || valSplit[0] != "playlist" || valSplit[2] != "map")
           {
               Log.Write(LogLevel.Error, "Syntax error in OldRotation. OldRotation Plugin will not work");
               return;
           }
           playlist = valSplit[1];
           map = valSplit[3];
           val = string.Empty;
           for (int i = 4; i < valSplit.Length; i++)
           {
               val += valSplit[i];
               val += " ";
           }

           val += "playlist " + playlist + " map " + map;
           Call("setdvar", "sv_old_mapRotation", val);
           Call("setdvar", "sv_nextmap", map);
           File.WriteAllText(@"admin\temp-pl.dspl", map + "," + playlist + ",1000");
       }

       private bool HasRotated()
       {
           string map = Call("getdvar", "mapname");
           string estimated = Call("getdvar", "sv_nextmap");
           if (String.IsNullOrEmpty(estimated))
               return true;

           if (String.Compare(map, estimated, true) == 0)
               return true;
           return false;
       }
   }
}

 

Extended version:

Use this version if you use > 30 maps.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using InfinityScript;
using System.IO;

namespace OldRotation
{
   public class OldRot : BaseScript
   {
       private static string OldRotFilename = "OldRotation.cfg";

       public OldRot()
       {
           Call("setdvarifuninitialized", "sv_oldrotation", "OldRotation.cfg");
           OldRotFilename = Call("getdvar", "sv_oldrotation");
           Log.Write(LogLevel.Info, "\n OldRotation Plugin loaded\n Author: zxz0O0");

           if (Call("getdvarint", "HasJustStarted", 1) == 1)
           {
               Log.Write(LogLevel.Info, "First Start...");
               if (File.Exists(@"scripts\" + OldRotFilename + ".tmp"))
                   File.Delete(@"scripts\" + OldRotFilename + ".tmp");
               File.Copy(@"scripts\" + OldRotFilename, @"scripts\" + OldRotFilename + ".tmp", true);
               Call("setdvar", "HasJustStarted", 0);
           }

           if (!File.Exists(@"scripts\" + OldRotFilename + ".tmp"))
               File.Copy(@"scripts\" + OldRotFilename, @"scripts\" + OldRotFilename + ".tmp", true);

           if (!File.Exists(@"scripts\" + OldRotFilename))
           {
               Log.Write(LogLevel.Error, "File " + OldRotFilename + " not found. OldRotation Plugin will not work");
               return;
           }

           FileInfo fInfo = new FileInfo(@"scripts\" + OldRotFilename);
           if(fInfo.Length < 5)
           {
               Log.Write(LogLevel.Error, "Syntax error in Rotation file. OldRotation Plugin will not work");
               return;
           }

           Call("setdvar", "sv_maprotation", OldRotFilename);

           if (HasRotated())
           {
               Log.Write(LogLevel.Info, "Rotating...");
               SetRotation();
           }
       }

       private void SetRotation()
       {
           string content = File.ReadAllText(@"scripts\" + OldRotFilename + ".tmp");
           string map;
           string playlist;
           string[] valSplit = content.Split(new char[] { ' ' }, 5);
           if (valSplit.Length < 4 || valSplit[0] != "playlist" || valSplit[2] != "map")
           {
               Log.Write(LogLevel.Error, "Syntax error in tmp Rotation file. OldRotation Plugin will not work");
               return;
           }
           playlist = valSplit[1];
           map = valSplit[3];

           for (int z = 0; z < 4; z++)
           {
               string s = valSplit[z];
               int start = content.IndexOf(s);
               int length = s.Length;
               content = content.Remove(start, length);
               content = content.TrimStart(' ');
               if (content[content.Length - 1] != ' ')
                   content += " ";
               content += s;
           }

           File.WriteAllText(@"scripts\" + OldRotFilename + ".tmp", content);
           Call("setdvar", "sv_nextmap", map);
           File.WriteAllText(@"admin\" + OldRotFilename + ".dspl", map + "," + playlist + ",1000");
       }

       private bool HasRotated()
       {
           string map = Call("getdvar", "mapname");
           string estimated = Call("getdvar", "sv_nextmap");
           if (String.IsNullOrEmpty(estimated))
               return true;

           if (String.Compare(map, estimated, true) == 0)
               return true;
           return false;
       }
   }
}

The extended version uses OldRotation.cfg by default. If you want to use other files (if you have multiple servers) you add in your server config at the end:

seta sv_oldrotation "OldRotationFileName.cfg"

The file must be in scripts folder.

Extended: [attachment=1]OldRotationExtended.rar[/attachment]

 

 

Credits to Nukem for creating this feature for the steam version.

Featured Replies

Опубликовано:

Thanks for converting the code to InfinityScript ;)

A real lot of people were asking everywhere (IW5M section, regional forum, PM, msn, etc) for something like this.

Now I can finally tell them "go to that link and let me be!" :P

Опубликовано:
>playlistname

wat? that's not a playlist

One of the things I changed was actually "playlist" to "recipe" on the code definition, and "playlist" to "dsr" on the cfg reading code. Also moved the rotation to admin folder.

val += "dsr" + recipe + "map" + map;
           Call("setdvar", "sv_old_mapRotation", val);
           File.WriteAllText(@"admin\temp-pl.dspl", map + "," + recipe + ",1000");

 

secondly, how fun, more servers with non-randomized rotation which will run maps in alphabetical order like IW3 servers all do

idiots like these stand in the way of progress.

Here, I disagree with you. I've heard some reports of people claiming that the server keeps repeating a small group (4 or 5) of maps too often instead of rotating all maps equally, although the proportion is set to ",1" on all entries. I can't verify that fact since I'm not hosting servers 24/7 now, but I'm sure that those people will be glad to use this script.

There are also those people who like to run mixed gametypes, like tdm, then sd, then ctf, then tdm again, etc. This will be useful for those people aswell.

 

p.s.: as I wrote before, what we really need to find a way now is to be able to restart the rotation when it reaches the last entry.

Опубликовано:
  • Автор
p.s.: there's just a small problem with this script... once it gets to the last map, it won't restart the rotation. It will just keep repeating the last map.

Can you post your OldRotation.cfg? I just tested it and it restarts the rotation.

 

>playlistname

wat? that's not a playlist

 

secondly, how fun, more servers with non-randomized rotation which will run maps in alphabetical order like IW3 servers all do

 

idiots like these stand in the way of progress.

Yes, that's right. The correct name is recipe. I apologize for this mistake. You can correct it if you wish.

I created this on request of the community but if you have a problem with this plugin you can of course remove it.

Опубликовано:
Can you post your OldRotation.cfg? I just tested it and it restarts the rotation.

dsr ffahc map mp_dome dsr S&D_CUP map mp_bravo

Just made it with 2 maps to test it out. It should go Dome->Mission->Dome, etc. But it goes Dome->Mission->Mission->Mission, and so on.

I also noticed that "map_restart" or "fast_restart" triggers the next map and recipe to be output to the temporary playlist. It's not that important, but I think it was worth mention by the way.

Опубликовано:

I hate random rotation, if there is such a thing, because of the fact that sometimes, the same map loads back to back. As a server admin, I like to at least think I'm in control. :lol:

 

Having to reformat my PC, will test when I get done, thanks for the up!

Опубликовано:

Love it, loaded 16 maps and then restarted the rotation flawlessly.

Only tested 16...no prob's.

Опубликовано:

ok, that's enough 'thanks'

 

any more posts will need to be about other things.

Опубликовано:
  • Автор
Can you post your OldRotation.cfg? I just tested it and it restarts the rotation.

dsr ffahc map mp_dome dsr S&D_CUP map mp_bravo

Just made it with 2 maps to test it out. It should go Dome->Mission->Dome, etc. But it goes Dome->Mission->Mission->Mission, and so on.

I also noticed that "map_restart" or "fast_restart" triggers the next map and recipe to be output to the temporary playlist. It's not that important, but I think it was worth mention by the way.

As you can see other people confirm it working so I guess you made a mistake when editing the source code. The point about 'fast_restart' and 'map_restart' is probably true, will take a look and fix if I have time, thanks.

Опубликовано:
Can you post your OldRotation.cfg? I just tested it and it restarts the rotation.

dsr ffahc map mp_dome dsr S&D_CUP map mp_bravo

Just made it with 2 maps to test it out. It should go Dome->Mission->Dome, etc. But it goes Dome->Mission->Mission->Mission, and so on.

I also noticed that "map_restart" or "fast_restart" triggers the next map and recipe to be output to the temporary playlist. It's not that important, but I think it was worth mention by the way.

As you can see other people confirm it working so I guess you made a mistake when editing the source code. The point about 'fast_restart' and 'map_restart' is probably true, will take a look and fix if I have time, thanks.

The issue here is that every time you do any kind of restart (map_restart, fast_restart, or even just map changes) it reloads the mod. This causes issues because there is no way to store persistent data so you have no idea where you were in the rotation when you go to the next map. Try using some method of storage (external file, registry key, etc.) to store the numerical value in the rotation so you can pick up where you left off when the mod is reloaded.

*note* this reloading occurs on round starts (in SnD) as well.

Опубликовано:
Can you post your OldRotation.cfg? I just tested it and it restarts the rotation.

dsr ffahc map mp_dome dsr S&D_CUP map mp_bravo

Just made it with 2 maps to test it out. It should go Dome->Mission->Dome, etc. But it goes Dome->Mission->Mission->Mission, and so on.

I also noticed that "map_restart" or "fast_restart" triggers the next map and recipe to be output to the temporary playlist. It's not that important, but I think it was worth mention by the way.

As you can see other people confirm it working so I guess you made a mistake when editing the source code. The point about 'fast_restart' and 'map_restart' is probably true, will take a look and fix if I have time, thanks.

 

Hi all. Is running fine on our servers, but my rotation is like this:

 

playlist [playlistname] map [mapname]

 

I have not used "dsr". I have now 28 maps running and when last map finish, the rotation start again.

I hope it helps. ;)

Опубликовано:

Ok, tried the original dll and the rotation restarted. My bad.

 

The issue here is that every time you do any kind of restart (map_restart, fast_restart, or even just map changes) it reloads the mod. This causes issues because there is no way to store persistent data so you have no idea where you were in the rotation when you go to the next map. Try using some method of storage (external file, registry key, etc.) to store the numerical value in the rotation so you can pick up where you left off when the mod is reloaded.

*note* this reloading occurs on round starts (in SnD) as well.

Exactely. Only then I noticed that it also happens on multiple round based games aswell.

Although there might be some tricky workarounds to do this, I think the proper way would be to have InfinityScript definitions for these events, so that any scripts could read them. That would be the begining of scripts using persistent data (with the option of skipping reload on selected events). Then in this script example, the script could skip the playlist update on such events.

Опубликовано:
  • Автор

I updated the source to fix the bug with 'fast_restart' and 'map_restart'. Please recompile it.

 

There is still a problem though if you have the same map in a row and doing 'fast_restart' or 'map_Restart'.

Опубликовано:

hey guys,

 

IВґm shure i did something wrong, but have not really an idea what i did wrong...

I extracted the "OldRotation.dll" into the scripts folder and into that folder I created the config "OldRotation,cfg".

 

My rotation in the "OldRotation.cfg" looks like this:

playlist killconf map mp_park playlist teamdef map mp_hardhat playlist hq map mp_seatown

( killconf = kill confirmed, teamdef = team defender, hq = headquarter/king of the hill)

 

But when i start the server, its still a random rotation and all maps with the same gametype.... (war).

Where is my mistake?

 

kind regards,

Mauser

Опубликовано:
Did you follow this guide to install the plugin? viewtopic.php?f=39&t=16409

 

Either the plugin isn't loading because you didn't follow the guide or there is some other error in the logfile.

You need to load the script

viewtopic.php?f=39&t=16409

 

Hello zxz0O0 and Paulofonta

 

I must apologize to you! You both are right, I did not follow that "plugin-install-guide".

But in my defense I have to say that some minutes after i submitted my post I found that guide. I tried to edit my post, but i could not find it cause it wasnВґt proved yet.

By following the guid your plugin runs great.

 

1 thing @ zyz0O0:

I can not put all possible maps into the OldRotation.cfg because the line will be to long. It seems that the server canВґt work with a line with more then 1000 chars.

Actually I have only 33 / 37 Maps running. If I add 1 more map to the rotation the server shuts down or iw5m.exe will crash.

ItВґs not really a problem cause 33 Maps are much enough, I just wanted to let you know.

 

kind regards,

Mauser

Опубликовано:

Actually I have only 33 / 37 Maps running. If I add 1 more map to the rotation the server shuts down or iw5m.exe will crash.

I am suffering the same problem as well.

 

Hopefully zxz0O0 will figure something out but as of right now I going to try combing 2 playlist into 1..

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Гость
Ответить в тему...

Сейчас на странице 0

  • Нет пользователей, просматривающих эту страницу

Важная информация

Используя этот сайт, вы соглашаетесь Условия использования.

Account

Navigation

Поиск

Поиск

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.