What's new

-Tibia 7.60 [76] Zapisywanie Login i Logout

Volde

Banned
Joined
Feb 26, 2017
Messages
33
Reaction score
0
O to kod na zapisywanie Login i Logout. Skrypt w 100% Dzia?a bo mam go od Hucza/Sid by?ego Cz?onka OTSOFT
W otserv.cpp:

Pod:
stat->addPlayer();

Dodaj:
]char buf[64];
time_t ticks = time(0);
unsigned char ip[4];
*(unsigned long*)&ip = player->getIP();
#ifdef USING_VISUAL_2005
tm now;
localtime_s(&now, &ticks);
strftime(buf, sizeof(buf), "%d/%m/%Y %H:%M", &now);
#else
strftime(buf, sizeof(buf), "%d/%m/%Y %H:%M", localtime(&ticks));
#endif //USING_VISUAL_2005
std::eek:fstream out("data/logs/login.log", std::ios::app);
out << buf << player->getName() << " zalogowal/a sie. " << IP: " << (unsigned int)ip[0] << "." << (unsigned int)ip[1] << "." << (unsigned int)ip[2] << "." << (unsigned int)ip[3] << " ." << std::endl;
out.close();

W pliku protocol76.cpp:

Nad:
logout();

Dodaj:
char buf[64];
time_t ticks = time(0);
unsigned char ip[4];
*(unsigned long*)&ip = player->getIP();
#ifdef USING_VISUAL_2005
tm now;
localtime_s(&now, &ticks);
strftime(buf, sizeof(buf), "%d/%m/%Y %H:%M", &now);
#else
strftime(buf, sizeof(buf), "%d/%m/%Y %H:%M", localtime(&ticks));
#endif //USING_VISUAL_2005
std::eek:fstream out("data/logs/logout.log", std::ios::app);
out << buf << player->getName() << " wylogowal/a sie. " << "IP: " << (unsigned int)ip[0] << "." << (unsigned int)ip[1] << "." << (unsigned int)ip[2] << "." << (unsigned int)ip[3] << " ." << std::endl;
out.close();


Upewnij si? ?e na pocz?tku tych plik?w jest:
#include <fstream>
 
Top