How to log value changes and store them to txt file?

Discussions Related to Game Hacking and Memory Hacking Software

Moderators: g3nuin3, SpeedWing, WhiteHat, mezzo

Re: How to log value changes and store them to txt file?

Postby bogdan » Tue Jan 18, 2011 4:04 pm

Well this is the final code for single player. Thanks L. Spiro.

Code: Select all

/*Script for MHS that loggs in a .txt file the X,Y,Z coordinates of a Quake2 player */


bool myVal=true;
//Define boolean variable used to start and stop de process.

void On_HK_2() { 
    //On hotkey "2"
    // Run SaveValues() on a second thread so that MHS won't be locked.
    CloseHandle( CreateThread("SaveValues",0) );
    // Main MHS thread continues, giving MHS control.  SaveValues() runs on another thread.
}
   
    void SaveValues() {
    myVal=true;
    //if the value is false from a previous process, change it to true.
    FILE * pFile;
    EVAL_RET_TYPE ertRetX;
    EVAL_RET_TYPE ertRetY;
    EVAL_RET_TYPE ertRetZ;

    do {
        EvalExp( "f[quake2.exe+c2d70]", &ertRetX, false );
        EvalExp( "f[quake2.exe+c2d74]", &ertRetY, false );
        EvalExp( "f[quake2.exe+c2d78]", &ertRetZ, false );
        //get the X,Y,Z values from memory in float format. f[].
       
        pFile = FOpen ("logfile.txt","a");
        //open logfile.txt for appending.
      
        FPrintF(pFile, "x= %f\n",ertRetX.u.dDouble); //write X
        FPrintF(pFile, "y= %f\n",ertRetY.u.dDouble); //write Y
        FPrintF(pFile, "z= %f\n",ertRetZ.u.dDouble); //write Z
        FClose (pFile);
        Sleep(1000); // wait for 1 second.
    }
    while (myVal == true);

}

void On_HK_3() {
    myVal=false;
    //on hotkey "3" change from true to false to stop the process.
}

bogdan
I Have A Few Questions
 
Posts: 7
Joined: Sat Jan 08, 2011 1:04 am

Previous

Return to General Related Discussions

Who is online

Users browsing this forum: No registered users and 0 guests