Basic tut on using C++ for GunZ

Page 2 of 2 FirstFirst 12
Results 26 to 39 of 39
  1. #26
    Account Upgraded | Title Enabled! gpadmin is offline
    MemberRank
    Oct 2006 Join Date
    318Posts

    Re: Basic tut on using C++ for GunZ

    Hello. How change server port 7777 to 4545 and how change same port on client side? Thank you.

  2. #27

    Re: Basic tut on using C++ for GunZ

    Quote Originally Posted by gpadmin View Post
    Hello. How change server port 7777 to 4545 and how change same port on client side? Thank you.
    Make a separate topic, don't post it here.

  3. #28
    Account Upgraded | Title Enabled! 00niels00 is offline
    MemberRank
    Sep 2008 Join Date
    The NetherlandsLocation
    1,041Posts

    Re: Basic tut on using C++ for GunZ

    Quote Originally Posted by PenguinGuy View Post
    Hook ZChat::Input or use 0x3A6 or 0x3A8 (I forget which offset) for chat input. Of course, return it as a char. E.X;
    Code:
     char* ChatInput( )
    {
      return( char* ) ( ZGetGameInterface( ) + 0x3A6 /*Or 0x3A8*/ );
    }
    To clear your last input, I believe all you have to do is:
    Code:
    void Clear( )
    {
      (* (char* ) ( ZGetGameInterface( ) + 0x3A6 /*Or 0x3A8*/ ) ) = '\n';
    }
    That's chat input, but I had problems having ZChatOutput display a message after input. Previously I used:
    Code:
     memcmp( ChatInput( ), "/hi", 3 ) == 0 ) { /*do stuffs */ }
    Here's another method to receive and use an argument in a input.
    Code:
    if( memicmp( ChatInput( ), "/silentchat ", 11 ) == 0 )
    {
        char playerName;
        char msg;
        sscanf( ChatInput( ), "/silentchat %s %s", &playerName, &msg );
        ZPostWhisper( "From: Me", playername, msg );
        ClearInput( );
    }
    (Code not tested)
    Edit: Forgot the ClearInput If you forget to add the "ClearInput", you will not be able to input another command.

    Edit2: I plan on updating this tutorial tonight or tomorrow night on finding an using pointers, adding/removing functions in "theduel.exe", and creating custom commands in C++ and ASM.
    Thanks for this.

    Ok this is the script:
    Code:
    #include <windows.h>
    
    typedef void(__cdecl *ZChatType) (const char*, int, int, DWORD);
    ZChatType ZChatOutput = (ZChatType)0x0042A230;
    
    void Chat2()
    {
    
    
    	for(;;Sleep(20)) //Infinite Loop
      {
    char* ChatInput( )
    {
      return( char* ) ( ZGetGameInterface( ) + 0x3A6 /*Or 0x3A8*/ );
    }
    
    if( memcmp( ChatInput( ), "/hi", 3 ) == 0 ) { 
    	ZChatOutput("Hello!", 2, 0, 0xFFFFFF);
    	Sleep(250);
     }
    }
    }
    
    extern "C"
    {
        __declspec(dllexport) BOOL __stdcall DllMain(HINSTANCE hInst,DWORD reason,LPVOID lpv)
        {
            DisableThreadLibraryCalls(hInst);
            if (reason == DLL_PROCESS_ATTACH)
            {
    			MessageBox(NULL, L"I love Music!", L"Niels:", MB_OK);
                CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&Chat2, NULL, 0, NULL);  //Remember our void?  "MyThread" ??
    		}
            return true;
    	}
    }
    And I get this error:
    Code:
    1>c:\documents and settings\administrator\mijn documenten\visual studio 2008\projects\chat2\chat2\main.cpp(13) : error C2601: 'ChatInput' : local function definitions are illegal
    1>        c:\documents and settings\administrator\mijn documenten\visual studio 2008\projects\chat2\chat2\main.cpp(11): this line contains a '{' which has not yet been matched
    1>c:\documents and settings\administrator\mijn documenten\visual studio 2008\projects\chat2\chat2\main.cpp(14) : error C3861: 'ZGetGameInterface': identifier not found
    1>Build log was saved at "file://c:\Documents and Settings\Administrator\Mijn documenten\Visual Studio 2008\Projects\Chat2\Chat2\Debug\BuildLog.htm"
    1>Chat2 - 2 error(s), 0 warning(s)
    It´s probaly because of the ZGetGameInterface.
    How to make it load the interface of in-game(Not lobby or room)

    I posted it here because I think it get faster a respond to it.

  4. #29

    Re: Basic tut on using C++ for GunZ

    Quote Originally Posted by 00niels00 View Post
    Thanks for this.

    Ok this is the script:
    Code:
    #include <windows.h>
    
    typedef void(__cdecl *ZChatType) (const char*, int, int, DWORD);
    ZChatType ZChatOutput = (ZChatType)0x0042A230;
    
    void Chat2()
    {
    
    
        for(;;Sleep(20)) //Infinite Loop
      {
    char* ChatInput( )
    {
      return( char* ) ( ZGetGameInterface( ) + 0x3A6 /*Or 0x3A8*/ );
    }
    
    if( memcmp( ChatInput( ), "/hi", 3 ) == 0 ) { 
        ZChatOutput("Hello!", 2, 0, 0xFFFFFF);
        Sleep(250);
     }
    }
    }
    
    extern "C"
    {
        __declspec(dllexport) BOOL __stdcall DllMain(HINSTANCE hInst,DWORD reason,LPVOID lpv)
        {
            DisableThreadLibraryCalls(hInst);
            if (reason == DLL_PROCESS_ATTACH)
            {
                MessageBox(NULL, L"I love Music!", L"Niels:", MB_OK);
                CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&Chat2, NULL, 0, NULL);  //Remember our void?  "MyThread" ??
            }
            return true;
        }
    }
    And I get this error:
    Code:
    1>c:\documents and settings\administrator\mijn documenten\visual studio 2008\projects\chat2\chat2\main.cpp(13) : error C2601: 'ChatInput' : local function definitions are illegal
    1>        c:\documents and settings\administrator\mijn documenten\visual studio 2008\projects\chat2\chat2\main.cpp(11): this line contains a '{' which has not yet been matched
    1>c:\documents and settings\administrator\mijn documenten\visual studio 2008\projects\chat2\chat2\main.cpp(14) : error C3861: 'ZGetGameInterface': identifier not found
    1>Build log was saved at "file://c:\Documents and Settings\Administrator\Mijn documenten\Visual Studio 2008\Projects\Chat2\Chat2\Debug\BuildLog.htm"
    1>Chat2 - 2 error(s), 0 warning(s)
    It´s probaly because of the ZGetGameInterface.
    How to make it load the interface of in-game(Not lobby or room)

    I posted it here because I think it get faster a respond to it.
    Check line 11.

    Also your code needs indentation for readability.

    And, you need to define the address of ZGetGameInterface.

    I corrected the indentation for you:
    Spoiler:
    Code:
    #include <windows.h>
    
    typedef void(__cdecl *ZChatType) (const char*, int, int, DWORD);
    ZChatType ZChatOutput = (ZChatType)0x0042A230;
    
    void Chat2()
    {
        for(;;Sleep(20)) //Infinite Loop
        {
            char* ChatInput( )
            {
    	return( char* ) ( ZGetGameInterface( ) + 0x3A6 /*Or 0x3A8*/ );
            }
    
            if( memcmp( ChatInput( ), "/hi", 3 ) == 0 )
            { 
    	ZChatOutput("Hello!", 2, 0, 0xFFFFFF);
    	Sleep(250);
            }
    
        }
    }
    
    extern "C"
    {
        __declspec(dllexport) BOOL __stdcall DllMain(HINSTANCE hInst,DWORD reason,LPVOID lpv)
        {
            DisableThreadLibraryCalls(hInst);
            if (reason == DLL_PROCESS_ATTACH)
            {
                MessageBox(NULL, L"I love Music!", L"Niels:", MB_OK);
                CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&Chat2, NULL, 0, NULL);  //Remember our void?  "MyThread" ??
            }
    
            return true;
        }
    }
    Last edited by Linear88; 23-12-09 at 04:03 AM.

  5. #30
    Account Upgraded | Title Enabled! 00niels00 is offline
    MemberRank
    Sep 2008 Join Date
    The NetherlandsLocation
    1,041Posts

    Re: Basic tut on using C++ for GunZ

    Code:
    #include <windows.h>
    #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);
    	Sleep(250);
            }
    }
    }
    
    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.
    Last edited by 00niels00; 28-12-09 at 02:39 PM.

  6. #31
    Account Upgraded | Title Enabled! PenguinGuys is offline
    MemberRank
    Sep 2009 Join Date
    AlabamaLocation
    261Posts

    Re: Basic tut on using C++ for GunZ

    Quote Originally Posted by 00niels00 View Post
    Code:
    #include <windows.h>
    #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.
    Code:
    #include <windows.h>
    #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;
    	}
    }
    Try that.
    Last edited by PenguinGuys; 29-12-09 at 08:08 AM.

  7. #32
    Faraday Das Neves Jizeth is offline
    MemberRank
    Sep 2008 Join Date
    VenezuelaLocation
    392Posts

    Re: Basic tut on using C++ for GunZ

    Thnx for the tut.

  8. #33
    Account Upgraded | Title Enabled! 00niels00 is offline
    MemberRank
    Sep 2008 Join Date
    The NetherlandsLocation
    1,041Posts

    Re: Basic tut on using C++ for GunZ

    Ok it still chrashes. Probaly because it tries to execute. And can't find it.

    So I tought like this:
    PHP Code:
    #include <windows.h>
    #include "ZFuncs.h"

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

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

    void MyThread( )
    {
        for( ;;
    Sleep20 ) ) 
        {
            if (
    ZGetGameInterface!=0x0) {
            if( 
    memcmpChatInput( ), "/dood") == )
            { 
            
    ZCharacter::SetHP(0);
            
    ZCharacter::SetAP(0);
                
    Clear( ); //You have to clear you're last input, or you can't input another command.
            
    }
            }
        }
    }

    extern "C"
    {
        
    __declspecdllexport BOOL __stdcall DllMainHINSTANCE hInstDWORD dwReasonLPVOID lpv )
        {
            
    DisableThreadLibraryCallshInst );
            if ( 
    dwReason == DLL_PROCESS_ATTACH )
            {
                
    Beep500500 );
                
    CreateThreadNULL0, ( LPTHREAD_START_ROUTINE )&MyThreadNULL0NULL );
            }
                return 
    true;
        }

    But it still doesn't work.

    Maybe is the handling of the ZGetGameInterface wrong
    PHP Code:
    DWORD ZGetGameInterface()
    {
        
    DWORD ReturnVal;
        if (
    ZGetGameInterfaceAddress!=0x0)
        {
            
    __asm
            
    {
                
    MOV EAXZGetGameInterfaceAddress
                CALL EAX
                MOV ReturnVal
    EAX
            
    }
        }else{
            return 
    0x0;
        }
    return 
    ReturnVal;

    Last edited by 00niels00; 29-12-09 at 03:16 PM.

  9. #34

    Re: Basic tut on using C++ for GunZ

    Quote Originally Posted by 00niels00 View Post
    Ok it still chrashes. Probaly because it tries to execute. And can't find it.

    So I tought like this:
    PHP Code:
    #include <windows.h>
    #include "ZFuncs.h"

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

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

    void MyThread( )
    {
        for( ;;
    Sleep20 ) ) 
        {
            if (
    ZGetGameInterface!=0x0) {
            if( 
    memcmpChatInput( ), "/dood") == )
            { 
            
    ZCharacter::SetHP(0);
            
    ZCharacter::SetAP(0);
                
    Clear( ); //You have to clear you're last input, or you can't input another command.
            
    }
            }
        }
    }

    extern "C"
    {
        
    __declspecdllexport BOOL __stdcall DllMainHINSTANCE hInstDWORD dwReasonLPVOID lpv )
        {
            
    DisableThreadLibraryCallshInst );
            if ( 
    dwReason == DLL_PROCESS_ATTACH )
            {
                
    Beep500500 );
                
    CreateThreadNULL0, ( LPTHREAD_START_ROUTINE )&MyThreadNULL0NULL );
            }
                return 
    true;
        }

    But it still doesn't work.

    Maybe is the handling of the ZGetGameInterface wrong
    PHP Code:
    DWORD ZGetGameInterface()
    {
        
    DWORD ReturnVal;
        if (
    ZGetGameInterfaceAddress!=0x0)
        {
            
    __asm
            
    {
                
    MOV EAXZGetGameInterfaceAddress
                CALL EAX
                MOV ReturnVal
    EAX
            
    }
        }else{
            return 
    0x0;
        }
    return 
    ReturnVal;

    That is the structure for pChar(), if I am correct.

    I have provided the definition for ZGetGameInterface().

    Code:
    typedef DWORD(__cdecl *ZGetGameInterfaceType)();
    ZGetGameInterfaceType ZGetGameInterface = (ZGetGameInterfaceType)0x004ABCF0;
    Enjoy.

  10. #35
    Account Upgraded | Title Enabled! PenguinGuys is offline
    MemberRank
    Sep 2009 Join Date
    AlabamaLocation
    261Posts

    Re: Basic tut on using C++ for GunZ

    Quote Originally Posted by Linear88 View Post
    That is the structure for pChar(), if I am correct.

    I have provided the definition for ZGetGameInterface().

    Code:
    typedef DWORD(__cdecl *ZGetGameInterfaceType)();
    ZGetGameInterfaceType ZGetGameInterface = (ZGetGameInterfaceType)0x004ABCF0;
    Enjoy.
    No, that is ZGetGameInterface. Snail's did it straight through inline ASM. Probably the sig. searcher isn't finding the address for ZGetGameInteface.

  11. #36
    Enthusiast marcoslvl is offline
    MemberRank
    Nov 2009 Join Date
    BrazilLocation
    44Posts

    Re: Basic tut on using C++ for GunZ

    Microssoft visual c++ is the same of Hex Work Shop?

  12. #37
    Extreme Coder - Delphi bounty-hunter is offline
    MemberRank
    Sep 2007 Join Date
    GunZone MansionLocation
    1,725Posts

    Re: Basic tut on using C++ for GunZ

    Trying to translate Zchatoutput to Delphi :
    C++:
    Code:
    typedef void(__cdecl *ZChatOutputType) (const char*, int, int, DWORD);
    ZChatOutputType ZChatOutput = (ZChatOutputType)0x0042BAE0; //FAKE Address *points to jjang*
    my Delphi attempt:
    Code:
     const
      ADDRESS = $0042BAE0; // some fakeaddress
    
     type
      TZChatoutput = procedure (char : Pchar; int1 : integer; int2 :integer; MyWord:Dword);
    
    var
    GunZChat:TZChatoutput = TZChatOutput(ADDRESS);
    
    begin
    GunZChat('bounty-hunta :O',2,1,$FFFFFF);
    end;
    going to need the real zchatoutput to test this ..
    Last edited by bounty-hunter; 11-01-10 at 03:06 PM.

  13. #38

    Re: Basic tut on using C++ for GunZ

    Quote Originally Posted by marcoslvl View Post
    Microssoft visual c++ is the same of Hex Work Shop?
    You wish. (Also, don't bump topic older than 3 weeks, I've noticed that happening: You might get infracted.)

    @bounty-hunter: 0042A230

  14. #39
    Extreme Coder - Delphi bounty-hunter is offline
    MemberRank
    Sep 2007 Join Date
    GunZone MansionLocation
    1,725Posts

    Re: Basic tut on using C++ for GunZ

    Thanks linear, hope my code works xD



Page 2 of 2 FirstFirst 12

Advertisement