The way trainers are usually done is by finding addresses in the game's memory to change what you want and writing a program using API calls like WriteProcessMemory to change the values in the game's memory. Of course, most newer games require assembly hacking because regular stats etc are dynamic (stored somewhere different every time the game runs).
Offline gaming still exists, you know.