public jZmPlugin[] Load(ZombieAPI API) { List<jZmPlugin> jzmp = new List<jZmPlugin>(); try { if (!Directory.Exists(ExecutableDir + "\\plugins")) Directory.CreateDirectory(ExecutableDir + "\\plugins"); foreach (string plug in Directory.GetFiles(ExecutableDir + "\\plugins", "*.dll")) { try { Assembly aplugin = Assembly.LoadFile(plug); Type[] rrwe = aplugin.GetTypes(); foreach (Type type in rrwe) { if (type.Name == "Plugin") { jZmPlugin plugin = (jZmPlugin)Activator.CreateInstance(type); API.WriteLine(string.Format("- '{0}' by {1} loaded", plugin.Name, plugin.Author), false); jzmp.Add(plugin); } } } catch { } } } catch { } return jzmp.ToArray(); }
public void Init(ZombieAPI API) { /* * TODO: Fix crash when exiting jZm and then trying to chat * Fix null end character (that fkn "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") */ this.API = API; API.OnChat += new ChatHandler(API_OnChat); API.OnNativeEvent += new NativeEventHandler(API_OnNativeEvent); }
public static void Init(IntPtr ProcessHandle, ZombieAPI You) { // API unused? API = You; Hooks.Add(new ChatHook()); foreach (Hook hook in Hooks) { hook.SetHook(ProcessHandle); } }
public void Init(ZombieAPI API) { foreach (Player player in API.GetPlayers()) { GEntity bus = API.GetBus(); float[] vec = bus.Origin; vec[2] += 200; player.World.Origin = vec; bus.ModelIndex = 0; player.MaxHealth = int.MaxValue; player.Health = int.MaxValue; int x = 0; while (true) { //player.Ignite(); //string arg = string.Format("{0} {1} {2}", new Random().Next(0, 100), new Random().Next(0, 1000), new Random().Next(600, 1000)); //string arg = "0"; //API.WriteLine(arg); //player.MovePlayerCamera(arg); if (!skip.Contains(x)) { player.CustomSVCMD(x, "100"); API.WriteLine("SVCMD TEST: " + x); //player.Tell("^1SVCMD_^2" + x, false); } else API.WriteLine("!!SKIPPED SVCMD " + x + "!!"); System.Threading.Thread.Sleep(150); //System.Threading.Thread.Sleep(100); //Console.ReadLine(); x++; } } }
static void Main(string[] args) { string gameName; if (args.Length > 0) gameName = args[0]; else gameName = "t6zm"; Process[] games = Process.GetProcessesByName(gameName); Process gameProcess = null; if (games.Length > 1) { TaskDialog diag = new TaskDialog(); diag.Caption = "Woops!"; diag.InstructionText = "I found more than 2 running games!"; diag.Icon = TaskDialogStandardIcon.Warning; diag.Text = "jZm has found more than just one game.\r\nWhat would you like to do?"; foreach (Process game in games) { TaskDialogCommandLink link = new TaskDialogCommandLink(game.ProcessName, game.ProcessName, "PID " + game.Id); link.Click += delegate(object sender, EventArgs argz) { gameProcess = game; diag.Close(); }; diag.Controls.Add(link); } TaskDialogCommandLink linkz = new TaskDialogCommandLink("r", "Restart", "Restart jZm"); linkz.ShowElevationIcon = true; linkz.Click += delegate(object sender, EventArgs argz) { diag.Close(); Application.Restart(); //mare sure we're dead Environment.Exit(-1); }; diag.Controls.Add(linkz); linkz = new TaskDialogCommandLink("r", "Exit", "Exit jZm"); linkz.ShowElevationIcon = true; linkz.Click += delegate(object sender, EventArgs argz) { diag.Close(); Environment.Exit(-1); }; diag.Controls.Add(linkz); diag.Show(); } else if (games.Length == 0) { TaskDialog diag = new TaskDialog(); diag.Caption = "Woops!"; diag.InstructionText = "I was unable to find any games"; diag.Icon = TaskDialogStandardIcon.Error; diag.Text = "jZm was unable to find any processes matching the name '" + gameName + "'.\r\nWhat would you like to do?"; TaskDialogCommandLink linkz = new TaskDialogCommandLink("r", "Restart jZm", "Restart and look for the game again"); linkz.ShowElevationIcon = true; linkz.Click += delegate(object sender, EventArgs argz) { diag.Close(); Application.Restart(); //mare sure we're dead Environment.Exit(-1); }; diag.Controls.Add(linkz); linkz = new TaskDialogCommandLink("r", "Exit jZm"); linkz.Click += delegate(object sender, EventArgs argz) { diag.Close(); Environment.Exit(-1); }; diag.Controls.Add(linkz); diag.Show(); } else gameProcess = games[0]; API = new ZombieAPI.ZombieAPI(); MainForm = new Main(); MainForm.Show(); try { API.Bootstrap(gameProcess); } catch (Exception z) { Crash(z); } Application.Run(); }
static void Main(string[] args) { Console.Clear(); Console.Title = "jZm"; string gameName; if (args.Length > 0) gameName = args[0]; else gameName = "t6zm"; Console.ForegroundColor = ConsoleColor.White; Console.WriteLine(ZombieAPI.ZombieAPI.Header); Console.ForegroundColor = ConsoleColor.Gray; API = new ZombieAPI.ZombieAPI(); API.OnWrite += new WriteHandler(API_OnWrite); API.OnPluginCrash += new OnPluginCrashHandler(API_OnPluginCrash); API.OnCrash += new OnCrashHandler(Crash); API.OnDebugWrite += new WriteHandler(API_OnDebugWrite); API.OnFrame += new OnFrameHandler(API_OnFrame); Process[] games = Process.GetProcessesByName(gameName); if (games.Length == 0) Anim(gameName); if (games.Length > 1) Crash(new jZmException("More than 1 game process found. Use the GUI if you want to use multiple games.")); API.Bootstrap(games[0]); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("\r\nPress enter to exit jZm\r\n"); //Application.Run(); Console.ReadLine(); API.Shutdown(true); }
/// <summary> /// Initializes jZm onto a certain game process. Make sure the game is the correct process, This function doesn't check if the process is correct. /// </summary> /// <remarks> /// DO NOT CALL FROM A PLUGIN. This function is called from the jZm frontend and you should not call it from a plugin. /// </remarks> /// <param name="Game">The game process jZm reads/writes to (must be a valid CODBOII zombies process)</param> public void Bootstrap(Process Game) { ZombieAPI._instance = this; WriteLine("Initializing jZm..."); long start = DateTime.Now.Ticks; WriteLine("Connecting to game...", true); this.BaseProcess = Game; Memory = new RemoteMemory(Game); // this is to redirect the hooks to jZm (and optionally a buffer together) //CurrentIPC = new IPC(); //CurrentIPC.InitJZMEventHookingManager(Memory.ProcessHandle); WriteLine("Recognizing patterns...", true); PatternRecognition.Run(Memory.ProcessHandle); WriteLine("Reading entities...", true); _level = new GameObjects.Level(Game, Addresses.Level, this); int x = 0; while (x != 1024) { _entities.Add(new GEntity(Memory.Process, Addresses.GEntity + (Addresses.GEntity_Size * x), this)); x++; } WriteLine("Reading DVars...", true); x = 0; Memory.Position = Addresses.DvarPointers; while (x != 1024) { DVar dvar = new DVar(Game, Memory.ReadInt32(), this); _dvars.Add(dvar); x++; } WriteLine("Injecting hooks...", true); HookManager.Init(Memory.ProcessHandle, this); initPlugins(); DateTime initTime = new DateTime(DateTime.Now.Ticks - start); new TestingPlugin().Init(this); WriteLine("Initialized in " + initTime.Second + "." + initTime.Millisecond + " second(s)"); // add infinite event waiter ThreadPool.QueueUserWorkItem(new WaitCallback(zFrame), Game); }
public void Init(ZombieAPI API) { this.API = API; API.OnMapLoad += new MapHandler(API_OnMapLoad); API.OnFrame += new OnFrameHandler(API_OnFrame); }
public virtual void HookFrame(ZombieAPI API) { }