Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > Metin2
You last visited: Today at 05:28

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

Advertisement



[QUESTION] C++ GettingInstanceMap?

Discussion on [QUESTION] C++ GettingInstanceMap? within the Metin2 forum part of the Popular Games category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Nov 2016
Posts: 245
Received Thanks: 147
Exclamation [QUESTION] C++ GettingInstanceMap?

Hello everyone,
Im trying to get near vids from instance map. But maybe im using/calling something wrong. Im not sure. This is my code;

Code:
typedef std::map<DWORD, DWORD*>	TCharacterInstanceMap;

typedef DWORD* (__thiscall* tCPythonCharacterManagerGetInstancePtr)(void* This, DWORD VirtualID);
static tCPythonCharacterManagerGetInstancePtr CPythonCharacterManagerGetInstancePtr;

static DWORD pCPythonCharacterManagerGetInstancePtr;

static DWORD iCPythonCharacterManagerInstance;
static DWORD pCPythonCharacterManagerInstance;

pCPythonCharacterManagerInstance = globals::hEntryBaseAddress + globals::CPChrMgrIns;
iCPythonCharacterManagerInstance = *reinterpret_cast<DWORD*>(pCPythonCharacterManagerInstance);

pCPythonCharacterManagerGetInstancePtr = globals::hEntryBaseAddress + globals::CPChrMgrIns_Addr
CPythonCharacterManagerGetInstancePtr = (tCPythonCharacterManagerGetInstancePtr)(pCPythonCharacterManagerGetInstancePtr);

static DWORD* CharacterManagerGetInstancePtr(int vid)
{
    try
    {
        return CPythonCharacterManagerGetInstancePtr((void*)(iCPythonCharacterManagerInstance + 4), vid);
    }
    catch (...)
    {
        return NULL;
    }
}


int GetNearInstanceListSizeTest() {
    TCharacterInstanceMap m_kAliveInstMap;
    m_kAliveInstMap = *(TCharacterInstanceMap*)(*reinterpret_cast<DWORD*>(*reinterpret_cast<DWORD*>(iCPythonCharacterManagerInstance + 32) + 4));
    //int myVID = PlayerGetMainCharacterIndex();
    return m_kAliveInstMap.size();
}
This line giving crash;

Code:
m_kAliveInstMap = *(TCharacterInstanceMap*)(*reinterpret_cast<DWORD*>(*reinterpret_cast<DWORD*>(iCPythonCharacterManagerInstance + 32) + 4));
What you think, whats wrong with this? Thanks everyone..
senpaiex is offline  
Thanks
1 User
Old 06/02/2021, 19:39   #2
 
MrCrisp's Avatar
 
elite*gold: 0
Join Date: Apr 2009
Posts: 747
Received Thanks: 184
I'm on mobile right now and can not look at the source.
Are you sure the typedef of the instance map is correct? Isn't the second item of the pair a pointer of an instance type or something?

As far as I can remember, you need to have a struct definition of the instances. Otherwise your program will crash.
MrCrisp is offline  
Thanks
2 Users
Old 06/03/2021, 00:29   #3
 
elite*gold: 0
Join Date: Nov 2016
Posts: 245
Received Thanks: 147
Quote:
Originally Posted by MrCrisp View Post
I'm on mobile right now and can not look at the source.
Are you sure the typedef of the instance map is correct? Isn't the second item of the pair a pointer of an instance type or something?

As far as I can remember, you need to have a struct definition of the instances. Otherwise your program will crash.
Isn't it already DWORD* is a pointer? Yeah probably i need to define struct but idk how it should be. Im looking for it but i couldnt find anything yet. Im stuck
senpaiex is offline  
Old 06/03/2021, 15:47   #4
 
elite*gold: 0
Join Date: Oct 2017
Posts: 43
Received Thanks: 61
On which server do you want to use it?

for example: If the client binary is compiled with vs2008 (vc90) the std::map of vs2019 (vc142) is incompatible and leads to crashes.

for official servers (vc90) this should help:
€: cant post link, google "BF2 STD library (VS 2005, 08 & 10)"
nogamaS is offline  
Thanks
3 Users
Old 06/03/2021, 23:58   #5
 
elite*gold: 0
Join Date: Nov 2016
Posts: 245
Received Thanks: 147
Quote:
Originally Posted by nogamaS View Post
On which server do you want to use it?

for example: If the client binary is compiled with vs2008 (vc90) the std::map of vs2019 (vc142) is incompatible and leads to crashes.

for official servers (vc90) this should help:
€: cant post link, google "BF2 STD library (VS 2005, 08 & 10)"
Yes official servers. Im using vs19 (vc142). Maybe u re right. Thank you my friend i'll search about this.
senpaiex is offline  
Old 06/04/2021, 03:10   #6
 
MrCrisp's Avatar
 
elite*gold: 0
Join Date: Apr 2009
Posts: 747
Received Thanks: 184
Quote:
Originally Posted by nogamaS View Post
On which server do you want to use it?

for example: If the client binary is compiled with vs2008 (vc90) the std::map of vs2019 (vc142) is incompatible and leads to crashes.

for official servers (vc90) this should help:
€: cant post link, google "BF2 STD library (VS 2005, 08 & 10)"
Unlikely. They should be backwards compatible.
@
Is your offset correct? Did you found it with ReClass?
MrCrisp is offline  
Old 06/04/2021, 15:10   #7
 
elite*gold: 0
Join Date: Oct 2017
Posts: 43
Received Thanks: 61
Quote:
Originally Posted by MrCrisp View Post
Unlikely. They should be backwards compatible.
@
Is your offset correct? Did you found it with ReClass?
Well, I had crashes with vc142's std::map and official servers binary. Solved it by using the posted STD classes
nogamaS is offline  
Thanks
3 Users
Old 06/05/2021, 04:05   #8
 
MrCrisp's Avatar
 
elite*gold: 0
Join Date: Apr 2009
Posts: 747
Received Thanks: 184
Quote:
Originally Posted by nogamaS View Post
Well, I had crashes with vc142's std::map and official servers binary. Solved it by using the posted STD classes
Oh, nice! Glad it actually did work
MrCrisp is offline  
Old 06/06/2021, 11:01   #9
 
elite*gold: 0
Join Date: Nov 2016
Posts: 245
Received Thanks: 147
Thanks everyone, specially @ for helping me. He is very nice person
senpaiex is offline  
Reply

Tags
c++, cheat, hack, metin2


Similar Threads Similar Threads
Bot question...stupid question by the way
12/05/2007 - Conquer Online 2 - 5 Replies
ok i have this litlle problem with CoPartener..that is i cant find it...i looked where i found it before...but when i download it...BOOM...just S3DHook.dll ....evreywhere i look..the same thing...can anybody help me...help a poor noob....by the way...got weed?text2schild.php?smilienummer=1&text=WEEEE EED!' border='0' alt='WEEEEEED!' />



All times are GMT +1. The time now is 05:29.


Powered by vBulletin®
Copyright ©2000 - 2026, 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 ©2026 elitepvpers All Rights Reserved.