Solved CS:S Ammo/Health Trainer - Help

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

zepixxx

Newbie
Full Member
Apr 14, 2014
8
122
0
Hello all. I just need some help With the CS:S trainer, can't get the trainer to work. I found the static address and it worked after closing and opening the game using cheat engine. But It does not work after compiling. Probably a noobie mistake. I have been searching here on the forum but did not find anything that could help me. I would apreciate it if someone could point out my mistake. Thanks a ton all of you!



C++:
#include <iostream>
#include <Windows.h>
#include <string>
#include <ctime>

DWORD FindDmaAddy(int PointerLevel, HANDLE hProcHandle, DWORD Offsets[], DWORD BaseAddress);
void WriteToMemory(HANDLE hProcHandle);
DWORD HealthAddressToWrite;
DWORD AmmoAddressToWrite;


std::string GameName = "Counter-Strike Source";
LPCSTR LGameWindow = "Counter-Strike Source"; // Input Game Window Name
std::string GameStatus;

bool IsGameAvail;
bool UpdateOnNextRun;

// AMMO VARS

bool AmmoStatus;
BYTE AmmoValue[] = {0XE7, 0X0, 0X0, 0X0};
DWORD AmmoBaseAddress = {0X0D297000};
DWORD AmmoOffsets[] = {0X4AC};


// HEALTH VARS

bool HealthStatus;
BYTE HealthValue[] = {0XC8, 0X0, 0X0, 0X0};
DWORD HealthBaseAddress = {0X58B452F8};
DWORD HealthOffsets[] = {0XE0};



int main()
{
    HWND hGameWindow = NULL;
    int TimeSinceLastUpdate = clock();
    int GameAvailTMR = clock();
    int onePressTMR = clock();
    DWORD dwProcID = NULL;
    HANDLE hProcHandle = NULL;
    UpdateOnNextRun = true;
    std::string sAmmoStatus = "OFF";
    std::string sHealthStatus = "OFF";


    while(!GetAsyncKeyState(VK_INSERT))
    {

        if(clock() - GameAvailTMR > 100)
        {
            GameAvailTMR = clock();
            IsGameAvail = false;

            hGameWindow = FindWindow(NULL, LGameWindow);
            if(hGameWindow)
            {
                GetWindowThreadProcessId( hGameWindow, &dwProcID );
                if( dwProcID != 0 )
                {
                    hProcHandle = OpenProcess( PROCESS_ALL_ACCESS, FALSE, dwProcID );
                    if( hProcHandle == INVALID_HANDLE_VALUE || hProcHandle == NULL )
                    {
                        GameStatus = "Failed to open process for valid handle";
                    }
                    else
                    {
                        GameStatus = "Counter Strike ready to Hack";
                        IsGameAvail = true;
                    }

                }
                else
                {
                    GameStatus = "Failed to get Process ID";

                }

            }
            else
            {
                GameStatus = "Could not find Game Window";
                

            }

            if(UpdateOnNextRun || clock() - TimeSinceLastUpdate > 5000)
            {
                system("cls");
                std::cout << "***********************************************************" << std::endl;
                std::cout << "                Counter Strike Memory Hack " << std::endl;
                std::cout << "***********************************************************" << std::endl << std::endl;
                std::cout << "GAME STATUS: " << GameStatus << std::endl << std::endl;
                std::cout << "[F1] Unlimited Ammo -> " << sAmmoStatus << " <- " << std::endl << std::endl;
                std::cout << "[F2] Unlimited Health -> " << sHealthStatus << " <- " << std::endl << std::endl;                
                std::cout << "[Insert] Exit" << std::endl;

                UpdateOnNextRun = false;
                TimeSinceLastUpdate = clock();

            }
            
            if(IsGameAvail)
            {
                WriteToMemory(hProcHandle);
            }
        }

        if(clock() - onePressTMR > 400)
        {
            if(IsGameAvail)
            {
                //Ammo
                if(GetAsyncKeyState(VK_F1))
                {
                    onePressTMR = clock();
                    AmmoStatus = !AmmoStatus;
                    UpdateOnNextRun = true;
                    if(AmmoStatus)sAmmoStatus = "ON";
                    else sAmmoStatus = "OFF";
                }
                //Health
                else if(GetAsyncKeyState(VK_F2))
                {
                    onePressTMR = clock();
                    HealthStatus = !HealthStatus;
                    UpdateOnNextRun = true;
                    if(HealthStatus)sHealthStatus = "ON";
                    else sHealthStatus = "OFF";
                }

            }

        }

    }


    return ERROR_SUCCESS;
}




DWORD FindDmaAddy(int PointerLevel, HANDLE hProcHandle, DWORD Offsets[], DWORD BaseAddress)
{
    DWORD pointer = BaseAddress;
    DWORD pTemp;

    DWORD PointerAddr;
    for(int c = 0; c < PointerLevel; c ++)
    {
        if(c == 0)
        {
            ReadProcessMemory(hProcHandle, (LPCVOID)pointer, &pTemp, sizeof(&pTemp), NULL);
        }

        PointerAddr = pTemp + Offsets[c];
        ReadProcessMemory(hProcHandle, (LPCVOID)PointerAddr, &pTemp, sizeof(&pTemp), NULL);
    }
    return PointerAddr;


}


void WriteToMemory(HANDLE hProcHandle)
{
    
    if(AmmoStatus)
    {
        DWORD AmmoAddressToWrite = FindDmaAddy(1, hProcHandle, AmmoOffsets, AmmoBaseAddress);
        WriteProcessMemory(hProcHandle, (BYTE*)AmmoAddressToWrite, &AmmoValue, sizeof(AmmoValue), NULL);

    }
    
    if(HealthStatus)
    {
        DWORD HealthAddressToWrite = FindDmaAddy(1, hProcHandle, HealthOffsets, HealthBaseAddress);
        WriteProcessMemory(hProcHandle, (BYTE*)HealthAddressToWrite, &HealthValue, sizeof(HealthValue), NULL);

    }

}
 
Last edited by a moderator:

squeenie

Hacker
Meme Tier VIP
Dank Tier Donator
Mar 6, 2013
677
5,478
37
If you want to do it on a local server you need to find the addresses + offsets in server.dll not client.dll
 

GAFO666

Hacker
Meme Tier VIP
Aug 19, 2012
520
3,188
23
if you play local against bots and not on a server it may work hmm but in mp ofc not.
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods