The way I deal with it in online games is this.
I'm not going to help the hackers that much so bear with me. I will not mention any programs that I use to do this. You will have to figure that out. The only way to truly stop them is to know one thing. They do not want their hack program to be detected.
So far, all of the hacker/trainer users that I have defeated. The developer of the hack will put a detector on it to see if something is watching. If something is, then the hacker/trainer program will either close automatically on their end or it will only half work.
For instance in dirt 3, trainer users can make your car spinout automatically. But if you put up a detector on your end the cheats own detector will detect it and it will close part of the cheat. Not all of it.
The only part of the trainer program that I have seen effected from my meddling is super brakes(perfect braking) and the spinout(car losing control for no reason). I have mostly racing games as you can see. They are all from codemasters and sadly those games do get abused by cheaters quite often.
I believe that I am only able to stop them because of the way that we connect to each other while playing. It's probably the same reason that they could cause a spinout for a normal player that has no clue about security.
My biggest suggestion is to get a very good internet security antivirus(Norton, Mcafee, Avast, and all the other shitty av's will not help you). Be willing to spend $50 to $90 on a very good av that I have not listed and then learn how to experiment with it to effect online play.
It takes a lot of patience and a lot of guinea pigs. I've had a lot of success with this but also a lot of years of experience in dealing with trainer users. I don't know any code whatsoever. It has nothing to do with it. The code part, is locked down and you can't do anything about it. You could think that you can but it's just not possible to actually stop what they are doing on their end.
You can still ban them with things like VAC because Vac detects signatures and certain behaviors and modifications of files that it already knows about. It only bans the account associated with the cheat.
They don't actually stop the cheat though. They can't be bothered with it. They just ban your account. The other thing that I would like to mention has to do with Wolfenstein ET. A very old game. But to me it had the best and harshest security measure of all.
I never got to see how they did it. I did give them the idea on what would actually stop cheaters and suggested to one of the jaymod devolopers to ban by way of guid. What has an easily accesible guid when playing games? Graphics cards. The reason they implemented that is because people would just change ip addresses and you didn't need an account for the game so you could just change your name, your mac address which would also change your ip address.
But when they did the graphics card bans. If you wanted to play again you had to RMA your card or buy a new one. That's off the subject though. This is supposed to be about detection and I went off on a tangent. Sadly I don't play games nearly as much now. But man I loved all my gunea pigs. Especially the ones from project cars. The only racing game that was not codemasters. But still effected by the same nonsense.