if(dialogid == 14)
{
if(!response) return SelectTextDraw(playerid, red);
if(strlen(inputtext) < 4) return ShowPlayerDialog(playerid, 14, DIALOG_STYLE_INPUT, "Login - Password", embed_red"[GRESKA]"embed_grey"Password mora da ima makar 4 karaktera\nPassword:", "U redu", "Nazad");
SetPVarString(playerid, "RegisterPassword", inputtext);
SetPVarString(playerid, "RegisterPasswordRepeat", "");
new tmpPassStr[10];
for(new i = 0; i < strlen(inputtext) && i < 10; i++)
{
tmpPassStr[i] = ']';
}
SetPlayerTextDrawInputValue3(playerid, tmpPassStr);
SetPlayerTextDrawInputValue4(playerid, " ");//Clearing Repeat password
SelectTextDraw(playerid, red);
return 1;
}
if(dialogid == 15)
{
if(!response) return SelectTextDraw(playerid, red);
if(strlen(inputtext) < 4) return ShowPlayerDialog(playerid, 15, DIALOG_STYLE_INPUT, "Login - Password", embed_red"[GRESKA]"embed_grey"Password mora da ima makar 4 karaktera\nPonoviti password:", "U redu", "Nazad");
new string[24]; GetPVarString(playerid, "RegisterPassword", string);
if(strcmp(inputtext, string) != 0 || strlen(string) == 0) return ShowPlayerDialog(playerid, 15, DIALOG_STYLE_INPUT, "Login - Password", embed_red"[GRESKA]"embed_grey"Passwordi se ne poklapaju\nPonoviti password:", "U redu", "Nazad");
SetPVarString(playerid, "RegisterPasswordRepeat", inputtext);
//Start of the problem
new tmpPassStr2[10];
for(new i = 0; i < strlen(inputtext) && i < 10; i++)
{
tmpPassStr2[i] = ']';
SendDebugEx(playerid, "tmpPassStr[%d] = '%s'", i,tmpPassStr2);
}
//At these point tmpPassStr2 already have ] * sizeof inputtext + inputtext characters
SendDebugEx(playerid, "END - '%s'", tmpPassStr2);
SetPlayerTextDrawInputValue4(playerid, tmpPassStr2);
SelectTextDraw(playerid, red);
return 1;
}
[00:34:33] [DEBUG]{C0C0C0}tmpPassStr[0] = ']' [00:34:33] [DEBUG]{C0C0C0}tmpPassStr[1] = ']]' [00:34:33] [DEBUG]{C0C0C0}tmpPassStr[2] = ']]]' [00:34:33] [DEBUG]{C0C0C0}tmpPassStr[3] = ']]]]' [00:34:33] [DEBUG]{C0C0C0}tmpPassStr[4] = ']]]]]' [00:34:33] [DEBUG]{C0C0C0}tmpPassStr[5] = ']]]]]]' [00:34:33] [DEBUG]{C0C0C0}tmpPassStr[6] = ']]]]]]]' [00:34:33] [DEBUG]{C0C0C0}tmpPassStr[7] = ']]]]]]]]' [00:34:33] [DEBUG]{C0C0C0}tmpPassStr[8] = ']]]]]]]]]' [00:34:33] [DEBUG]{C0C0C0}tmpPassStr[9] = ']]]]]]]]]]' [00:34:33] [DEBUG]{C0C0C0}tmpPassStr[10] = ']]]]]]]]]]]wewewewewewe' [00:34:33] [DEBUG]{C0C0C0}END - ']]]]]]]]]]]wewewewewewe'
Код:
[00:34:33] [DEBUG]{C0C0C0}tmpPassStr[10] = ']]]]]]]]]]]wewewewewewe' |
new
tmpPassStr2[11] = { ']', ... }
;
if(strlen(inputtext) < sizeof tmpPassStr2) {
tmpPassStr2[strlen(inputtext)] = EOS;
} else {
tmpPassStr2[sizeof tmpPassStr2 - 1] = EOS;
}