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?