SA-MP Forums Archive
Read Line - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Read Line (/showthread.php?tid=263873)



Read Line - Ricop522 - 23.06.2011

I wanna read all the lines, but this just read the first line

pawn Код:
if (strcmp(cmd, "/read", true) == 0)
    {
        new File:example = fopen("procurados.txt", io_read);
        fread(example, string);
        fclose(example); //
        printf("%s",string);
        SendClientMessage(playerid, -1, string);
        return 0x01;
    }



Re: Read Line - Mauzen - 23.06.2011

Use while
https://sampwiki.blast.hk/wiki/Fread


Re: Read Line - [HiC]TheKiller - 23.06.2011

pawn Код:
if (strcmp(cmd, "/read", true) == 0)
{
        new str[100]; //Increase if needed
        new File:example = fopen("procurados.txt", io_read);
        while(fread(example, str))
        {
              format(string, sizeof(string), "%s %s", string, str);
        }
        fclose(example);
        printf("%s",string);
        SendClientMessage(playerid, -1, string);
        return 0x01;
}
Give that a go.


Re: Read Line - Ricop522 - 23.06.2011

And how I delete the second line ? example:

/deleteline [line]
/deleteline 2
And this delete the line 2 ?

Thanks for your help.