• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Feature Rule Violation report command that DOES NOT create a file.

Delirium

OTLand veteran
Staff member
Global Moderator
Joined
May 28, 2007
Messages
3,365
Solutions
1
Reaction score
289
Location
Athens, Greece
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:
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},
below it add this:
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);
and below it add this:
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 :D

Do you have any questions? Ask here.
 
Last edited:
Isn't it a lot easier to use the Ctrl+R I made for OTS? Talaturen patched it on his SVN.
 
Back
Top