Перейти к содержимому
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

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

Seems my last post didn't get approved.

 

Anyway a dvar is limited in size, it's not unlimited, that's why you have crashing issue.

I made an extended version which doesn't use a dvar but a tmp file instead. I tested it with 400entries (so that should be enough for everyone) and everything worked. Depending on your configuration you may see increased ram usage.

 

Btw, would be good if a moderator could also compile the extended version.

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

hello zxz0O0

 

I have 1 more suggestion ro you.

Please forgive me my bad english but I try to explain what I mean as good as I can :D

 

Could you rebuid your Plugin in that way, that we can change the name of the "OldRotation.cfg"?

 

for example:

In the Serverconfig can be an entry like this:

OldRotationName "rotation1.cfg"

and in that case the "temp.dspl" should be named to "temp_rotation1.dspl"

 

Why this?

Because if we wanna host more then 1 Server we only can use always the same OldRotation.cfg. Means:

on all Servers with the good old Maprotation-system (CoD4 for ever) all the maps are the same, or we have to use the random-shit.

 

Or am I wrong?

Опубликовано:
Mauser":1z6q9zev]Because if we wanna host more then 1 Server we only can use always the same OldRotation.cfg.

Compile the plugin several times, using different names for each dll, and each dll writting and loading a different temp playlist.

Then you can use one variant of the plugin for each server.

Опубликовано:
Mauser":151dqm33]Because if we wanna host more then 1 Server we only can use always the same OldRotation.cfg.

Compile the plugin several times, using different names for each dll, and each dll writting and loading a different temp playlist.

Then you can use one variant of the plugin for each server.

bad way to do it

Опубликовано:
bad way to do it

I agree with you. The solution I posted goes completely against the principles of "development".

But still, it's a workaround that would work for nabs like me :3

I have no skill in scriting C/C++, I just can a bit AutoIt...

 

Can a coder use variables in C/C++? If yes, then he could rebuild that DLL in this way, that the name of the DLL can be used 4 everything.

Example:

namespace OldRotation
{
   public class OldRot : BaseScript
   {
       public OldRot()
       {
  //      Log.Write(LogLevel.Info, "\n OldRotation Plugin loaded\n Author: zxz0O0");  <--- the old way
           Log.Write(LogLevel.Info, "\n " & $PLUGINNAME & " loaded\n Author: zxz0O0"); // new way

 //       if (!File.Exists(@"scripts\OldRotation.cfg"))  <--- the old way
           if (!File.Exists(@"scripts\" & $PLUGINNAME & ".cfg")) // new way
           { .........

If this is possible, like in AutoIt, then we could rename the DLL like we want and we would be able to make more then 1 rotation for each server.

 

Kind regards

Mauser

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

Thank you [iFA] Mauser for your suggestion. I've updated the extended version in the first post so you can set the config file yourself. If you also need the simple version to be updated please let me know.

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

Well, I just got another idea for multiple server rotations...

The plugin could grab a command from server.cfg

Let's suppose that the plugin supports a rotation on each line of OldRotation.cfg

 

Then, if the server is set to:

seta sv_maprotation "0"

it will load the rotation on the first line.

 

If you got:

seta sv_maprotation "1"

it will load the rotation on the second line instead.

 

And so on, meaning that you could have several rotations set on OldRotation.cfg, and choose one with sv_maprotation command. The hardest part seems to be to fix the crash that happens at the end of the rotation, if OldRotation.cfg has an enter at the end of the line.

Just for Pigophone to be happy with a "professional" way of doing it :3

Опубликовано:
Thank you [iFA] Mauser for your suggestion. I've updated the extended version in the first post so you can set the config file yourself. If you also need the simple version to be updated please let me know.

Hello Master zxz0O0

 

great work!!!

 

I just tried the new extended.dll and it seems working like it should do.

great work :)

 

Thank you and best regards,

 

[iFA] Mauser

  • 4 weeks later...
Опубликовано:
Hello!

 

I'm still a beginner in scripting.

How to play for putting the script?

 

Which folder?

Which file must still reach into the server load?

 

Please help!

 

http://fourdeltaone.net/forum/viewtopic.php?f=39&t=16409

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.