Command to READ from file in scriptfiles and Display as text?? - 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: Command to READ from file in scriptfiles and Display as text?? (
/showthread.php?tid=651903)
Command to READ from file in scriptfiles and Display as text?? -
NinjaChicken - 30.03.2018
Okay, so this is the first time ive had difficulties in a while, now ive got a file in my scriptfiles called toylist.cfg, now i want to make a command in game such as CMD:checktoylist, and it then open that file in the scriptfiles and display the contents of the .cfg as messages in game? is this possible and how would i go about doing that?
Re: Command to READ from file in scriptfiles and Display as text?? -
MadeMan - 30.03.2018
https://sampwiki.blast.hk/wiki/Fopen
Re: Command to READ from file in scriptfiles and Display as text?? -
NinjaChicken - 30.03.2018
Yeah ive scrolled through this but i think im just overtired and can't make much sense of it all, their's 4 lines in the text file, and i need those 4 lines displayed in their own line IG if that makes sense, or even all 4 lines displaced in a single message just spaced?
Re: Command to READ from file in scriptfiles and Display as text?? -
MadeMan - 30.03.2018
pawn Код:
new File:handle = fopen("toylist.cfg", io_read);
if(handle)
{
new line[128];
while(fread(handle, line))
{
SendClientMessage(playerid, -1, line);
}
fclose(handle);
}