how can we get a serverlog or chat log in form of .txt or .log?
Quote from: MEGAMIND on Jun 25, 2018, 06:24 AMhow can we get a serverlog or chat log in form of .txt or .log?
You can use the files functions. References:
Squirrel Wiki: http://www.squirrel-lang.org/squirreldoc/stdlib/stdiolib.html?highlight=file#the-file-class
Public Beta src (line 31): https://bitbucket.org/stormeus/vl8-pb400/src/97957ce06cf26e3210bae62523b1e5c619e99cfd/LibMisc.nut?at=master&fileviewer=file-view-default#LibMisc.nut-31
Quote from: Ququr_Uxcho on Jun 25, 2018, 06:36 AMQuote from: MEGAMIND on Jun 25, 2018, 06:24 AMhow can we get a serverlog or chat log in form of .txt or .log?
You can use the files functions. References:
Squirrel Wiki: http://www.squirrel-lang.org/squirreldoc/stdlib/stdiolib.html?highlight=file#the-file-class
Public Beta src (line 31): https://bitbucket.org/stormeus/vl8-pb400/src/97957ce06cf26e3210bae62523b1e5c619e99cfd/LibMisc.nut?at=master&fileviewer=file-view-default#LibMisc.nut-31
thanks dude but how do u preffer working with this is there any example available in wiki? and is this function still present in rel006?
function TXTAddLine(filename, text)
{
local fhnd = file(filename, "a+");
foreach(char in text)
fhnd.writen(char, 'c');
fhnd.writen('\n', 'c');
fhnd=null;
}
Quote from: MEGAMIND on Jun 25, 2018, 06:41 AMQuote from: Ququr_Uxcho on Jun 25, 2018, 06:36 AMQuote from: MEGAMIND on Jun 25, 2018, 06:24 AMhow can we get a serverlog or chat log in form of .txt or .log?
You can use the files functions. References:
Squirrel Wiki: http://www.squirrel-lang.org/squirreldoc/stdlib/stdiolib.html?highlight=file#the-file-class
Public Beta src (line 31): https://bitbucket.org/stormeus/vl8-pb400/src/97957ce06cf26e3210bae62523b1e5c619e99cfd/LibMisc.nut?at=master&fileviewer=file-view-default#LibMisc.nut-31
thanks dude but how do u preffer working with this is there any example available in wiki? and is this function still present in rel006?
function TXTAddLine(filename, text)
{
local fhnd = file(filename, "a+");
foreach(char in text)
fhnd.writen(char, 'c');
fhnd.writen('\n', 'c');
fhnd=null;
}
This function doesn't depend on the server version. It is integrated on Squirrel Language.
Actually, I am working with this function to read files or write in them.
The previous lines write letter by letter in the file. You need a open file:
local fhnd = file(filename, "a+");The
a+ means append. So, this example serves you perfectly.
function onPlayerJoin(p)
{
TXDAddLine("Logs.txt",p.Name+" connected to the server. IP: "+p.IP+", UID: "+p.UniqueID+", UID2: "+p.UniqueID2);
return 1;
}
function TXTAddLine(filename, text)
{
local fhnd = file(filename, "a+");
foreach(char in text)
fhnd.writen(char, 'c');
fhnd.writen('\n', 'c');
fhnd=null;
}