Solved access a pointer from a different class than my function

Status
Not open for further replies.

CHEATS GAMES

Solid & Active Platinian
I'm trying to access a class through another class to use the pointers that are in the gundata class, I made this script but it doesn't work, does anyone know why?
obs: I need to use an update from another class to call the gundata class pointers

acess gundata.png



C++:
void (orig_Update)(voidinstance);
void Update(void instance)
{
    if(instance != nullptr && hack10)
    {
        voidAccessGunData = *(void**)((uint32_t)instance + 0x30);
        if(AccessGunData != nullptr)
        {
            {
                (int)((uint32_t)instance + 0x24) = 1000000;   // public int dmg;  public class GunData : BaseData
                (int)((uint32_t)instance + 0x3C) = 1000000;  // public float dmgPower;  public class GunData : BaseData
            }
        }
    }
    return orig_Update(instance); // Return original value for bots
}

0x30 is a pointer that is also in the gundata class so I used it to define
 
There's clear incosistencies in the snippet you shared.
You are using an argument of type void, there's already a syntax error in the first line of code, and the "pointer" usage is clearly wrong.

I don't even know what compiler would process your snippet, so my first assumption is that you have clearly no idea what are you doing and you just pasted snippets you found hoping to be spoonfed the rest.



This is not a modding question, but a programming one.
You need to learn C++ programming and be familiar with pointers (and how memory works). After that, you can then revisit the idea and try implementing it.
 
There's clear incosistencies in the snippet you shared.
You are using an argument of type void, there's already a syntax error in the first line of code, and the "pointer" usage is clearly wrong.

I don't even know what compiler would process your snippet, so my first assumption is that you have clearly no idea what are you doing and you just pasted snippets you found hoping to be spoonfed the rest.



This is not a modding question, but a programming one.
You need to learn C++ programming and be familiar with pointers (and how memory works). After that, you can then revisit the idea and try implementing it.


I already expected that you would be the first to answer, and as always without any tips to solve the problem.. lol
 
I already expected that you would be the first to answer, and as always without any tips to solve the problem.. lol

Without any tips? I even specified the field that is related the most with your problem.
You need to learn C++ programming and be familiar with pointers (and how memory works). After that, you can then revisit the idea and try implementing it.



You cannot expect to craft a ceramic pot if you don't know how to prepare the clay first.


This is not your first time being warned you lack in programming knowledge:
So maybe, hear what do modders have to say in this regard, instead of surviving by pasting and begging.
 
Without any tips? I even specified the field that is related the most with your problem.




You cannot expect to craft a ceramic pot if you don't know how to prepare the clay first.


This is not your first time being warned you lack in programming knowledge:
So maybe, hear what do modders have to say in this regard, instead of surviving by pasting and begging.


thanks, I'm always happy with everyone's answers.. :face33:
 
Status
Not open for further replies.
Back
Top Bottom