new savedPasswordForFinalReg[MAX_PLAYERS][255];
OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
// ...
// ...
savedPasswordForFinalReg[playerid] = inputtext; // ERROR LINE
// ...
return 1;
}
OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
printf("OnDialogResponse: sizeof inputtext: %d", sizeof inputtext); // DEBUG
// ...
OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
// ...
// ...
format(savedPasswordForFinalReg[playerid], sizeof savedPasswordForFinalReg[playerid], "%s", inputtext); // should work now
// ...
return 1;
}
new savedPasswordForFinalReg[MAX_PLAYERS][255];
savedPasswordForFinalReg[playerid] = inputtext;
format(SavedPasswordForFinalReg[playerid], 255, inputtext);
|
Just format the string.
pawn Код:
|
stock strcpy(dest[], const source[], maxlength=sizeof dest)
strcat((dest[0] = EOS, dest), source, maxlength);
|
@renegade334 - The funny thing here is that you claim PAWN to be a language equivalent to a ten-year-old pedal cycle, which is a peace of cake, and you still get it wrong.
|

new string[255]; new inputstring[] = "A percent sign looks like this: %. This input string contains some percent signs (%s) and a double-percent sign (%%)."; // Using inputstring directly as the format string format(string, sizeof string, inputstring); print(string); // Using "%s" as the format string, and providing inputstring as an input argument format(string, sizeof string, "%s", inputstring); print(string); // Output: // A percent sign looks like this: This input string contains some percent signs () and a double-percent sign (%). // A percent sign looks like this: %. This input string contains some percent signs (%s) and a double-percent sign (%%).
stock strcpy(dest[], const source[], maxlength=sizeof dest)
{
strcat((dest[0] = EOS, dest), source, maxlength);
}
strins(string[], const substr[], pos, maxlength=sizeof string);
Format string iterations: 7947ms
Format %s iterations: 7764ms
strcat iterations: 3475ms
strins iterations: 3476ms
memcpy iterations: 3530ms
code:
new string[255] = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef";
new target[240];
new tick_count;
tick_count = tickcount();
for (new i = 0; i < 10000000; i++) {
format(target, sizeof target, string);
}
tick_count = tickcount() - tick_count;
printf("Format string iterations: %dms", tick_count);
tick_count = tickcount();
for (new i = 0; i < 10000000; i++) {
format(target, sizeof target, "%s", string);
}
tick_count = tickcount() - tick_count;
printf("Format %%s iterations: %dms", tick_count);
tick_count = tickcount();
for (new i = 0; i < 10000000; i++) {
strcat((target[0] = EOS, target), string);
}
tick_count = tickcount() - tick_count;
printf("strcat iterations: %dms", tick_count);
tick_count = tickcount();
for (new i = 0; i < 10000000; i++) {
strins((target[0] = EOS, target), string, 0);
}
tick_count = tickcount() - tick_count;
printf("strins iterations: %dms", tick_count);
tick_count = tickcount();
for (new i = 0; i < 10000000; i++) {
memcpy(target, string, 0, strlen(string) * 4 + 4);
}
tick_count = tickcount() - tick_count;
printf("memcpy iterations: %dms", tick_count);