public void runHack(Entry entry) { Entry e = entry; HackID h = e.getID(); IsGameRunning(); if (e is ToggleEntry) { ToggleEntry tEnt = e as ToggleEntry; switch (h) { case HackID.GODMODE: enableGod = tEnt.state; if (tEnt.state) { startGodThread(); } else { godTrRunning = false; } setGodmode(enableGod); mRef.showInfo((tEnt.state ? "Enabled" : "Disabled") + " Godmode!"); break; case HackID.OTR: setHealth(tEnt.state); mRef.showInfo((tEnt.state ? "Enabled" : "Disabled") + " Off the Radar!"); break; case HackID.FIRERATE: setRapidfire(tEnt.state); tEnt.toggle(); mRef.showInfo("Activated Rapid Fire for Held Weapon!"); break; case HackID.NEVERWANTED: if (tEnt.state) { startWantedLevelThread(); } else { wantedTrRunning = false; } mRef.showInfo((tEnt.state ? "Enabled" : "Disabled") + " Never Wanted!"); break; case HackID.CARGOD: if (tEnt.state) { startCarThread(); } carGod = tEnt.state; setCargod(carGod); mRef.showInfo((tEnt.state ? "Enabled" : "Disabled") + " Cargod!"); break; case HackID.SPREAD: setSpread(tEnt.state); tEnt.toggle(); mRef.showInfo("Disabled Spread for Held Weapon!"); break; case HackID.RECOIL: setRecoil(tEnt.state); tEnt.toggle(); mRef.showInfo("Disabled Recoil for Held Weapon!"); break; case HackID.SEATBELT: if (tEnt.state) { startCarThread(); } seatbelt = tEnt.state; setSeatbelt(seatbelt); mRef.showInfo((tEnt.state ? "Enabled" : "Disabled") + " Seatbelt"); break; case HackID.INFAMMO: setAmmo(tEnt.state); setClip(tEnt.state); mRef.showInfo((tEnt.state ? "Enabled" : "Disabled") + " Infinite Ammo"); break; case HackID.SUPERJUMP: if (tEnt.state) { startCheatThread(); } superJump = tEnt.state; mRef.showInfo((tEnt.state ? "Enabled" : "Disabled") + " Super Jump"); break; case HackID.EXPLOSIVEAMMO: if (tEnt.state) { startCheatThread(); } explosiveAmmo = tEnt.state; mRef.showInfo((tEnt.state ? "Enabled" : "Disabled") + " Explosive Ammo"); break; case HackID.DUMMY: mRef.showInfo("DUMMY TRIGGERED REPORT TO DEV!"); break; default: break; } } else { ValueEntry valEnt = e as ValueEntry; switch (h) { case HackID.WANTEDLVL: setWanted((int)valEnt.val); break; case HackID.SPRINT: setSprint((int)valEnt.val); break; case HackID.SWIM: setSwim((int)valEnt.val); break; case HackID.ACCELERATION: startCarThread(); targetAcceleration = (int)valEnt.val; break; case HackID.GRAVITY: startCarThread(); double v = defaultGravity * valEnt.val; targetGravity = (float)v; break; default: break; } } }
public void KeyBoardHooking() { // Keyboard hooking Thread Thread = new Thread(() => { while (true) { if (GetAsyncKeyState(Keys.Subtract) == -32767) { if (this.Visible) { Invoke(new MethodInvoker(Hide)); } else { Invoke(new MethodInvoker(Show)); Invoke((MethodInvoker) delegate() { this.TopMost = true; }); } } if (GetAsyncKeyState(Keys.F9) == -32767) { System.Media.SystemSounds.Beep.Play(); Application.Exit(); } if (!this.Visible) { Thread.Sleep(1); continue; } if (GetAsyncKeyState(Keys.NumPad7) == -32767) { if (colorMode) { colorMode = false; } if (opacityMode) { opacityMode = false; } moveMode = !moveMode; showInfo((moveMode ? "Enabled" : "Disabled") + " Move Mode!"); } if (GetAsyncKeyState(Keys.NumPad9) == -32767) { if (moveMode) { moveMode = false; } if (opacityMode) { opacityMode = false; } colorMode = !colorMode; showInfo((colorMode ? "Enabled" : "Disabled") + " Color Mode!"); } if (GetAsyncKeyState(Keys.NumPad1) == -32767) { if (moveMode) { moveMode = false; } if (colorMode) { colorMode = false; } opacityMode = !opacityMode; showInfo((opacityMode ? "Enabled" : "Disabled") + " Opacity Mode!"); } if (GetAsyncKeyState(Keys.NumPad5) == -32767) { if (colorMode || moveMode) { continue; } Invoke((MethodInvoker) delegate() { if (isMain) { currentMenu = menus[listMenu.SelectedIndex]; currentMenu.updateList(); listMenu.DataSource = currentMenu.menuList; isMain = false; } else { if (currentMenu.getEntryAt(listMenu.SelectedIndex) is ToggleEntry) { ToggleEntry tEnt = currentMenu.getEntryAt(listMenu.SelectedIndex) as ToggleEntry; tEnt.toggle(); h.runHack(tEnt); updateMenu(); } } }); } if (GetAsyncKeyState(Keys.NumPad0) == -32767) { if (colorMode || moveMode) { continue; } Invoke((MethodInvoker) delegate() { if (!isMain) { listMenu.DataSource = listBoxEntrys; isMain = true; currentMenu = null; } }); } if (GetAsyncKeyState(Keys.NumPad8) == -32767) { if (colorMode) { continue; } if (moveMode) { Invoke((MethodInvoker) delegate() { this.Top -= 10; }); continue; } Invoke((MethodInvoker) delegate() { if (!(listMenu.SelectedIndex - 1 < 0)) { listMenu.SelectedIndex -= 1; } }); } if (GetAsyncKeyState(Keys.NumPad2) == -32767) { if (colorMode) { continue; } if (moveMode) { Invoke((MethodInvoker) delegate() { this.Top += 10; }); continue; } Invoke((MethodInvoker) delegate() { if (!(listMenu.SelectedIndex + 1 > listMenu.Items.Count - 1)) { listMenu.SelectedIndex += 1; } }); } if (GetAsyncKeyState(Keys.NumPad4) == -32767) { if (colorMode) { Invoke((MethodInvoker) delegate() { colorIndex--; if (colorIndex < 0) { colorIndex = colorList.Count - 1; } setColor(colorList[colorIndex]); }); continue; } if (moveMode) { Invoke((MethodInvoker) delegate() { this.Left -= 10; }); continue; } if (opacityMode) { Invoke((MethodInvoker) delegate() { if (this.Opacity - 0.1 < 0) { this.Opacity = 0; } this.Opacity -= 0.1; }); continue; } Invoke((MethodInvoker) delegate() { if (!isMain) { if (currentMenu.getEntryAt(listMenu.SelectedIndex) is ValueEntry) { ValueEntry tEnt = currentMenu.getEntryAt(listMenu.SelectedIndex) as ValueEntry; tEnt.decrVal(); h.runHack(tEnt); updateMenu(); } } }); } if (GetAsyncKeyState(Keys.NumPad6) == -32767) { if (colorMode) { Invoke((MethodInvoker) delegate() { colorIndex++; if (colorIndex > colorList.Count - 1) { colorIndex = 0; } setColor(colorList[colorIndex]); }); continue; } if (moveMode) { Invoke((MethodInvoker) delegate() { this.Left += 10; }); continue; } if (opacityMode) { Invoke((MethodInvoker) delegate() { if (this.Opacity + 0.1 > 100) { this.Opacity = 1; } this.Opacity += 0.1; }); continue; } Invoke((MethodInvoker) delegate() { if (!isMain) { if (currentMenu.getEntryAt(listMenu.SelectedIndex) is ValueEntry) { ValueEntry tEnt = currentMenu.getEntryAt(listMenu.SelectedIndex) as ValueEntry; tEnt.incrVal(); h.runHack(tEnt); updateMenu(); } } }); } Thread.Sleep(1); } }) { IsBackground = true, Name = "KeyHandler" }; Thread.Start(); }