[c++]Identifier not found

Discussion in 'Mixed Languages' started by stevemk14ebr, May 25, 2013.

  1. stevemk14ebr

    stevemk14ebr MDL Senior Member

    Jun 23, 2010
    267
    48
    10
    #1 stevemk14ebr, May 25, 2013
    Last edited by a moderator: Apr 20, 2017
    Learning c++ and it's value in game hacking (recreational only) i'm using offsets from another forum to read adresses and im not sure if their right so don't bother trying to use them i just need help understanding why it says identifier not not found when i call the getvelocity function

    Code:
    #include <windows.h>
    #include <stdio.h>
    #include <iostream>
    #include <conio.h>
    #include <string>
    #include <fstream>
    #include <float.h>
    
    float GetVelocity(HANDLE hProc)
    {
    //THIS IS XERWELLS FUNCTION I'M USING IT TO LEARN, 
    DWORD ClientGameContext=0x1F73E54 + 0x400000;//is this the right clientgamecontext location?
        DWORD Buffer;
        float CurrentSpeed = 1;
    HANDLE bf3hndl=GetCurrentProcess();//this should return the handle right?
        ReadProcessMemory(bf3hndl, (LPCVOID)(ClientGameContext), &Buffer, 4, NULL);
        ReadProcessMemory(bf3hndl, (LPCVOID)(Buffer + 0x30), (void*)&Buffer, sizeof(Buffer), NULL);
        ReadProcessMemory(bf3hndl, (LPCVOID)(Buffer + 0xbc), (void*)&Buffer, sizeof(Buffer), NULL);
        ReadProcessMemory(bf3hndl, (LPCVOID)(Buffer + 0x3D8), (void*)&Buffer, sizeof(Buffer), NULL);
        ReadProcessMemory(bf3hndl, (LPCVOID)(Buffer + 0x98), &CurrentSpeed, sizeof(CurrentSpeed), NULL);
    
        CurrentSpeed = CurrentSpeed * 3.6f;
        return CurrentSpeed;
    }  
     DWORD WINAPI LoopFunction( LPVOID lpParam  )
    {
    HANDLE bf3=GetCurrentProcess;
    //I get and error of identifier not found on GetVelocity why, it's already declared right?
    if(GetVelocity(bf3)<212)
    {
      keybd_event(VkKeyScan('W'),0xb8,0 , 0);
    Sleep(200);
    keybd_event(VkKeyScan('W'),0xb8,KEYEVENTF_KEYUP , 0); 
    }
    
        
    }
    
    BOOL WINAPI DllMain (HINSTANCE hModule, DWORD dwAttached, LPVOID lpvReserved)
    {
        if (dwAttached == DLL_PROCESS_ATTACH) {
            CreateThread(NULL,0,&LoopFunction,NULL,0,NULL);
        }
        return 1;
    }
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. stevemk14ebr

    stevemk14ebr MDL Senior Member

    Jun 23, 2010
    267
    48
    10
    #2 stevemk14ebr, May 27, 2013
    Last edited by a moderator: Apr 20, 2017
    (OP)
    found the solution to anyone who's interested (i know not many care about c++ on this forum :D) but replace
    Code:
     CreateThread(NULL,0,&LoopFunction,NULL,0,NULL);
    with this
    Code:
     CreateThread(NULL,0,LoopFunction,NULL,0,NULL);
    and add a
    Code:
    return 1
    to the loop function and change
    Code:
    DWORD ClientGameContext=0x1F73E54 + 0x400000
    to this
    Code:
    DWORD ClientGameContext = 0x02380B58;
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...