SA-MP Forums Archive
Read from 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: Read from file. (/showthread.php?tid=399703)



Read from file. - Gennum. - 15.12.2012

Hey, I want to take all the information from a file, and then to put it in a dialog,
but it will be in lines in the dialog.

How I save the words in the file.
Код:
format(string, sizeof(string), "CRecords/%s.cfg", playername);
new File:filee = fopen(string, io_append);
format(stringg, sizeof(stringg), "%s(%d/%d/%d)\r\n",inputtext, Day, Month,Year);
fwrite(filee, stringg);
fclose(filee);
How it looks in the file:
Код:
First(14/12/2010)
Second(14/12/2010)
And now I want to put it on a dialog:

How I tried to do that:
Код:
new File:filee = fopen(string, io_read);
new stringg[1300];
fread(filee, stringg);
format(string3, sizeof(string3), "Wanted for:\n%s", stringg);
ShowPlayerDialog(playerid,24,DIALOG_STYLE_MSGBOX,"POLICE DATABASE",string3,"Residence","Exit");
fclose(filee);
but it shows me onlt the first line and no all the lines. "First(14/12/2010)"

How can I do that ?


Re: Read from file. - Tanush123 - 15.12.2012

So basically what you saying is with the first coding it writes 2 times if you type the command or whatever 2 times and for the 2nd coding it only shows 1 when you used it 2 times?


Re: Read from file. - Gennum. - 16.12.2012

No,
Listen at the first code it shows you how it saves. and every time it save it saves the text, but you save few times in the file - there's lines. and when I want to see all the text is in the file I see only the first line.

Quote:

And now I want to put it on a dialog:

How I tried to do that:
Код:
new File:filee = fopen(string, io_read);
new stringg[1300];
fread(filee, stringg);
format(string3, sizeof(string3), "Wanted for:\n%s", stringg);
ShowPlayerDialog(playerid,24,DIALOG_STYLE_MSGBOX,"POLICE DATABASE",string3,"Residence","Exit");
fclose(filee);
but it shows me onlt the first line and no all the lines. "First(14/12/2010)"

How can I do that ?