/// <summary> /// Generic way to send data to a COD (async to not make the ui laggy) /// </summary> /// <param name="address"></param> /// <param name="value"></param> private async void setFogAndDofValue(string address, float value) { await Task.Run(() => { if (COD.checkGame() && COD.GameName() == "t6mp") { dynamic cod = COD.Game(); t.Process_Handle(COD.GameName()); t.WriteFloat(cod.GetType().GetProperty(address).GetValue(cod), value); } }); }
public static void Send(string commands) { try { if (COD.checkGame() && commands != String.Empty) { dynamic cod = COD.Game(); t.Process_Handle(COD.GameName()); callbytes = BitConverter.GetBytes(cod.GetType().GetProperty("cbuf_addtext").GetValue(cod)); nop_address = cod.GetType().GetProperty("nop_address").GetValue(cod); t.WriteNOP(nop_address, nopBytes); cbuf_addtext_alloc = t.MemoryAllocation(cbuf_addtext_wrapper); commandbytes = Encoding.ASCII.GetBytes(commands); commandaddress = t.MemoryAllocation(commandbytes); t.WriteBytes(commandaddress, commandbytes); Array.Copy(BitConverter.GetBytes(commandaddress.ToInt64()), 0, cbuf_addtext_wrapper, 9, 4); Array.Copy(callbytes, 0, cbuf_addtext_wrapper, 16, 4); // callbytes t.WriteBytes(cbuf_addtext_alloc, cbuf_addtext_wrapper); t.CreateRemoteThread(cbuf_addtext_alloc); t.FreeMemomryAllocation(cbuf_addtext_alloc, cbuf_addtext_wrapper); t.FreeMemomryAllocation(commandaddress, commandbytes); cbuf_addtext_alloc = IntPtr.Zero; } else if (commands == String.Empty) { MessageBox.Show("Please type in a command before pressing Send button", "Error", MessageBoxButtons.OK); } else if (!COD.checkGame()) { MessageBox.Show("No game detected", "Error", MessageBoxButtons.OK); } } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK); } }