SA-MP Forums Archive
Creating ini file - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Creating ini file (/showthread.php?tid=504695)



Creating ini file - Burning - 05.04.2014

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;
}



Re: Creating ini file - ChristianIvann09 - 05.04.2014

Maybe at this line? im not sure mate

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

Код:
 new failas[128];



Re: Creating ini file - GWMPT - 05.04.2014

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.


Re: Creating ini file - Konstantinos - 05.04.2014

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.


Re: Creating ini file - Burning - 05.04.2014

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