首页 > 解决方案 > 正确使用控制台输入

问题描述

我是 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);
    }

标签: c#consoleconsole-application

解决方案


欢迎来到 StackOverflow。

你试过使用Int32.Parse()方法吗?

换行

int number = Convert.ToInt32(Console.ReadLine());

int number = Int32.Parse(Console.ReadLine())

希望它有效!如果您有更多问题,请告诉我们:)


推荐阅读