Creating ini file
#1

Hello, im creating register system and something went wrong, when I want to set password from gui inputtext it just deletes first letter and send output like if my password would be test, it would set password est.
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == DIALOG_REGISTER)
	{
	    if(response)
	    {
	        if(strlen(inputtext[DIALOG_REGISTER]) < 6 || strlen(inputtext[DIALOG_REGISTER]) > 16) return SendClientMessage(playerid,-1,"[KLAIDA]: slaptaюodis turi bыti ilgesnis nei рeрi simboliai ir trumpesnis nei 16.");
	        else
	        {
	            new password = inputtext[DIALOG_REGISTER];
	            new failas[256];
	            new vardas[MAX_PLAYER_NAME];
	            GetPlayerName(playerid,vardas,sizeof(vardas));
	            format(failas,sizeof(failas),"Vartotojai/%s.ini",vardas);
	            dini_Create(failas);
	            dini_Set(failas,"Slaptazodis",password);
	        }
	    }
	}
	return 1;
}
Reply
#2

Maybe at this line? im not sure mate

Код:
 new failas[256];
Try to change it to

Код:
 new failas[128];
Reply
#3

still wondering what you mean with this:
pawn Код:
new password = inputtext[DIALOG_REGISTER];
You can use inputtext without creating a new variable.
Something like this:
pawn Код:
new failas[128];
                new vardas[MAX_PLAYER_NAME];
                GetPlayerName(playerid,vardas, MAX_PLAYER_NAME);
                format(failas,128,"Vartotojai/%s.ini",vardas);
                dini_Create(failas);
                dini_Set(failas,"Slaptazodis",inputtext);
Should do the job, try it.
Reply
#4

If DIALOG_REGISTER is defined as 1 and you do:
pawn Код:
inputtext[DIALOG_REGISTER]
// which is:
inputtext[1]
will use the text from the 2nd character and after so yes: "test" would be "est".

And as Kikito said, you don't need to declare another array/string since you already got inputtext for it.
Reply
#5

Thaaanks you all, fixed it with your help. :]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)