Log writting bug - 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: Log writting bug (
/showthread.php?tid=545879)
Log writting bug -
Jennifer - 11.11.2014
I have this code that writes stuff into a log, but it doesn't work
I get this warning in my console
Код:
Log_Write("logs/spawnitem.txt", "[%s] %s has spawned %s", ReturnDate(), ReturnName(playerid, 0), g_aInventoryItems[i][e_InventoryItem]);
Код:
stock Log_Write(const path[], const str[], {Float,_}:...)
{
static
args,
start,
end,
File:file,
string[1024]
;
if ((start = strfind(path, "/")) != -1) {
strmid(string, path, 0, start + 1);
if (!fexist(string))
return printf("** Warning: Directory \"%s\" doesn't exist.", string);
}
#emit LOAD.S.pri 8
#emit STOR.pri args
file = fopen(path, io_append);
if (!file)
return 0;
if (args > 8)
{
#emit ADDR.pri str
#emit STOR.pri start
for (end = start + (args - 8); end > start; end -= 4)
{
#emit LREF.pri end
#emit PUSH.pri
}
#emit PUSH.S str
#emit PUSH.C 1024
#emit PUSH.C string
#emit PUSH.C args
#emit SYSREQ.C format
fwrite(file, string);
fwrite(file, "\r\n");
fclose(file);
#emit LCTRL 5
#emit SCTRL 4
#emit RETN
}
fwrite(file, str);
fwrite(file, "\r\n");
fclose(file);
return 1;
}

and inside that folder I got
Re: Log writting bug -
dominik523 - 11.11.2014
Folder logs has to be in scriptfiles folder. It can't be outside of it.
That's why you are getting the warning. Folder logs doesn't exists (in scriptfiles folder).