October 29, 20187 yr How to stop the event, event start again and again even the char running. using System; using System.Threading; using robotManager.Helpful; using robotManager.Products; using wManager.Plugin; using wManager.Wow.Helpers; using System.Collections.Generic; using System.Linq; using robotManager.FiniteStateMachine; using wManager; using wManager.Wow.Bot.States; using wManager.Wow.Enums; using wManager.Wow.ObjectManager; using robotManager; using MemoryRobot; using Memory = wManager.Wow.Memory; using Timer = robotManager.Helpful.Timer; using Math = robotManager.Helpful.Math; using System.Windows.Forms; public class Main : IPlugin { private bool _isLaunched; public void Initialize() { _isLaunched = true; back: Thread.Sleep(5000); Logging.Write("begin"); if (!MovementManager.InMovement) { robotManager.Events.FiniteStateMachineEvents.OnRunState += (engine, state, cancelable) => { Logging.Write("event still work"); robotManager.Products.Products.InPause = true; Thread.Sleep(1000); robotManager.Products.Products.InPause = false; }; goto back; } } public void Dispose() { } public void Settings() { } }
October 29, 20187 yr You can Subscribe to the events inside the Initialize() Method like the following (be sure to Unsubscribe from the event on Dispose): ** Code is not tested ** public void Initialize() { wManager.Events.FightEvents.OnFightEnd += FightEventsOnFightEnd; // Subscribe to the Event _isLaunched = true; // ... } public void Dispose() { wManager.Events.FightEvents.OnFightEnd -= FightEventsOnFightEnd; // Unsubscribe from the Event _isLaunched = false; // ... } private void FightEventsOnFightEnd (ulong guid) { Random _rand = new Random(); Logging.WriteDebug("FightEventsOnFightEnd()"); // Wait some random time Thread.Sleep(_rand.Next(2000, 5000)); }
October 29, 20187 yr Author 57 minutes ago, Apexx said: You can Subscribe to the events inside the Initialize() Method like the following (be sure to Unsubscribe from the event on Dispose): ** Code is not tested ** public void Initialize() { wManager.Events.FightEvents.OnFightEnd += FightEventsOnFightEnd; // Subscribe to the Event _isLaunched = true; // ... } public void Dispose() { wManager.Events.FightEvents.OnFightEnd -= FightEventsOnFightEnd; // Unsubscribe from the Event _isLaunched = false; // ... } private void FightEventsOnFightEnd (ulong guid) { Random _rand = new Random(); Logging.WriteDebug("FightEventsOnFightEnd()"); // Wait some random time Thread.Sleep(_rand.Next(2000, 5000)); } I need only the event: robotManager.Events.FiniteStateMachineEvents.OnRunState += (engine, state, cancelable) =>. I use the plugin for running in ghost.
Create an account or sign in to comment