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

Help! Can't create a string

libModz

Awesome Active Platinian
Original poster
Jun 2, 2022
187
38
28
UK
I used to create strings in the previous version of the game I'm modding using this method...



private unsafe string CreateString(sbyte* value)
{
return null;
}




But in the latest update they seem to have removed it so now all the createstring methods have multiple parameters. Like

CreateString(char* value)
CreateString(sbyte* value, int startIndex, int length)
 
Last edited:

libModz

Awesome Active Platinian
Original poster
Jun 2, 2022
187
38
28
UK
hello please let me know how u solved this! I have the same problem

Use this...
CreateString(sbyte* value, int startIndex, int length)

You just need to edit your monoString struct to include the extra parameters like this...
C++:
monoString;
    monoString *CreateString6(const char *str) {
    monoString *(*CreateString6)(void *_this, const char *str, int start, int length) = (monoString *(*)(void *, const char *, int, int))getAbsoluteAddress("libil2cpp.so", 0xFF05DC);
    return CreateString6(NULL, str, 0, 6);
  
}
startIndex = 0
Length = How many characters in the string you want to create, I used 6 as an example
 

ElectricTankk123

Platinian
Jun 29, 2023
38
5
8
25
199 Poopie Road
I am using this method instead...

CreateString(sbyte* value, int startIndex, int length)

You just need to edit your monoString struct to include the extra parameters.
monoString* CreateMonoString(const char* str) {
monoString* (*String_CreateString)(const char* str, int* startIndex, int* length) = (monoString * (*)(const char*, int*, int*))(g_il2cppBaseMap.startAddress + string2Offset(OBFUSCATE("0xDDB6210")));
return String_CreateString(str, 0, (int*)strlen(str));
}This is my current code and when i'm hooking I use CreateMonoString("Example String")
 

libModz

Awesome Active Platinian
Original poster
Jun 2, 2022
187
38
28
UK
Remove the * after int
 

ElectricTankk123

Platinian
Jun 29, 2023
38
5
8
25
199 Poopie Road
[Hidden content]

Remove the * after int
monoString* CreateMonoString(const char* str) {
monoString* (*String_Create)(const char* str, int startIndex, int length) = (monoString * (*)(const char*, int, int))(g_il2cppBaseMap.startAddress + string2Offset(OBFUSCATE("0xDDB6210")));
int startIndex = 0;
int length = (int)strlen(str);
return String_Create(str, startIndex, length);
}

is that better?
 

libModz

Awesome Active Platinian
Original poster
Jun 2, 2022
187
38
28
UK
C++:
monoString* (*String_CreateString)(const char* str, int startIndex, int length) = (monoString * (*)(const char*, int, int))
 

libModz

Awesome Active Platinian
Original poster
Jun 2, 2022
187
38
28
UK
Yes try that
 

ElectricTankk123

Platinian
Jun 29, 2023
38
5
8
25
199 Poopie Road
monoString* CreateIl2cppString(const char* str) {
monoString* (*String_CreateString)(const char* str, int startIndex, int length) = (monoString * (*)(const char*, int, int)) (g_il2cppBaseMap.startAddress + string2Offset(OBFUSCATE("0xDDB6210")));
int startIndex = 0;
int length = (int)strlen(str);
return String_CreateString(str, startIndex, length);
}
 

libModz

Awesome Active Platinian
Original poster
Jun 2, 2022
187
38
28
UK
Try it like this, copy exactly...

C++:
monoString;
    monoString *CreateString(const char *str) {
    monoString *(*CreateString)(void *_this, const char *str, int start, int length) = (monoString *(*)(void *, const char *, int, int))getAbsoluteAddress("libil2cpp.so", 0xDDB6210);
    int length = (int)strlen(str);
    return CreateString(NULL, str, 0, length);
  
}
 

libModz

Awesome Active Platinian
Original poster
Jun 2, 2022
187
38
28
UK
Then you should be able to do like this...

return CreateString ("Example");
 

ElectricTankk123

Platinian
Jun 29, 2023
38
5
8
25
199 Poopie Road
monoString;
monoString *CreateString(const char *str) {
monoString *(*CreateString)(void *_this, const char *str, int start, int length) = (monoString *(*)(void *, const char *, int, int))(g_il2cppBaseMap.startAddress + string2Offset(OBFUSCATE("0xDDB6210")));
int length = (int)strlen(str);
return CreateString(NULL, str, 0, length);

}

yeah I had to change it to this cause I use zygisk imgui mod
 

ElectricTankk123

Platinian
Jun 29, 2023
38
5
8
25
199 Poopie Road
monoString* chathook = CreateString("Moddedd Text");
return old_LocalSendMessage(instance, chathook, true, true);

my code worked when the game had a sbyte and value but now im trying to do it now that they added the int
 

libModz

Awesome Active Platinian
Original poster
Jun 2, 2022
187
38
28
UK
Your code looks ok idk why it doesn't work