Basic tut on using C++ for GunZ

On martes, 26 de abril de 2011 0 comentarios

#include 
#include "ZFuncs.h"


char* ChatInput( )
{
 return( char* ) ( ZGetGameInterface( ) + 0x3A6 /*Or 0x3A8*/ );
}


  void MyThread()
{
 for(;;Sleep(20)) 
  {
if( memcmp( ChatInput( ), "/dood", 4 ) == 0 )
        { 
   ZCharacter::SetHP( 0 );
   ZCharacter::SetAP( 0 );
        }
}
}

extern "C"
{
    __declspec(dllexport) BOOL __stdcall DllMain(HINSTANCE hInst,DWORD reason,LPVOID lpv)
    {
        DisableThreadLibraryCalls(hInst);
        if (reason == DLL_PROCESS_ATTACH)
        {
            MessageBox(NULL, L"Injected", L"HI", MB_OK);
            CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&MyThread, NULL, 0, NULL);  //Remember our void?  "MyThread" ??
  }
        return true;
 }
}


 Ok thats the code I've now. I compiled it and injected it. But gunz just crashes how do I fix that.

I use the Zfuncs from heroin.dll.

#include 
#include "ZFuncs.h"

char* ChatInput( )
{
    return( char* ) ( ZGetGameInterface( ) + 0x3A8 );
}

void Clear( )
{
  (* (char* ) ( ZGetGameInterface( ) + 0x3A8 ) ) = '\n';
}

void MyThread( )
{
    for( ;;Sleep( 20 ) ) 
    {
        if( memcmp( ChatInput( ), "/dood", 4 ) == 0 )
        { 
     ZCharacter::SetHP(0);
     ZCharacter::SetAP(0);
            Clear( ); //You have to clear you're last input, or you can't input another command.
        }
    }
}

extern "C"
{
    __declspec( dllexport ) BOOL __stdcall DllMain( HINSTANCE hInst, DWORD dwReason, LPVOID lpv )
    {
        DisableThreadLibraryCalls( hInst );
        if ( dwReason == DLL_PROCESS_ATTACH )
        {
            Beep( 500, 500 );
            CreateThread( NULL, 0, ( LPTHREAD_START_ROUTINE )&MyThread, NULL, 0, NULL );
     }
            return true;
 }
}

0 comentarios:

Publicar un comentario