/* Global Warfare taunt plugin - Killarny (killarny@espnow.com)
 
This plugin enables|disables the taunt messages in Global Warfare that people so
often like to abuse.
 
(ie: "say_outloud 150" <- the evil Homer sound)
 
New Commands:
      admin_gw_taunts <on|off>: Toggles taunts in say_outloud and say_radio commands.
*/
/* $Id: plugin_gw_taunts.sma, 2001/06/14 Killarny Exp $ */
 
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
 
new STRING_VERSION[MAX_DATA_LENGTH] = "2.50.0";
new NOTAUNTS[MAX_DATA_LENGTH] = "Sorry, taunts are disabled because they are annoying.";
 
public admin_gw_taunts( HLCommand, HLData, HLUserName, UserIndex ) {
      new Command[MAX_COMMAND_LENGTH];
      new Data[MAX_DATA_LENGTH];
      new User[MAX_NAME_LENGTH];
 
      convert_string( HLCommand, Command, MAX_NAME_LENGTH );
      convert_string( HLData, Data, MAX_NAME_LENGTH );
      convert_string( HLUserName, User, MAX_NAME_LENGTH );
 
      if( strlen( Data ) == 0 ) {
            if( getvar( "admin_gw_allowtaunts" ) == 1 )
                  selfmessage( "Global Warfare taunts enabled." );
            if( getvar( "admin_gw_allowtaunts" ) == 0 )
                  selfmessage( "Global Warfare taunts disabled." );
            return PLUGIN_HANDLED;
      }
 
      if( check_param( Data ) == 1 ) {
            execute_command( User, Command, "admin_gw_allowtaunts", "1" );
            selfmessage( "Global Warfare taunts enabled." );
      } else if( check_param( Data ) == 0 ) {
            execute_command( User, Command, "admin_gw_allowtaunts", "0" );
            selfmessage( "Global Warfare taunts disabled." );
      }
 
      return PLUGIN_HANDLED;
}
 
public say_outloud( HLCommand,HLData,HLUserName,UserIndex) {
      new Command[MAX_COMMAND_LENGTH];
      new Data[MAX_DATA_LENGTH];
      new User[MAX_NAME_LENGTH];
 
      if( getvar( "admin_gw_allowtaunts" ) == 1 )
            return PLUGIN_CONTINUE;
 
      convert_string(HLCommand,Command,MAX_NAME_LENGTH);
      convert_string(HLData,Data,MAX_NAME_LENGTH);
      convert_string(HLUserName,User,MAX_NAME_LENGTH);
 
      if( 
            ( !strncmp( Data, "150", 3 ) ) ||
            ( !strncmp( Data, "140", 3 ) ) ||
            ( !strncmp( Data, "130", 3 ) ) ||
            ( !strncmp( Data, "120", 3 ) ) ||
            ( !strncmp( Data, "110", 3 ) ) ||
            ( !strncmp( Data, "100", 3 ) )
      ) {
            selfmessage( NOTAUNTS );
            return( PLUGIN_HANDLED );
      }
 
      return( PLUGIN_CONTINUE );
}
 
public say_radio( HLCommand,HLData,HLUserName,UserIndex) {
      new Command[MAX_COMMAND_LENGTH];
      new Data[MAX_DATA_LENGTH];
      new User[MAX_NAME_LENGTH];
 
      if( getvar( "admin_gw_allowtaunts" ) == 1 )
            return PLUGIN_CONTINUE;
 
      convert_string(HLCommand,Command,MAX_NAME_LENGTH);
      convert_string(HLData,Data,MAX_NAME_LENGTH);
      convert_string(HLUserName,User,MAX_NAME_LENGTH);
 
      if( 
            ( !strncmp( Data, "150", 3 ) ) ||
            ( !strncmp( Data, "140", 3 ) ) ||
            ( !strncmp( Data, "130", 3 ) ) ||
            ( !strncmp( Data, "120", 3 ) ) ||
            ( !strncmp( Data, "110", 3 ) ) ||
            ( !strncmp( Data, "100", 3 ) )
      ) {
            selfmessage( NOTAUNTS );
            return( PLUGIN_HANDLED );
      }
 
      return( PLUGIN_CONTINUE );
}
 
public plugin_init() {
      plugin_registerinfo( "Global Warfare Taunts plugin", "Enables|Disables taunts in the say_outloud and say_radio commands.", STRING_VERSION );
 
      plugin_registercmd( "admin_gw_taunts", "admin_gw_taunts", ACCESS_SAY, "admin_gw_taunts <^"on^" | ^"off^">: Toggles taunts in say_outloud and say_radio commands." );
      plugin_registercmd( "say_outloud", "say_outloud", ACCESS_ALL, "" );
      plugin_registercmd( "say_radio", "say_radio", ACCESS_ALL, "" );
 
      return PLUGIN_CONTINUE;
}