Ok im working on a little vote function that reads yes or no from separate .txt files
the votes are being saved line for line as followed:
[CODE]yes
yes
yes
or
no
no
no
Here is how I save the vote to text file:
[CODE] if(msg.indexOf(“yes”) != -1)
{
var fileNamess21 = “logs/webserver/normal/yeslog.txt”;
Files = FileOpen(fileNamess21, 2);
Files.WriteLine( “yes”)
Files.Close();
}
if(msg.indexOf( “no” ) != -1)
{
var fileNamess11 = “logs/webserver/normal/nolog.txt”;
Files = FileOpen(fileNamess11, 2);
Files.WriteLine( “no”)
Files.Close();
}
I need a function to read max length of yes and nolog.txt something like this:
[CODE]function checkvote()
{
Say(“Lets see who won.”);
var fileNamesss = “logs/webserver/normal/yeslog.txt”;
Filess = FileOpen(fileNamesss, 0)
if(Filess!=-1) // If the file has been successfully opened
{
length = flength(Filess);
str = fread(Filess, length);
Filess.Close();
}
Say(“Yes ” + str + “”);
}
However there is no output with this code: Say(“Yes ” + str + “”);
If anyone could help with the checkvote function it would be great!!
Thanks!