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.
Re: Basic tut on using C++ for GunZ
Quote:
Originally Posted by
gpadmin
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.
Re: Basic tut on using C++ for GunZ
Quote:
Originally Posted by
PenguinGuy
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 :P: 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. :laugh:
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.
Re: Basic tut on using C++ for GunZ
Quote:
Originally Posted by
00niels00
Thanks for this. :laugh:
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;
}
}
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.
Re: Basic tut on using C++ for GunZ
Quote:
Originally Posted by
00niels00
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.
Re: Basic tut on using C++ for GunZ
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" char * ChatInput ( ) { return( char * ) ( ZGetGameInterface ( ) + 0x3A8 ); } void Clear ( ) { (* ( char * ) ( ZGetGameInterface ( ) + 0x3A8 ) ) = '\n' ; } void MyThread ( ) { for( ;; Sleep ( 20 ) ) { if ( ZGetGameInterface != 0x0 ) { 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 ; } }
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 EAX , ZGetGameInterfaceAddress CALL EAX MOV ReturnVal , EAX } }else{ return 0x0 ; } return ReturnVal ; }
Re: Basic tut on using C++ for GunZ
Quote:
Originally Posted by
00niels00
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" char * ChatInput ( ) { return( char * ) ( ZGetGameInterface ( ) + 0x3A8 ); } void Clear ( ) { (* ( char * ) ( ZGetGameInterface ( ) + 0x3A8 ) ) = '\n' ; } void MyThread ( ) { for( ;; Sleep ( 20 ) ) { if ( ZGetGameInterface != 0x0 ) { 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 ; } }
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 EAX , ZGetGameInterfaceAddress 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.
Re: Basic tut on using C++ for GunZ
Quote:
Originally Posted by
Linear88
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.
Re: Basic tut on using C++ for GunZ
Microssoft visual c++ is the same of Hex Work Shop?
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 ..
Re: Basic tut on using C++ for GunZ
Quote:
Originally Posted by
marcoslvl
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
Re: Basic tut on using C++ for GunZ
Thanks linear, hope my code works xD