Help How to coding C++/C# for SA:MP/GTA SA and inject it to SA:MP

rottentwinkie

Moderator
Moderator
Joined
Apr 4, 2014
Messages
608
Reaction score
3
As the title said above, how to do it?
I see some people like [member=2]0x688[/member] [member=111]springfield[/member] and [member=60]Opcode.eXe[/member] make an .exe version of a hack and it works succesfully to the game. That's why I want to know, how did he connect C++/C# to SA:MP / GTA SA?
 

Opcode.eXe

Expert
Joined
Feb 18, 2013
Messages
1,488
Reaction score
231
Location
( ͡° ͜ʖ ͡°)
Whaaat? My .exe just reads memory & writes memory..
Look at it?
Code:
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <windows.h>
#include <tlhelp32.h>

using namespace std;

int main()
{
    SetConsoleTitle("FreezeRotation.eXe by Opcode.eXe");
    cout << "FreezeRotation - makes your car hard like 0x688 nipples!" << endl;
    cout << "Looking for GTA:SA:MP window." << endl;
    // MA VARIABLES
    DWORD pId;
    DWORD dwOldProtect = 0;
    HANDLE pHandle;
    HWND hWnd = 0;
    DWORD vpointer = 0;
    DWORD collflags;
    DWORD spin;
    BYTE inair;
    float zero = 0.0;
    while(hWnd == 0){
        hWnd = FindWindow(0, "GTA:SA:MP");
        Sleep(100);
    }
    cout << "Just found the window. FreezeRotation has been started." << endl;

    GetWindowThreadProcessId(hWnd, &pId);
    pHandle = OpenProcess(PROCESS_ALL_ACCESS|PROCESS_VM_OPERATION, TRUE, pId);

    while(true){
        ReadProcessMemory(pHandle, (LPCVOID)0xBA18FC, &vpointer, 4, 0);
        if(vpointer >= 1)
        {
            collflags = vpointer + 185;
            ReadProcessMemory(pHandle, (LPCVOID)collflags, &inair, 1, 0);
            if(inair == false){
                WriteProcessMemory(pHandle, (LPVOID)(vpointer + 0x50), (LPVOID)&zero, 4, NULL);
                WriteProcessMemory(pHandle, (LPVOID)(vpointer + 0x50 + 4), (LPVOID)&zero, 4, NULL);
                WriteProcessMemory(pHandle, (LPVOID)(vpointer + 0x50 + 8), (LPVOID)&zero, 4, NULL);
            }
        }
        Sleep(10);
    }
    CloseHandle(pHandle);
    return 0;
}

You can copy and paste it into any c++ IDE COMPILER IDK whatever and it will work
 
Top