Solved access a pointer from a different class than my function

Status
Not open for further replies.

CHEATS GAMES

Solid & Active Platinian
Original poster
Aug 9, 2019
64
18
8
39
Brazil
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
 

Yaskashije

PMT Elite Modder
Staff member
Modding-Team
Sep 9, 2018
4,368
865,283
1,213
Minkowski Space
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.
 
  • Like
Reactions: CHEATS GAMES

CHEATS GAMES

Solid & Active Platinian
Original poster
Aug 9, 2019
64
18
8
39
Brazil
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
 
  • Haha
Reactions: Script4fun

Yaskashije

PMT Elite Modder
Staff member
Modding-Team
Sep 9, 2018
4,368
865,283
1,213
Minkowski Space
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.
 
  • Like
Reactions: Midnight Syndicate

CHEATS GAMES

Solid & Active Platinian
Original poster
Aug 9, 2019
64
18
8
39
Brazil
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:
 

DaRealPanDa

Co-Administrator
Staff member
Supporting-Team
Global Moderator
Social Media
Mar 12, 2018
7,013
15,892
2,120
27
Skyrim
Closed.
Learn basic programming is the tip you got and besides that even the answer to your problem.
 
Status
Not open for further replies.