HelpπŸ™ C++ code

Posts 1–3 of 3 Β· Page 1 of 1
πŸ™ C++ code
Is it possible to put This cod in dll file? to inject in gta_sa plz Help

Code:
#include <cstdlib>
#include <iostream>
#include <windows.h>

#define gProc hProc //lol ye examples and source codes sometimes confusing me
#define ALT VK_MENU
HWND GTASA;

using namespace std;

int money = 0xB7CE50;
int gravity = 0x863984;
int wep1 = 0x969130;
int wep2 = 0x969131;
int wep3 = 0x969132;


bool get_gta_window(HWND GTA)
{
    GTA = FindWindow(NULL, "GTA:SA");
    if(!GTA)
    {
        MessageBox(NULL, "GTA San Andreas not found.", "FAIL", MB_ICONERROR);
        MessageBox(NULL, "Exitig.", "FAIL", MB_ICONERROR);
        MessageBox(NULL, "trololo.", "FAIL", MB_ICONERROR);
        exit(0);
    }
}

void give_monkey(int amt)
{
    DWORD dwID;
    HANDLE hProc;

    HWND sa;
    get_gta_window(sa);
    GetWindowThreadProcessId(sa, &dwID);
    hProc = OpenProcess(PROCESS_ALL_ACCESS, 0, dwID);
    WriteProcessMemory(hProc, (LPVOID)money, (LPVOID)amt, sizeof(amt), NULL );

}

void change_gravity(int amt)
{
    DWORD dwID;
    HANDLE hProc;

    HWND sa;
    get_gta_window(sa);
    GetWindowThreadProcessId(sa, &dwID);
    hProc = OpenProcess(PROCESS_ALL_ACCESS, 0, dwID);
    WriteProcessMemory(hProc, (LPVOID)gravity, (LPVOID)amt, sizeof(amt), NULL );

}

void give_weapon_set(int which_one)
{
     DWORD dwID;
    HANDLE hProc;

    HWND sa;
    get_gta_window(sa);
    GetWindowThreadProcessId(sa, &dwID);
    hProc = OpenProcess(PROCESS_ALL_ACCESS, 0, dwID);
    
    switch(which_one)
    {
        case 1:
        WriteProcessMemory(hProc, (LPVOID)wep1, (LPVOID)1, sizeof(1), NULL );
        break;
        
        case 2:
        WriteProcessMemory(hProc, (LPVOID)wep2, (LPVOID)1, sizeof(1), NULL );
        break;
        
        case 3:
        WriteProcessMemory(hProc, (LPVOID)wep3, (LPVOID)1, sizeof(1), NULL );
        break;
   }
}


void get_hot_keys()
{
while(1)
            {
                if(GetAsyncKeyState(ALT) && GetAsyncKeyState(VK_F1))
                {
                        give_monkey(99999);
                }
                

                if(GetAsyncKeyState(ALT) && GetAsyncKeyState(VK_F2))
                {
                       change_gravity(200);
                }
                
                if(GetAsyncKeyState(ALT) && GetAsyncKeyState(VK_F3))
                {
                        give_weapon_set(1);
                }
                if(GetAsyncKeyState(ALT) && GetAsyncKeyState(VK_F4))
                {
                        give_weapon_set(2);
                }
                if(GetAsyncKeyState(ALT) && GetAsyncKeyState(VK_F5))
                {
                        give_weapon_set(3);
                }
            }
}


int main(int argc, char *argv[])
{
    printf("ALT + F1 for 999999 money\nALT + F2 low gravity\nALT + F3 weapon set 1\nALT + F4 weapon set 2\nALT + F5 weapon set 3");
    while(1)
    {
            if(get_gta_window(GTASA))
            { 
            get_hot_keys();
             }
            
    }
}
If you can please help
Yes it is possible.
Treat your main function as a separate thread.
Create the thread from the Dll entry point.
Yes, learn C++.
Posts 1–3 of 3 Β· Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us