找传奇、传世资源到传世资源站!

C#实现游戏外挂源码(血战上海滩等游)

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

这里有两个是我用C#写的游戏外挂,一款是风靡一时的植物大战僵尸,另一款是高中时候喜欢玩的游戏血战上海滩,源码里所说的游戏基址,要通过工具来查询,这个工具需要我们的程序员懂得一点点汇编才能够真正的应用它,如果不懂,就看看汇编的资料,不要一看到汇编就说难,不要被困难而吓倒,其实到了最后,你会觉得很值得,不仅丰富了你的知识,而且又收获了玩游戏时开外 from clipboardfrom clipboard
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace XZshanhai{ public partial class Form1 : Form { #region 属性 private int baseAddress = 0x005DCFE4; //游戏内存基址 private string processName = "shanghai"; //游戏进程名字 #endregion public Form1() { InitializeComponent(); } //读取制定内存中的值 public int ReadMemoryValue(int baseAdd) //读取内存值 { return Helper.ReadMemoryValue(baseAdd, processName); } //将值写入指定内存中 public void WriteMemory(int baseAdd, int value) //写入内存值 { Helper.WriteMemoryValue(baseAdd, processName, value); } #region 武器事件 private void btLift_Click(object sender, EventArgs e) //生命 { if (Helper.GetPidByProcessName(processName) == 0) { MessageBox.Show("请先运行游戏!"); return; } if (btLift.Text.ToString() == "无限生命") { timer8.Enabled = true; btLift.Text = "关闭无限生命"; } else { timer8.Enabled = false; btLift.Text = "无限生命"; } } private void btPistol_Click(object sender, EventArgs e) //手枪 { if (Helper.GetPidByProcessName(processName) == 0) { MessageBox.Show("请先运行游戏!"); return; } if (btPistol.Text.ToString() == "手枪") { timer1.Enabled = true; btPistol.Text = "关闭手枪"; } else { timer1.Enabled = false; btPistol.Text = "手枪"; } } private void btRifle_Click(object sender, EventArgs e) //步枪 { if (Helper.GetPidByProcessName(processName) == 0) { MessageBox.Show("请先运行游戏!"); return; } if (btRifle.Text.ToString() == "步枪") { timer2.Enabled = true; btRifle.Text = "关闭步枪"; //激活步枪 int address = ReadMemoryValue(baseAddress); //读取基址(该地址不会改变) address = address 0x108;//获取2级地址 WriteMemory(address, 0x1); //写入数据到地址 } else { timer2.Enabled = false; btRifle.Text = "步枪"; } } private void btSubmachine_Click(object sender, EventArgs e) //冲锋枪 { if (Helper.GetPidByProcessName(processName) == 0) { MessageBox.Show("请先运行游戏!"); return; } if (btSubmachine.Text.ToString() == "冲锋枪") { timer3.Enabled = true; btSubmachine.Text = "关闭冲锋枪"; //激活冲锋枪 int address = ReadMemoryValue(baseAddress); //读取基址(该地址不会改变) address = address 0x128;//获取2级地址 WriteMemory(address, 0x1); //写入数据到地址 } else { timer3.Enabled = false; btSubmachine.Text = "冲锋枪"; } } private void btGrenade_Click(object sender, EventArgs e) //手榴弹 { if (Helper.GetPidByProcessName(processName) == 0) { MessageBox.Show("请先运行游戏!"); return; } if (btGrenade.Text.ToString() == "手榴弹") { timer4.Enabled = true; btGrenade.Text = "关闭手榴弹"; //激活手榴弹 int address = ReadMemoryValue(baseAddress); //读取基址(该地址不会改变) address = address 0x118;//获取2级地址 WriteMemory(address, 0x1); //写入数据到地址 } else { timer4.Enabled = false; btGrenade.Text = "手榴弹"; } } private void btLMG_Click(object sender, EventArgs e) //轻机枪 { if (Helper.GetPidByProcessName(processName) == 0) { MessageBox.Show("请先运行游戏!"); return; } if (btLMG.Text.ToString() == "轻机枪") { timer5.Enabled = true; btLMG.Text = "关闭轻机枪"; //激活轻机枪 int address = ReadMemoryValue(baseAddress); //读取基址(该地址不会改变) address = address 0x158;//获取2级地址 WriteMemory(address, 0x1); //写入数据到地址 } else { timer5.Enabled = false; btLMG.Text = "轻机枪"; } } private void btBazooka_Click(object sender, EventArgs e) //巴祖卡 { if (Helper.GetPidByProcessName(processName) == 0) { MessageBox.Show("请先运行游戏!"); return; } if (btBazooka.Text.ToString() == "巴祖卡") { timer6.Enabled = true; btBazooka.Text = "关闭巴祖卡"; //激活巴祖卡 int address = ReadMemoryValue(baseAddress); //读取基址(该地址不会改变) address = address 0x148;//获取2级地址 WriteMemory(address, 0x1); //写入数据到地址 } else { timer6.Enabled = false; btBazooka.Text = "巴祖卡"; } } private void btMaximgun_Click(object sender, EventArgs e) //马克沁 { if (Helper.GetPidByProcessName(processName) == 0) { MessageBox.Show("请先运行游戏!"); return; } if (btMaximgun.Text.ToString() == "马克沁") { timer7.Enabled = true; btMaximgun.Text = "关闭马克沁"; //激活马克沁 int address = ReadMemoryValue(baseAddress); //读取基址(该地址不会改变) address = address 0x138;//获取2级地址 WriteMemory(address, 0x1); //写入数据到地址 } else { timer7.Enabled = false; btMaximgun.Text = "马克沁"; } } #endregion #region 写入内存值 private void timer8_Tick(object sender, EventArgs e) //生命 { int address = ReadMemoryValue(baseAddress); //读取基址(该地址不会改变) address = address 0x174;//获取2级地址 WriteMemory(address, 0x64); //写入数据到地址(0x1869F表示99999) } private void timer1_Tick(object sender, EventArgs e) // 手枪 { int address = ReadMemoryValue(baseAddress); //读取基址(该地址不会改变) address = address 0xec;//获取2级地址 WriteMemory(address, 0xA); //写入数据到地址(0x1869F表示99999) } private void timer2_Tick(object sender, EventArgs e) //步枪 { int address = ReadMemoryValue(baseAddress); //读取基址(该地址不会改变) address = address 0xec 0x10;//获取2级地址 WriteMemory(address, 0x5); //写入数据到地址(0x1869F表示99999) } private void timer3_Tick(object sender, EventArgs e) //冲锋枪 { int address = ReadMemoryValue(baseAddress); //读取基址(该地址不会改变) address = address 0xec 0x30;//获取2级地址 WriteMemory(address, 0x1E); //写入数据到地址(0x1869F表示99999) } private void timer4_Tick(object sender, EventArgs e) //手榴弹 { int address = ReadMemoryValue(baseAddress); //读取基址(该地址不会改变) address = address 0xec 0x20;//获取2级地址 WriteMemory(address, 0x5); //写入数据到地址(0x1869F表示99999) } private void timer5_Tick(object sender, EventArgs e) //机枪 { int address = ReadMemoryValue(baseAddress); //读取基址(该地址不会改变) address = address 0xec 0x60;//获取2级地址 WriteMemory(address, 0x1E); //写入数据到地址(0x1869F表示99999) } private void timer6_Tick(object sender, EventArgs e) //巴祖卡 { int address = ReadMemoryValue(baseAddress); //读取基址(该地址不会改变) address = address 0xec 0x50;//获取2级地址 WriteMemory(address, 0x8); //写入数据到地址(0x1869F表示99999) } private void timer7_Tick(object sender, EventArgs e) //马克沁 { int address = ReadMemoryValue(baseAddress); //读取基址(该地址不会改变) address = address 0xec 0x40;//获取2级地址 WriteMemory(address, 0xC8); //写入数据到地址(0x1869F表示99999) } #endregion private void btClose_Click(object sender, EventArgs e) //关闭 { this.Close(); } #region 移动窗体 private Point startPoint = new Point(); //鼠标起点位置 private Point endPoint = new Point(); //鼠标移动后的位置 private bool move = false; //窗体是否移动 private void pictureBox1_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { move = true; startPoint.X = e.X; startPoint.Y = e.Y; } else move = false; } private void pictureBox1_MouseMove(object sender, MouseEventArgs e) { if (move == true) { endPoint.X = e.X; endPoint.Y = e.Y; int moveX = endPoint.X - startPoint.X; int moveY = endPoint.Y - startPoint.Y; this.Location = new Point(this.Location.X moveX, this.Location.Y moveY); } } private void pictureBox1_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { move = false; } else move = true; } #endregion #region 键盘勾子 //勾子管理类 private KeyboardHookLib _keyboardHook = null; private void Form1_Load(object sender, EventArgs e) { //安装勾子 _keyboardHook = new KeyboardHookLib(); _keyboardHook.InstallHook(this.OnKeyPress); } private void Form1_FormClosing(object sender, FormClosingEventArgs e) { //取消勾子 if (_keyboardHook != null) _keyboardHook.UninstallHook(); } /// <summary> /// 客户端键盘捕捉事件. /// </summary> /// <param name="hookStruct">由Hook程序发送的按键信息</param> /// <param name="handle">是否拦截</param> public void OnKeyPress(KeyboardHookLib.HookStruct hookStruct, out bool handle) { handle = false; //预设不拦截任何键 //截获F1 if (hookStruct.vkCode == (int)Keys.F1) {handle = true; btPistol_Click(null, null); } } #endregion }}

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复