c# - 正确使用控制台输入
问题描述
我是 C# 新手,想知道是否有人可以帮助我。我正在尝试仅将控制台输入的整数写入游戏内存。Atm 的问题是它试图写“/fov”+int,这不起作用。
这是我的代码
string input = Console.ReadLine();
int number = Convert.ToInt32(Console.ReadLine());
if (input.ToLower().Equals("/fov ") && number >= 10 && number <= 150)
{
m.WriteMemory("game.exe+0x176DCF", "bytes", "0x90 0x90 0x90");
m.WriteMemory("game.exe+0x176BC9", "bytes", "0x90 0x90 0x90");
m.WriteMemory("game.exe+0x00DB80E4,0x40,0x18", "Int", "" +number);
}
解决方案
欢迎来到 StackOverflow。
你试过使用Int32.Parse()
方法吗?
换行
int number = Convert.ToInt32(Console.ReadLine());
和
int number = Int32.Parse(Console.ReadLine())
希望它有效!如果您有更多问题,请告诉我们:)
推荐阅读
- reactjs - 反应不立即显示当前状态
- graph - 为什么 Grakn 在关系上使用名词语义而不是动词?
- sql - 给定多个键的组合,在树中找到最佳匹配
- php - 返回行以及数组值的选项
- visual-studio-code - vs代码上的乳胶文件在保存时不会自动编译
- vba - 访问表单 - 查找表中的组合框,将查找值文本更新为 LookupID - 没有代码告诉它
- c - 使用c中的指针对数组求和
- python - 如何借助列表 url 和 python 下载图像,但并非所有 url 都处于活动状态?
- r - R中句子的部分匹配词
- laravel - 如何使用控制器在 laravel 中运行 Binance api