This site has been archived and made available for preservation purposes. No edits can be made.
-
Member
logging joins
Ok, so first off, is there anyway I can compile my script and have it actually show any errors? cause when i try to compile it, it doesn't compile, cause of the errors, but the .bat just flashes. I can't see what errors there are.
Anyway, This is what I'm trying to put in.
Code :
public OnClientAuthenticate(const name{}, const pwd{})
{
JoinLog(name);
return true;
}
// logging test
public JoinLog(string[])
{
new entry[200];
format(entry, sizeof(entry), "%s\n",string);
new File:hFile;
hFile = fopen("Logs/join.log", io_append);
fwrite(hFile, entry);
fclose(hFile);
}
I'm using compuphase's file.inc for the include and i have it listed in the script to include it. But it's giving errors. I'm just trying to get a basic log so that if someone joins, it writes their name into this log file. any help?
-
Re: logging joins
Edit your compile.bat, and add a new line:
PAUSE
Use this code (I put comments where you made mistakes):
Code c:
public OnClientAuthenticate(const name{}, const pwd{})
{
JoinLog(name);
return true;
}
// logging test
stock JoinLog(const string{}) // no need to declare this public. also, the parameter need to be const qualified (see callback)
{
new entry{200}; // not an error, but it is highly recommended to use packed strings
strformat(entry, sizeof(entry), true, "%s\n", string); // format is actually strformat (it's "format" in SA-MP, but default PAWN declares it strformat)
new File:hFile;
hFile = fopen("Logs/join.log", io_append);
fwrite(hFile, entry);
fclose(hFile);
}
-
Member
Re: logging joins
Thanks for the help. Yeah, I was a scripter in sa-mp so I know a little PAWN from that.
However, it still won't write to the file.
-
Re: logging joins
Currently all PAWN file functions use your operating systems temporary folder as a root (I'll change that with the next release). Also, the folder Logs must exist (it won't be created automatically there).
-
Member
Re: logging joins
[quote author=Recycler link=topic=330.msg3148#msg3148 date=1317496313]
Currently all PAWN file functions use your operating systems temporary folder as a root (I'll change that with the next release). Also, the folder Logs must exist (it won't be created automatically there).
[/quote]
I'm confused on what you mean it uses my temp folder as a root. How does this affect it? It compiles correctly and i can run the script without any problem, but it just won't write to the Log file(which already exists).
-
Re: logging joins
That means when you do:
Code c:
hFile = fopen("Logs/join.log", io_append);
It actually tries to open / write to the file
<your temp system path>/Logs/join.log
and not to
<your vaultserverd.exe path>/Logs/join.log
(open cmd.exe and run:
echo %TMP%
and it will reveal your temp folder)
-
Member
Re: logging joins
is it possible to specify it even more? as in putting C:\Desktop\etc\etc ?
-
Re: logging joins
No, it is not possible to use such an absolute path. With the next release, all files will go into a "files" folder in the root of vaultserverd.exe (similar to SA-MPs scriptfiles, if I remember correctly)
-
Member
Re: logging joins
Alright, i'll just mirror the folder then. Thanks a lot though! ;D
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules