as you may have saw that you can change a Gametype in MW2 (e.g Zombies , Hide & Seek , iSnipe etc..)
this plugin allows you to change the gametype to your custom one..
Full Credits to : @DidUknowiPwn and TheApadayo
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using InfinityScript;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System****;
namespace IW5M_GameType_Changer
{
public class GametypeChanger : BaseScript
{
public GametypeChanger()
{
if (File.Exists("gametype.txt"))
{
StreamReader sr = new StreamReader("gametype.txt");
String gameType = sr.ReadLine();
sr.Close();
changeGametype(gameType);
}
}
[DllImport("kernel32.dll", SetLastError = true)]
static extern IntPtr VirtualAlloc(IntPtr lpAddress, UIntPtr dwSize, uint flAllocationType, uint flProtect);
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool VirtualFree(IntPtr lpAddress, UIntPtr dwSize, uint dwFreeType);
public IntPtr alloc(int size)
{
return VirtualAlloc(IntPtr.Zero, (UIntPtr)size, 0x3000, 0x40);
}
public bool unalloc(IntPtr address, int size)
{
return VirtualFree(address, (UIntPtr)size, 0x8000);
}
bool _changed = false;
IntPtr memory;
private unsafe void changeGametype(string gametype)
{
byte[] gametypestring;
if (_changed)
{
gametypestring = new System.Text.UTF8Encoding().GetBytes(gametype);
if (gametypestring.Length >= 64) gametypestring[64] = 0x0; // null terminate if too large
Marshal.Copy(gametypestring, 0, memory, gametype.Length > 64 ? 64 : gametype.Length);
return;
}
memory = alloc(64);
gametypestring = new System.Text.UTF8Encoding().GetBytes(gametype);
if (gametypestring.Length >= 64) gametypestring[64] = 0x0; // null terminate if too large
Marshal.Copy(gametypestring, 0, memory, gametype.Length > 64 ? 64 : gametype.Length);
*(byte*)0x4EB983 = 0x68; // mov eax, 575D928h -> push stringloc
*(int*)0x4EB984 = (int)memory;
*(byte*)0x4EB988 = 0x90; // mov ecx, [eax+0Ch] -> nop
*(byte*)0x4EB989 = 0x90;
*(byte*)0x4EB98A = 0x90;
*(byte*)0x4EB98B = 0x90; // push edx -> nop
_changed = true;
}
}
}
Usage :
1)Create a File Called GameType.txt in your Game Folder
2)Save the Gametype you want in that text file.. (should be in first line.)
3)Start the Dedicated Server
4)load the Script
5)Have fun..
PS : this isn't tested... (but should work.. i see no reason.. that why it won't work )