Featured Replies
Сейчас на странице 0
- Нет пользователей, просматривающих эту страницу
A better way to browse. Learn more.
A full-screen app on your home screen with push notifications, badges and more.
Используя этот сайт, вы соглашаетесь Условия использования.
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:
Example:
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:
The file must be in scripts folder.
Extended: [attachment=1]OldRotationExtended.rar[/attachment]
Credits to Nukem for creating this feature for the steam version.