SA-MP Forums Archive
[HELP] File saving and reading dini - 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: [HELP] File saving and reading dini (/showthread.php?tid=139360)



[HELP] File saving and reading dini - GreenHammy - 04.04.2010

Hi, I need help with reading files made by dini, I have made the file with dini and I get it to save everything that someone says on IRC to a file

Код:
dini_Create("AWords.ini"); // creates AWords.ini
format(temp, sizeof(temp), "\n%s", message); //Saves messages on new lines
dini_Set("AWords.ini", message, temp2); //Stores the message with new strings
that basically makes the file AWords.ini and acts like a second log but what im trying to do is to read any random sentence from this file

this is the function that reads from AWords.ini then says it back on irc, but it only ever says the very LAST word said.

Код:
forward Botread(conn, channel[], user[], params[]);
public Botread(conn, channel[], user[], params[])
{
 new string[128];
 dini_Get("AWords.ini",temp);
 format(string, sizeof(string), "%s", temp);
 printf("%s", string);
 SetTimer("Bobread", randomEx(300000, 600000), false);
 return 1;
}
So i am wondering if it is possible to read any random line in the AWords.ini and then get the bot to say it back


Re: [HELP] File saving and reading dini - GreenHammy - 05.04.2010

sorry for the double post, but does anyone have any ideas?