Dumping output from FLHook's Eventmode into a file
-
Eventmode is only available via socket connection so you would need a socket client that connects and then writes everything to a file.
It depends, if you know a programming language that supports sockets, it should be pretty easy.
What could be easier would be a new plugin that logs any info you want (not only the events in eventmode) to a file. The only thing you need to do here is create a few hooks and then do a “fprintf(…)” to an opened file.
You could look at the FLHook source code and scan for “ProcessEvents(” , that will give you every place where the evenmode would have logged something. -
Well I am not a programmer myself, so I was trying to find a way around. You can force putty to save everything into a file, but I didn’t find a way to start-up putty and log-in the socket connection using the “pass XYZ” from a command line script. I would then launch it with flserver and that would be it…
As you probably know, we have quite restrictive rules to support role-playing on our server and sometimes it would be nice to have some evidence of the player’s behavior before he gets sanctioned for out-of-RP killing for example.
Making a new plugin is a good idea, I just can’t do it myself…:)
-
Maybe try this prog.
Haven’t tested it, but it allows autologin -
I have add some code to my flhook to save playerlog to a file.
It worked but im not sure it will works fine.
here it is:
void HkWriteEventToFile(uint iClientID, wstring wscCharAction…)
{
if (set_bPlayerActionLog){
wchar_t wszBuf[1024*8] = L"";
va_list marker;
va_start(marker, wscCharAction);_vsnwprintf(wszBuf, (sizeof(wszBuf) / 2) - 1, wscCharAction.c_str(), marker);
const wchar_t *wszCharname = Players.GetActiveCharacterName(iClientID);
if(!wszCharname)
wszCharname = L"";CAccount *acc = Players.FindAccountFromClientID(iClientID);
wstring wscAccountDir;
HkGetAccountDirName(acc, wscAccountDir);HKPLAYERINFO pi;
HkGetPlayerInfo(ARG_CLIENTID(iClientID), pi, false);string sfilname = “FLHookPlayerLog\” + wstos(HkGetAccountID(acc)) + “_PlayerLog.Log”;
FILE *f = fopen(sfilname.c_str(), “at”);
time_t tNow = time(0);
struct tm *stNow = localtime(&tNow);
fprintf(f, “\r\n%.4d/%.2d/%.2d [%.2d:%.2d:%.2d] Player: %s (%s:%s)::%s”, stNow->tm_year + 1900, stNow->tm_mon + 1, stNow->tm_mday, stNow->tm_hour, stNow->tm_min, stNow->tm_sec, wstos(wszCharname).c_str(), wstos(HkGetAccountID(acc)).c_str(), wstos(wscAccountDir).c_str(), wstos(wszBuf).c_str());
fclose(f);
}
}call exp. :
void __stdcall InitiateTrade(unsigned int iClientID1, unsigned int iClientID2)
{
……
try {
HkWriteEventToFile(iClientID1, L"TradeRequest From: %s", wszCharname.c_str());
} catch (…) { AddLog(“Exception in %s (HkWriteEventToFile)”, FUNCTION); }
…
}w0dk4, i want to log more things, like what player buy/sell and what item player have to exchange… how can i do that?