Help! How to hook a method with a parameter of PhotonMessageInfo?

libModz

Solid & Active Platinian
Original poster
Jun 2, 2022
85
7
8
UK
Hi, this is the method I'm trying to hook...

void OnRequestRespawn(PhotonPlayer, PhotonMessageInfo)

Previously it used to be like this...

void OnRequestRespawn(PhotonPlayer)

I was able to use it fine in the last update no problems, but now they've added this extra parameter and I've no clue what it does or how to use it. Thanks.
 

libModz

Solid & Active Platinian
Original poster
Jun 2, 2022
85
7
8
UK
It's a struct that contains 3 parameters...

PhotonMessageInfo(PhotonPlayer player, int timestamp, PhotonView view)
 

libModz

Solid & Active Platinian
Original poster
Jun 2, 2022
85
7
8
UK
hook this and save the instance pointer
How?

public PhotonMessageInfo(PhotonPlayer, player, int timestamp, PhotonView view)

How to hook it when it doesn't say what the data type is? It's not a bool or a void function so idk
 

mIsmanXP

2/3 Games Approved
Feb 20, 2022
62
6
8
Earth
What's the game?
How?

public PhotonMessageInfo(PhotonPlayer, player, int timestamp, PhotonView view)

How to hook it when it doesn't say what the data type is? It's not a bool or a void function so idk
What's the game?
 

Daleon228_09

Solid & Active Platinian
Aug 19, 2022
60
7
8
Poland
How?

public PhotonMessageInfo(PhotonPlayer, player, int timestamp, PhotonView view)

How to hook it when it doesn't say what the data type is? It's not a bool or a void function so idk
void (*OnRequestSpawn)(void *instance, void *PhotonPlayer, void *PhotonMessageInfo);

and save Photonmessageinfo as void *
 

frc7400

Platinian
Jul 11, 2023
9
1
3
Us
C++:
struct PhotonMessageInfo
{
    void *player;
    int  timestamp;
    void *view;
};
void (*OnRequestSpawn)(void *instance, void *PhotonPlayer, PhotonMessageInfo Info);
PhotonMessageInfo info = {PhotonPlayer, Num, PhotonView};
 
  • Like
Reactions: libModz

libModz

Solid & Active Platinian
Original poster
Jun 2, 2022
85
7
8
UK
C++:
struct PhotonMessageInfo
{
    void *player;
    int  timestamp;
    void *view;
};
void (*OnRequestSpawn)(void *instance, void *PhotonPlayer, PhotonMessageInfo Info);
PhotonMessageInfo info = {PhotonPlayer, Num, PhotonView};
Thanks but I'm not sure what the value of "num" needs to be for this to work, unfortunately it's crashing the game
 

libModz

Solid & Active Platinian
Original poster
Jun 2, 2022
85
7
8
UK
This is the code I have but it's just crashing the game. Idk what I'm doing wrong

C++:
void (*old_RoomMaster_Update)(void *instance);
void RoomMaster_Update(void *instance) {
    if(instance!=nullptr) {
        void *photonView = *(void **) ((uint64_t) instance + 0xC);
        if(RespawnAll) {
            if(PhotonNetwork_get_player!=nullptr && PhotonNetwork_get_PlayerList!=nullptr) {
                auto PhotonPlayers = PhotonNetwork_get_PlayerList();
                for (int i = 0; i < PhotonPlayers->getLength(); ++i) {
                    auto PhotonPlayer = PhotonPlayers->getPointer()[i];
                    if(PhotonPlayer!=nullptr) {
                        PhotonMessageInfo info = {PhotonNetwork_get_player(), 3059293, photonView};
                        RoomMaster_OnRequestRespawn(instance, PhotonPlayer, info);
                        RespawnAll=false;
                    }
                }
            }
        }
    }
    old_RoomMaster_Update(instance);
}