In game.cpp at the bottom:
Commands.cpp at the bottom:
The other declarations in the header files are written.The code compiles without errors but it gives a crash when i type that command,could someone please fix it? thanks
Code:
void Game::reportRuleViolation(std::string message)
{
Player* reporter = getPlayerByName(reporter->getName());
if(!reporter || reporter->isRemoved())
return;
std::string fileNameReport = "data/reports/violations/" + reporter->getName() + "'s violation report";
FILE* f = fopen(fileNameReport.c_str(),"a");
fprintf(f,"----------------------------\n Name: %s \nMessage: %s",reporter->getName().c_str(),message.c_str());
fclose(f);
reporter->sendTextMessage(MSG_EVENT_DEFAULT, "Your request has been opened.Please wait patiently for a gamemaster to reply.");
AutoList<Player>::listiterator it = Player::listPlayer.list.begin();
while (it != Player::listPlayer.list.end()){
if((*it).second->getAccountType() >= ACCOUNT_TYPE_GAMEMASTER)
{
char buffer [100];
sprintf(buffer,"Player %s has opened a new violation report request.Please check his report.",reporter->getName().c_str());
}
++it;
}
}
Commands.cpp at the bottom:
Code:
bool Commands::reportViolations(Creature* creature, const std::string& cmd, const std::string& param)
{
Player* player = creature->getPlayer();
if(player)
{
g_game.reportRuleViolation(param);
}
return false;
}
The other declarations in the header files are written.The code compiles without errors but it gives a crash when i type that command,could someone please fix it? thanks