Advertisement
Guest User

Untitled

a guest
May 25th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. unsigned char playerip[4];
  2. *(unsigned long*)&playerip = player->lastip;
  3. char buf[64];
  4. time_t ticks = time(0);
  5. strftime(buf, sizeof(buf), "%Y-%m-%d, %H:%M", localtime(&ticks));
  6. std::string file = "/home/all/data/logs/bugs/" + player->getName() + ".log";
  7. std::ofstream outfile;
  8. outfile.open(file.c_str(), std::ios_base::out | std::ios_base::app);
  9. outfile << "[" << buf << "] " << player->getName() << " [POS: " << player->pos.x << " " << player->pos.y << " " << player->pos.z << " ,IP: " << (unsigned int)playerip[0] << "." << (unsigned int)playerip[1] << "." << (unsigned int)playerip[2] << "." << (unsigned int)playerip[3] << "] " << param << std::endl;
  10. outfile.close();
  11.  
  12.  
  13. void Protocol76::parseReportBug(NetworkMessage &msg)
  14. {
  15. std::string bug = msg.GetString();
  16.  
  17. std::stringstream filename;
  18. filename << "data/logs/reports/" << player->getName() << " report.txt";
  19. FILE* f = fopen(filename.str().c_str(), "a");
  20. if(f) {
  21. fputs("------------------------------\n", f);
  22. fputs(bug.c_str(), f);
  23. fputs("\n", f);
  24. fclose(f);
  25. }
  26. player->sendTextMessage(MSG_INFO, "Your report has been sent.\nWe will try to solve the problem within 24 hours.");
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement