How do I make a dialog MSGBOX which shows multiple lines from fread? - 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: How do I make a dialog MSGBOX which shows multiple lines from fread? (
/showthread.php?tid=666227)
How do I make a dialog MSGBOX which shows multiple lines from fread? -
aKnoxx - 01.05.2019
So I have a command that I'm trying to make which takes lines from fread() and I want to make it so that each line found shows up in its own separate line in a dialog.
Here is what I have so far but the problem with it right now is it only shows the last line... I want the dialog box to show ALL the results in its own line... if that makes any sense.
Код:
CMD:viewfeedback(playerid, params[])
{
new File:handle = fopen("feedback.txt", io_read);
if(handle)
{
new line[128];
new i = 1;
while(fread(handle, line))
{
new dialoglines[250], dialogstring[1000];
format(dialoglines, sizeof(dialoglines), "[%i] %s\n", i, line);
strcat(dialogstring, dialoglines);
ShowPlayerDialog(playerid, 89273, DIALOG_STYLE_MSGBOX, "View Feedback", dialogstring, "Close", "");
i++;
}
fclose(handle);
}
else SendClientMessage (playerid, -1, "error");
return 1;
}
Re: How do I make a dialog MSGBOX which shows multiple lines from fread? -
BsLOUAY - 01.05.2019
try one one of these codes
Код:
new File:Warns = fopen("filename.txt",io_read);
if(!Warns) return 0;
new str[128],warndstr[500],len;
while((len = fread(Warns,str)))
{
str[len - 1] = 0;
strcat(warnstr,str);
}
fclose(Warns);
if(warnstr[0] != EOS)
{
// ShowPlayerDialog(...);
}
or
Код:
while((len = fread(Warns,str)))
{
str[len - 2] = 0;
SendClientMessage(playerid,-1,str);
}
fclose(Warns);
Re: How do I make a dialog MSGBOX which shows multiple lines from fread? -
aKnoxx - 01.05.2019
Nvm got it, I just had the dialog showing in the loop by accident lol