Help! Can i hook this function?

NoPref

Platinian
Original poster
Mar 27, 2023
12
0
1
26
Idk
C#:
        // Token: 0x0600321E RID: 12830 RVA: 0x00002053 File Offset: 0x00000253
        [Token(Token = "0x600321E")]
        [Address(RVA = "0xC441B4", Offset = "0xC441B4", VA = "0xC441B4")]
        public void AddCurrency(int currencyId, float amount)
        {
        }
 

Hiyall360

Awesome Active Platinian
Jan 14, 2018
132
3,942
193
Mr.Pringlez
guiding you in the right direction without giving a straight up answer is the best way of teaching. In your case, the direction you need to start looking is: "function pointers"

in other words, yes.

Good luck my friend!
 

NoPref

Platinian
Original poster
Mar 27, 2023
12
0
1
26
Idk
guiding you in the right direction without giving a straight up answer is the best way of teaching. In your case, the direction you need to start looking is: "function pointers"

in other words, yes.

Good luck my friend!
I'm not sure I can hook it, because i found out it's probably a server function (It's in the Bolt.Dll file)
 

Onlyfaris

Platinian
Feb 20, 2020
29
40
13
Isekai
can🌱 :pepe017:

C++:
void (*old_VoidTes)(void *instance,int testb,float amount);

void VoidTes(void *instance,int testb,float amount) {

    if (instance != NULL && XLUA.Test) {



        return old_VoidTes(instance,testb,(float) 9999999);



    }

   return old_VoidTes(instance,testb,amount);
}
 
  • Wow
Reactions: xyzhunter

NoPref

Platinian
Original poster
Mar 27, 2023
12
0
1
26
Idk
Do i need also hook this method?


Code:
    // Token: 0x06003223 RID: 12835 RVA: 0x00002053 File Offset: 0x00000253
        [Token(Token = "0x6003223")]
        [Address(RVA = "0xC43EEC", Offset = "0xC43EEC", VA = "0xC43EEC")]
        public void Apply()
        {
It`s in the same file as "AddAmount"
 

Godz Gaming

Platinian
Jun 14, 2022
7
23
3
18
United States
guiding you in the right direction without giving a straight up answer is the best way of teaching. In your case, the direction you need to start looking is: "function pointers"

in other words, yes.

Good luck my friend!
Hello Hiyall Sir! When will you post new mod for Granny's House V2.5.501?
 

Onlyfaris

Platinian
Feb 20, 2020
29
40
13
Isekai
Do i need also hook this method?


Code:
    // Token: 0x06003223 RID: 12835 RVA: 0x00002053 File Offset: 0x00000253
        [Token(Token = "0x6003223")]
        [Address(RVA = "0xC43EEC", Offset = "0xC43EEC", VA = "0xC43EEC")]
        public void Apply()
        {
It`s in the same file as "AddAmount"
Nope
 

Hiyall360

Awesome Active Platinian
Jan 14, 2018
132
3,942
193
Mr.Pringlez
Do i need also hook this method?


Code:
    // Token: 0x06003223 RID: 12835 RVA: 0x00002053 File Offset: 0x00000253
        [Token(Token = "0x6003223")]
        [Address(RVA = "0xC43EEC", Offset = "0xC43EEC", VA = "0xC43EEC")]
        public void Apply()
        {
It`s in the same file as "AddAmount"
You need to find an Update function to hook or find an instance that has access to that class, which you would know already if you started looking up "function pointers" as per my first reply.
 

ziz59

Approved Modder
Approved Modder
Nov 7, 2020
122
2,167
193
43
fr
you have possibility to modif this by create a pointer or use simple hook :

//
AddCurrency(int currencyId, float amount) // inclde in update or methode in class

//hook

void (*old_AddCurrency)(void *instance,int currencyId, float amount);

void AddCurrency(void *instance,int currencyId, float amount) {

if (instance != NULL && Hack) {
currencyId = 1;
amount = 10.0f;
}

old_VoidTes(instance,currencyId, amount);
}