How to check for Keyboard Input.

FyMa2618

New member
Joined
Jun 29, 2021
Messages
3
Programming Experience
Beginner
Good day,
i develope a plugin whit C# and beepinex in Visual studio.
And i am want to check if ... key is pressed, i searched allot about this theme but i found nothink what can i do?

C#:
using UnityEngine;
using System.Collections;
using BepInEx;
using HarmonyLib;

namespace SetOwnValues
{
    [BepInPlugin(modGUID, modName, modVersion)]
    [BepInProcess("Muck.exe")]
    public class SetOwnValues : BaseUnityPlugin
    {

        private const string modGUID = "MrPogramm.SetOwnValues";
        private const string modName = "SetOwnValues by MrPogramm";
        private const string modVersion = "0.0.0.1";
        private readonly Harmony harmony = new Harmony(modGUID);

        void Awake()
        {
            harmony.PatchAll();
        }


        [HarmonyPatch(typeof(PlayerMovement), "Update")]
        class SetSpeed
        {
            [HarmonyPrefix]
            static void setWalkSpeed(ref float ___maxWalkSpeed, ref float ___maxRunSpeed)
            {
               //CHeck her for Input

                ___maxWalkSpeed = 70.8f;
                ___maxRunSpeed = 250f;
            }
        }
    }
}
 
Last edited:
Personally, I don't support hacking into other people's games. If you want to change the behavior of the game, use the game's official modding mechanisms instead of injecting code into their game.

Hopefully someone will help you with this task.
 
Personally, I don't support hacking into other people's games. If you want to change the behavior of the game, use the game's official modding mechanisms instead of injecting code into their game.

Hopefully someone will help you with this task.
I dont want to hack in the game i want to make a mod for this game where you can select different options usw.
 
But you are hacking into the game by injecting code into it.
 
What do people use Bepinex for? BepInEx hacking - Google Search
The reason they are using Harmony is so they don't need to alter the Authors own dll files which would of course result in the likes of BattleEye and Punkbuster banning them for using altered files. Instead, this method allows them to override game-hooks directly. Gladly, this type of hacking is also easily detectable by anti-cheat engines. Skydiver look up the Harmony library and it will tell you all you need to know about it for a valid reason to close this topic.

Regardless what your intentions are, I won't be helping you with this, and I don't think anyone else will either.
 
Unlike D.I.C. which has a strict no hacking/game cheat/trainer policy, C# Forums is much more lenient so I won't close this topic as much as I'd like to.

I won't be helping with effort to hack a game, but perhaps some other people on this forum may wish to help him.
 
When I was on the staff board, @Neal said it was moderators discretion to choose what to do on par-individual topics.

It should be noted, that these files have the potential to cause a lot of headache for users of a game, as well as anyone operating a network where cheats are used.

Whatever, it's not my decision to make.
 
When I was on the staff board, @Neal said it was moderators discretion to choose what to do on par-individual topics.

It should be noted, that these files have the potential to cause a lot of headache for users of a game, as well as anyone operating a network where cheats are used.

Whatever, it's not my decision to make.
I dont understand why its cheating, because Mods are in games like Minecraft, Valheim usw.
 
Yes, but most of those mods are using the actual mechanism for the mods to be put into the game. You are bypassing that forcing your way into a game using BepIn and Harmony.
 
I dont understand why its cheating
Let me try to explain my reasoning so you don't think I am being an outright asshole by choosing not to help you and for no reason at all. Why I hate cheats, and cheaters.....

Firstly, your method to make a mod for a game can also be the method used to build cheats. While this may not be your intention and probably isn't, it may be the intention of the person who finds this topic after you. And any source code we share with you may also fall into the wrong hands.

If our source code gets used for malicious intent, and if a person reuses our code, they can do all kinds of nasty things with it, such as building in a whole range of network attack tools to run from the client they are connected as. Because that is what happened with the BattleField 2 game made by Dice, and published by EA games. And I know this first hand, because I run a hosting company, and have done all my life. I used to host game-servers until us, the hosting providers became the target of ddos and other network attacks just by hosting game-servers for our customers. I used to host BF2, Cod, Minecraft, Arma servers and a range of other games until cheats were made to target hosting network infrastructure. A new low, even for cheaters!

Let me tell you a little story and share some of my background so you get a clear understanding of where I am coming from? I spent a few years working as a network engineer and an anti-cheat engineer.

While I was hosting game-servers, I was working as a programmer for a big game dev company. I was also working with Glen out of EvenBalance (PunkBuster) on a new streaming hub technology used in conjunction with PunkBusters PBUCON. I was offering a streaming service similar to PBBans. Basically it allowed us to act as a front-door to hold our own ban list of player GUID's of reported players whom EvenBalance were unable to ban due to sufficient evidence of cheating. Ie cheaters would use a screen blocker, which prohibit PunkBuster software from screenshotting the users gaming screen, essentially hiding their cheat overlays. Our streaming hubs built up data over time, which allowed us to make this call for ourselves. This exempted EvenBalance from being implicated directly with a users ban while our hubs would place on a cheaters GUID.

Because we were able to hold our own master ban index, we could prevent certain GUID's from connecting to our streaming hubs, and in-turn block cheaters from connecting to servers who streamed their PunkBuster server data to us first. Back then, there was a lot more of us running streaming hubs than today, and the gaming companies didn't like this, and so they began making their games use in-house server hosting so streaming hubs like ours became obsolete as we had no direct access to the servers configs of the major games we were targeting.

Why did they do this? Because humans are disgusting greedy people who only care about money. The fact of the matter is; that the gaming industry was making huge money out of banning GUID's; both legitimately and illegitimately. If your GUID gets banned, you need to buy a new CD key to get back onto the game. $$$ :) While we were banning people too, it wasn't something the gaming companies wanted. They didn't want a bunch of streaming hubs providing safe cheater free servers, which is why they all go in-house today and stream to other "anti-cheat" providers which the gaming companies also own. Gaming companies did this because they were making massive money from selling cheats too. Those companies I shall not name.

The reality is that the gaming industry is just like the OS/software industry. The people who provide you with a "safe" OS for your PC, laptop and phones are also creating the vulnerabilities for anti-virus/malware companies to profit from by offering you "protection". I will never post code online that can contribute to the cheating industry because I have seen the damage it has done over the years in what I can only call a corrupted industry of degenerate corporations. It's technically killed game-server hosting for the hosting industry. So as you can read on below, these "mods" you talk of have the potential to be loaded with all sorts of troublesome scripts.

This is why our streaming service was created, to prevent this type of crap : Vehicle Spam Script. (One of a million examples I can give). That was originally a cheat to vehicle drop your own jeep, but the code was posted to a hacking forum and it was later turned into a vehicle spam script by 1337hacks who's purpose was to crash connected clients to desktop as well as crashing the server it was executed against. It was known as the kill-switch script that killed BattleField2. The guy who made that hack was a Harvard University programming student, and was eventually tracked down and charged for criminal damage. So if you are making cheats to sell, don't think you are immune because you are behind a PC. Now you know why I don't support topics like this. The other devs on here may have their own stories to tell and reasons to give on why they don't participate in these type of topics either.

There are horror stories you can read regarding how gaming is being destroyed by the influx of code dumps on forums similar to this one which helped likeminded cheaters alike to build their own versions of game cheats. One of the ways we fought back in our anti-cheat community was by putting the hosting companies of these websites hosting these scripts/cheats on court notice in the country they where operating from. Forcing their hand to terminate the websites hosting service or be sued for abetting criminal damage and loss of earnings.

Forum owners like CSharpForums can face lawful ramifications for the content hosted on their website which is why most code forums prohibit these types of topics to begin with. Cheats are having a major effect on gaming today and script kiddies could do with less help from the coding community in my opinion.

Hope you understand now. The gaming industry is already very corrupt, and it doesn't need your help to make it even richer.

D.I.C. which has a strict no hacking/game cheat/trainer policy
I used my first computer for hacking and penetrating networks. Then I grew a brain and tried putting it to better use. Today I give advice on securing networks and system infrastructure as you are well aware.
 
I was missing a line at the end which made my quote irrelevant lol. My point was if dic has a really strict policy, that's me kicked off the board. ;)?
 
The DIC policy is just to automatically close the thread even if the game authors/publishers support modding, hacking, game cheats, trainers. I think it's to address the legal concerns you wrote about above.
 
Back
Top Bottom