This is the AMP version of this page.
If you want to load the real page instead, click this text.

Help! Mod menu send chat messages in Photon games

Duston

Platinian
Original poster
Nov 11, 2023
9
1
3
Hello. I have been trying to send chat message in a photon game from calling needed methods, but every time I tried game crashed.

The method I used:

public void OnClick_SendFreeTextMessage()

It belongs to CanvasChatManager class. Previously I got inputfield of this class and set the text of the message. I got the instance from Awake() method of the same class.
C++:
void sendChatMessage(void* instchat)
if(instchat!=NULL)
{
void * tinputfield = *(void* *)((uint64_t) instchat + 0xB0);//the field of class with message text
*(monoString* *)((uint64_t) tinputfield + 0xD8) = String_CreateString(get_StringInstance, msgtext, 0, (int)strlen(msgtext));//new message text
OnClick_SendFreeTextMessage(instchat);
}
else LOGI("instance is null");
}
When I tried calling OnClick_SendFreeTextMessage() via button in mod menu game crashed.

But when I tried only to hook this method like this to change the message text before sending message the normal way by pressing send message button in game, everything worked fine.
C++:
void (*old_OnClick_SendFreeTextMessage)(void* instchat);
void OnClick_SendFreeTextMessage(void* instchat)
{
void * tinputfield = *(void* *)((uint64_t) instchat + 0xB0);//the field of class with message text
*(monoString* *)((uint64_t) tinputfield + 0xD8) = String_CreateString(get_StringInstance, msgtext, 0, (int)strlen(msgtext));//new message text
old_OnClick_SendFreeTextMessage(instchat);
}
I tried calling RPC method RPC_ShowMessage(string messageText), chat text appeared for a while (only for me, not the other players) then game crashed.

I'm still a beginner, if anyone knows what am I doing wrong / missing here your advice is appreciated.