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?