Datafiles
Posted: Mon Feb 20, 2006 11:04 pm
Theses are some functions I am currently coding, I have some issues creating the datafile...
Even if there is no */data/ds/logs/*.txt
It read it and doesn't Create the datafile.
But there is no datafile located in */data/ds/logs/, the folder is not even created.
I hope I been enought clear and that someone will help me.
Im using the POL095 core...
Beaud.
Code: Select all
/*
Logs.inc v1.0
Logs Staff, player or script cmd in differents files using
Andromeda UO's utilsdate available at http://groups.yahoo.com/group/pol-scriptforum/files/.
Author: Developer Beaud.
Email: DeveloperBeaud@gmail.com
TODO:
Add the scriptname to LogScriptEv returned string.
*/
use os;
use uo;
use datafile;
Include "include/utilsDate";
/*
LogCMD(text)
Stores strings in a txt file located in X/data/ds/logs/
param text: That string will be logged in its user element an sorted by cmdlevel
Example: LogCMD("Banned " + who.name + "'s account for cheating");
Notes: It might be usefull to manage a descent staff team.
*/
function LogCMD(who, text)
var timedate := PolCore().systime;
timedate := CDateStr(timedate) + " " + CTimeStr(timedate);
var path;
Case(who.cmdlevel)
0: path := "logs/players";
1: path := "logs/counselors";
2: path := "logs/seers";
3: path := "logs/gamemasters";
4: path := "logs/admins";
5: path := "logs/developers";
Endcase
var ldata := OpenDataFile( path );
If(!ldata)
ldata := CreateDataFile( path );
Endif
var log := ldata.FindElement(who.acctname);
if(!log)
log := ldata.CreateElement(who.acctname);
else
endif
log.setprop(CInt(timedate), text);
UnloadDataFile(path);
endfunction
/*
LogScriptEv(text)
Stores strings in a txt file located in X/data/ds/logs/
param text: That string will be looged in its script element.
Example: LogScriptEv("Banned " + who.name + "'s account for inactivity");
Notes: It might be usefull if you need to locate which script is banning
which were banned.
*/
function LogScriptEv(text)
var timedate := PolCore().systime;
timedate := CDateStr(timedate) + " " + CTimeStr(timedate);
var path := "logs/ScriptEv";
var ldata := OpenDataFile( path );
If(!ldata)
ldata := CreateDataFile( path );
Endif
var log := ldata.FindElement("polcore");
if(!log)
log := ldata.CreateElement("polcore");
endif
log.setprop(CInt(timedate), text);
UnloadDataFile(path);
endfunction
It read it and doesn't Create the datafile.
Code: Select all
var ldata := OpenDataFile( path );
If(!ldata)
ldata := CreateDataFile( path );
Endif
I hope I been enought clear and that someone will help me.
Im using the POL095 core...
Beaud.