Duston
Platinian
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.
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.
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.
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");
}
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'm still a beginner, if anyone knows what am I doing wrong / missing here your advice is appreciated.