Hello.Today I was boring so I decided to write a rule violation report command for tfs,since talaturen disabled ctrl+r.
Description:
A player types !reportviolation messagehere.The server creates a list of all players online and checks if their account type is equal to the gamemaster account type or higher.If there are players with this access,it sends a message to them including the message you wrote
So let's start!
In game.cpp at the bottom add:
Now in game.h find:
and below it add:
Close both game.cpp and game.h and don't forget to save them while closing them.
Now open commands.cpp and find this:
below it add this:
Now at the bottom of the file add this:
now move the the file command.h and find this:
and below it add this:
Now close both commands.cpp and commands.h (of course you have to save them).Compile the project and you're ready.
Credits:
100% to me.
TODO:
Comments Please
Do you have any questions? Ask here.
Description:
A player types !reportviolation messagehere.The server creates a list of all players online and checks if their account type is equal to the gamemaster account type or higher.If there are players with this access,it sends a message to them including the message you wrote
So let's start!
In game.cpp at the bottom add:
Code:
bool Game::playerReportViolation(Player* player, std::string violation)
{
//Made by Nikolas.Visit otland.net for support and information.
if(!player || player->isRemoved())
return false;
player->sendTextMessage(MSG_INFO_DESCR,"Your rule violation report request has been opened.Please wait patiently for a reply.");
for(AutoList<Player>::listiterator it = Player::listPlayer.list.begin(); it != Player::listPlayer.list.end(); ++it)
{
if((*it).second->getAccountType() >= ACCOUNT_TYPE_GAMEMASTER){
char buffer [250];
sprintf(buffer,"Player %s reported the following message:\n %s.",player->getName().c_str(),violation.c_str());
(*it).second->sendTextMessage(MSG_STATUS_WARNING,buffer);
}
}
return true;
}
Now in game.h find:
Code:
bool playerReportBug(uint32_t playerId, std::string bug);
and below it add:
Code:
// Made by Nikolas.Visit otland.net for support and information.
bool playerReportViolation(Player* player, std::string violation);
Close both game.cpp and game.h and don't forget to save them while closing them.
Now open commands.cpp and find this:
Code:
{"!buyhouse", &Commands::buyHouse},
Code:
// Made by Nikolas.Visit otland.net for support and information.
{"!reportviolation",&Commands::reportViolation},
Now at the bottom of the file add this:
Code:
bool Commands::reportViolation(Creature* creature, const std::string& cmd,const std::string& param)
{
// Made by Nikolas.Visit otland.net for support and information.
Player* player = creature->getPlayer();
if(player)
{
g_game.playerReportViolation(player,param.c_str());
}
return true;
}
now move the the file command.h and find this:
Code:
bool ghost(Creature* creature, const std::string& cmd, const std::string& param);
Code:
// Made by Nikolas.Visit otland.net for support and information.
bool reportViolation(Creature* creature, const std::string& cmd, const std::string& param)
Now close both commands.cpp and commands.h (of course you have to save them).Compile the project and you're ready.
Credits:
100% to me.
TODO:
- A delay between reports to protect gamemasters from being flooded with messages
- List all reports in a channel instead of sending a message to the gamemasters.
Comments Please
Do you have any questions? Ask here.
Last edited: