Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > Metin2 > Metin2 Private Server
You last visited: Today at 14:35

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Call game function in C++

Discussion on Call game function in C++ within the Metin2 Private Server forum part of the Metin2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Sep 2020
Posts: 5
Received Thanks: 0
Call game function in C++

Hi I found function call of pick up items in metin2 and I call it with cheat engine. First I alloc memory then place there code nad create thread. It's work but if i use it will pick up item once. I try call this with DLL but game crash or can i make script in autoassembly that create thread every 1-5 second but I can't find anything.

Code:
#include "pch.h"
#include <Windows.h>
#include <iostream>
#include <stdio.h>

int Main()
{
	DWORD Arg1 = 0x01842824;
	DWORD Arg2 = 0x004A4FF0;
	DWORD Arg3 = 0x005A8BD0;

	__asm
	{
		mov ecx, Arg1 // Arg 1 
		call Arg2 // Arg 2
		jmp Arg3 // Arg3
		ret
	}
}


BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
                     )
{
	switch (ul_reason_for_call)
	{
	case DLL_PROCESS_ATTACH:
		CloseHandle(CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)Main, hModule, 0, nullptr));
    case DLL_THREAD_ATTACH:
    case DLL_THREAD_DETACH:
    case DLL_PROCESS_DETACH:
        break;
    }
    return TRUE;
}
Dupszot22 is offline  
Old 01/26/2025, 21:22   #2
 
wolfcfx880's Avatar
 
elite*gold: 0
Join Date: Oct 2011
Posts: 44
Received Thanks: 6
1 . Your C++ code doesn't handle any game logics such { Ingame mode , If player is alive etc.. }
this would crash the game surly

2 . Your ASM region ain't complete , might some registers missed { it also crash the app }

3 . Make sure that pointers you got are static not dynamic ones
dynamic ones need to be updated every single log-in

if 0x005A8BD0 is a return to the old original memory
try this

Code:

void DoPickUp()
{
	DWORD Arg1 = 0x01842824;
	DWORD Arg2 = 0x004A4FF0;
//	DWORD Arg3 = 0x005A8BD0;

	__asm
	{
		mov ecx, Arg1 // Arg 1 
		call Arg2 // Arg 2
		jmp DONE
		

		DONE:

	}

}

int Main()
{

				while (true)
				{
				if ( GetAsyncKeyState(VK_F11) &&1)
				{
					DoPickUp();
				}
				Sleep(200);
				}

return 0;
}
wolfcfx880 is offline  
Old 01/28/2025, 09:26   #3
 
elite*gold: 0
Join Date: Sep 2020
Posts: 5
Received Thanks: 0
Quote:
Originally Posted by wolfcfx880 View Post
1 . Your C++ code doesn't handle any game logics such { Ingame mode , If player is alive etc.. }
this would crash the game surly

2 . Your ASM region ain't complete , might some registers missed { it also crash the app }

3 . Make sure that pointers you got are static not dynamic ones
dynamic ones need to be updated every single log-in

if 0x005A8BD0 is a return to the old original memory
try this

Code:



void DoPickUp()
{
	DWORD Arg1 = 0x01842824;
	DWORD Arg2 = 0x004A4FF0;
//	DWORD Arg3 = 0x005A8BD0;

	__asm
	{
		mov ecx, Arg1 // Arg 1 
		call Arg2 // Arg 2
		jmp DONE
		

		DONE:

	}

}

int Main()
{

				while (true)
				{
				if ( GetAsyncKeyState(VK_F11) &&1)
				{
					DoPickUp();
				}
				Sleep(200);
				}

return 0;
}
I tried but it doesn't work. With cheat engine my asm code work. Now I make progress with asm code. This work but I can't turn it off and dont crash game probably because I interrupt the code in progress. I need some check when I turn off script so that it finishes the code up to the call sleep line and then turns off. Is this possible in autoassembler?
Code:
[ENABLE]
// Allocate memory for the code
alloc(code, 512)

// Define the code to execute in a loop
code:
  // Loop start
  loop_start:
    mov ecx, [metin2client.exe+1472824]  // Load value into ecx
    call metin2client.exe+D4FF0          // Call the function
    inc [metin2client.exe+13D8C9C]       // Increment the value at the address
    mov eax, metin2client.exe+13D8C9C    // Move the address into eax
    push 1000                            // Sleep for 1000 milliseconds (1 second)
    call sleep                           // Call the sleep function
    jmp loop_start                       // Jump back to the start of the loop

// Create a thread to execute the code
createthread(code)

[DISABLE]
// Deallocate the memory and stop the thread
dealloc(code)
Dupszot22 is offline  
Old 02/15/2025, 17:03   #4
 
elite*gold: 0
Join Date: Sep 2020
Posts: 30
Received Thanks: 10
I guess some functions don’t really work well with multi-threading. Maybe try hooking into the main loop or render function instead of creating a thread
sad666 is offline  
Reply


Similar Threads Similar Threads
[Buying] Call a function of a Game
07/05/2021 - Coders Trading - 0 Replies
Hey there, I'm looking for someone who is able to find out functions of a game and call them. The game i play is Free2Play on steam, since there is a low player base i'll tell you more details on private message. I would willing to pay 50€ just for that 1 function to be called and obviously that its working. PM me on epvp or on discord if you are interested.
std::function of a function returning an std::function
11/11/2013 - C/C++ - 19 Replies
Nun muss ich nach langer Zeit auch mal wieder einen Thread erstellen, weil mir Google nicht mehr weiterhelfen kann. Ich verzweifle an Folgendem Vorhaben: #include <Windows.h> #include <string> #include <iostream> using namespace std;
Running Function 2 after Function 1 finished
09/15/2013 - AutoIt - 3 Replies
Hey, its me again. Im stuck on a problem since yesterday and as much as i hate to ask for help, i really dont know what else to try. I want Function 2 to run after Function 1 has finished. I tried GuiCtrlSetOnEvent and MsgLoop, but i dont really understand it. I tried to read tutorials but they didnt help at all. The line that are underline is what im talking about. I want gamestart() to run first and when its finished, i want iniviteteam() to run. #AutoIt3Wrapper_UseX64=n...
[C++]Call a Game Function
08/27/2013 - Metin2 PServer Guides & Strategies - 3 Replies
Hello guys here is a quick tutorial : Metin2 How To Call A Function - www.darkhook.net - YouTube Source : // dllmain.cpp : Defines the entry point for the DLL application. #include "stdafx.h" // We will call our function.
[VIP-function] ToxicSYS [VIP-function]
08/14/2010 - WarRock Hacks, Bots, Cheats & Exploits - 1 Replies
heeeey E-pvpers :pimp: this is a new hack by TSYS Status : UNDETECTED Functions (VIDEO) : YouTube - WarRock - Bikini event VIP hack



All times are GMT +1. The time now is 14:35.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.