static void triggerLoop(memoryFunctions mem, IntPtr handle, IntPtr client) { Console.Beep(100, 400); //started successfully int playerBase = mem.readInt((int)(client) + 0x00A9053C); //0x00A9053C is the localplayer address in memory windowsAPIs winAPI = new windowsAPIs(); while (true) { int inCross = mem.readInt(playerBase + 0x0000AA64); //reads our local playerbase + the crosshair offset. 0x0000AA64 is the crosshairID address in memory if (winAPI.IsKeyPushedDown(triggerKey) && inCross > 0 && inCross < 64) //if incross > 0 && < 64 then that means that there is a player in your crosshair { winAPI.DoMouseClick(); } Thread.Sleep(1); //brings down CPU usage } }
static void triggerLoop(memoryFunctions mem, IntPtr handle, IntPtr client) { Console.Beep(100, 400); //started successfully windowsAPIs winAPI = new windowsAPIs(); while (true) { if (winAPI.IsKeyPushedDown(triggerKey)) { if (canShoot) //sees if there is a valid target { DoMouseClick(); } } Thread.Sleep(1); //brings down CPU usage } }
static void Main(string[] args) { Console.Title = "github.com/rem2beast"; Console.WriteLine("key list at http://cherrytree.at/misc/vk.htm"); Console.Write("Please enter a decimal trigger key value: "); string input = Console.ReadLine(); //get decimal key value as a string triggerKey = Convert.ToInt16(input); //needs error handling Console.WriteLine("Confirm that the game is open. Press enter to start"); Console.ReadKey(); //waits for enter press Console.Clear(); memoryFunctions mem = new memoryFunctions(); mem.initialize(); //starts intialize method triggerLoop(mem, mem.getHandle(), mem.getModuleAddress()); }