president vankk
Web Developer & AuraOT Owner
- Joined
- Jul 10, 2009
- Messages
- 5,719
- Solutions
- 9
- Reaction score
- 339
Hello, I want edit the TFS's report. Instead add a .txt file in reports folder it will goes to SQL.
This is the original code
I don't have any knowledge about C++, so sorry..
I'm trying using this, and it didn't work.
Thanks.
This is the original code
Code:
void Game::playerReportBug(uint32_t playerId, const std::string& message, const Position& position, uint8_t category)
{
Player* player = getPlayerByID(playerId);
if (!player) {
return;
}
if (player->getAccountType() == ACCOUNT_TYPE_NORMAL) {
return;
}
std::string fileName = "data/reports/" + player->getName() + " report.txt";
FILE* file = fopen(fileName.c_str(), "a");
if (!file) {
player->sendTextMessage(MESSAGE_EVENT_DEFAULT, "There was an error when processing your report, please contact a gamemaster.");
return;
}
const Position& playerPosition = player->getPosition();
if (category == BUG_CATEGORY_MAP) {
fprintf(file, "------------------------------\nName: %s [Map Position: %u, %u, %u] [Player Position: %u, %u, %u]\nComment: %s\n", player->getName().c_str(), position.x, position.y, position.z, playerPosition.x, playerPosition.y, playerPosition.z, message.c_str());
} else {
fprintf(file, "------------------------------\nName: %s [Player Position: %u, %u, %u]\nComment: %s\n", player->getName().c_str(), playerPosition.x, playerPosition.y, playerPosition.z, message.c_str());
}
fclose(file);
player->sendTextMessage(MESSAGE_EVENT_DEFAULT, "Your report has been sent to " + g_config.getString(ConfigManager::SERVER_NAME) + ".");
}
I don't have any knowledge about C++, so sorry..
I'm trying using this, and it didn't work.
Code:
query << "INSERT INTO `player_reports` (`id` ,`name` ,`posx` ,`posy` ,`posz` ,`report_description` ,`date`) VALUES (" << NULL << ',' << player->getName().c_str() << ',' << position.x << ',' << playerPosition.y << ', ' << playerPosition.z << ', '<< message.c_str() <<', ' << date? <<'");
Thanks.