SA-MP Forums Archive
Need help with 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: Need help with fread. (/showthread.php?tid=617919)



Need help with fread. - Maheerali - 28.09.2016

PHP код:
stock LoadProject(pjname[])
{
    new 
File:handle fopen(pjname,io_read);
    new 
td_Info[128];
    if(
handle)
    {
        while(
fread(handle,td_Info))
        {
             
SendClientMessageToAll(-1,td_Info);
             
printf(td_Info);
        }
    }
}
CMD:te(playerid,params[])
{
    
LoadProject("TD_test.txt");
    return 
1;
    




Re: Need help with fread. - iLearner - 28.09.2016

Could you explain the problem?


Re: Need help with fread. - Maheerali - 28.09.2016

Quote:
Originally Posted by iLearner
Посмотреть сообщение
Could you explain the problem?
This is not working. Now sending clientmessage.


Re: Need help with fread. - F1N4L - 28.09.2016

fclose not found or file is empty.


Re: Need help with fread. - Maheerali - 28.09.2016

Quote:
Originally Posted by Maheerali
Посмотреть сообщение
This is not working. Now sending clientmessage.
Sorry i got wrong file name


Re: Need help with fread. - F1N4L - 28.09.2016

Quote:
Originally Posted by Maheerali
Посмотреть сообщение
Sorry i got wrong file name
You need to close the file!
Insert fclose(handle); in the end of the function