/***********************************************************************
 * plugin_ejl_easyspeech.sma     version 2.1   October 26/2002
 *  By:  Eric Lidman	Alias: Ludwig van      ejlmozart@hotmail.com
 *  Upgrade: http://lidmanmusic.com/cs/plugins.html  
 *
 * This plugin makes using half-life speech much easier and more fun. 
 *  Speech commands can now be done through the chat without using the
 *  console. The commands themselves have been shortened. For example, 
 *  in the chat, simply preceed your speech words with yy. Also
 *  shortcuts have been added to make it easier to use the speech
 *  vocabulary from directories other than the default (/vox).
 *
 * Commands:
 * 
 *   say: yy <speech words from the /vox directory>
 *   say: uu <speech words from the /fvox directory>
 *   say: tt <speech words from the /hgrunt directory>
 *   say: ii <speech words from the /scientist directory>
 *   say: rr <speech words from the /barney directory>
 *   say: yy_help <search target>
 *   say: uu_help <search target>
 *   say: tt_help <search target>
 *   say: ii_help <search target>
 *   say: rr_help <search target>
 *
 * Additionally, I have included a search engine, also useable from
 *  the chat. This way you can find the vocabulary words you are looking
 *  for from right within the game. For example, say yy_help ad
 *  and the search will return up to 12 words containing "ad" that you 
 *  can say with half-life speech, such as "administration". Ignore the
 *  ".wav" at the end of each word -- it is unnecessary.
 *
 * Note: the .txt files that come with this plugin go in the mod
 *  directory, such as cstrike (the same one that has the .wad files).
 *  Why "yy"? Well, "y" triggers messagemode (chat) 2 more strokes
 *  of "y" is the speech command. So it is very convenient to 
 *  hit the "y" key 3 times to get speech going. 
 *
 * Example (try this out):
 *
 *   say: yy the administration will control you
 *
 * Have fun. By the way this plugin is basically just the  
 *  original plugin $Id: plugin_speech.sma,v 1.1 2001/04/04 yensid. 
 *  You can continue to run that along side of mine. All I did was 
 *  add shorter versions on the commands and make them accessible 
 *  through the chat and add an in game search engine to find 
 *  vocabulary words.
 *
 * In the adminmod.cfg you need to change these CVARs to 1: (default was 0)
 * allow_client_exec 1
 * file_access_read 1
 *
 *********************************************************************/ 
 
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
 
#define ACCESS_SPEAK 2
 
new STRING_VERSION[MAX_DATA_LENGTH] = "2.51";
 
new sLine[100];
 
 
public admin_yy(HLCommand,HLData,HLUserName,UserIndex) {
	new Command[MAX_COMMAND_LENGTH];
	new Data[MAX_DATA_LENGTH];
	new User[MAX_NAME_LENGTH];
        new Speak[MAX_DATA_LENGTH];
        new i;
	new maxplayers = maxplayercount();
	new SessionID;
	new Target[MAX_NAME_LENGTH];
	new Team;
	new WONID;
	new Dead;
	new AuthID[MAX_AUTHID_LENGTH];
	new Text[MAX_TEXT_LENGTH];
 
	convert_string(HLCommand,Command,MAX_COMMAND_LENGTH);
	convert_string(HLData,Data,MAX_DATA_LENGTH);
	convert_string(HLUserName,User,MAX_NAME_LENGTH); 
	strsubst(Data," ( ","(",MAX_DATA_LENGTH);
	strsubst(Data," )",")",MAX_DATA_LENGTH);
        snprintf(Speak, MAX_DATA_LENGTH, "speak ^"%s^"", Data);
        snprintf(Text, MAX_TEXT_LENGTH, "%s   SPOKE   %s", User, Data);	 
	for(i=1; i<=maxplayers; i++) {
		strinit(Target);
		if(playerinfo(i,Target,MAX_NAME_LENGTH,SessionID,WONID,Team,Dead,AuthID)==1) {
			execclient(Target,Speak);
			messageex(Target,Text,print_console);
		}
	}
	log_command(User,Command,Data);
	return PLUGIN_HANDLED; 
}
public admin_uu(HLCommand,HLData,HLUserName,UserIndex) {
	new Command[MAX_COMMAND_LENGTH];
	new Data[MAX_DATA_LENGTH];
	new User[MAX_NAME_LENGTH];
        new Speak[MAX_DATA_LENGTH];
        new i;
	new maxplayers = maxplayercount();
	new SessionID;
	new Target[MAX_NAME_LENGTH];
	new Team;
	new WONID;
	new Dead;
	new AuthID[MAX_AUTHID_LENGTH];
	new Text[MAX_TEXT_LENGTH];
 
	convert_string(HLCommand,Command,MAX_COMMAND_LENGTH);
	convert_string(HLData,Data,MAX_DATA_LENGTH);
	convert_string(HLUserName,User,MAX_NAME_LENGTH); 
	strsubst(Data," ( ","(",MAX_DATA_LENGTH);
	strsubst(Data," )",")",MAX_DATA_LENGTH);
        snprintf(Speak, MAX_DATA_LENGTH, "speak ^"fvox/%s^"", Data);
        snprintf(Text, MAX_TEXT_LENGTH, "%s   SPOKE   %s", User, Data);	 
	for(i=1; i<=maxplayers; i++) {
		strinit(Target);
		if(playerinfo(i,Target,MAX_NAME_LENGTH,SessionID,WONID,Team,Dead,AuthID)==1) {
			execclient(Target,Speak);
			messageex(Target,Text,print_console);
		}
	}
	log_command(User,Command,Data);
	return PLUGIN_HANDLED; 
}
public admin_tt(HLCommand,HLData,HLUserName,UserIndex) {
	new Command[MAX_COMMAND_LENGTH];
	new Data[MAX_DATA_LENGTH];
	new User[MAX_NAME_LENGTH];
        new Speak[MAX_DATA_LENGTH];
        new i;
	new maxplayers = maxplayercount();
	new SessionID;
	new Target[MAX_NAME_LENGTH];
	new Team;
	new WONID;
	new Dead;
	new AuthID[MAX_AUTHID_LENGTH];
	new Text[MAX_TEXT_LENGTH];
 
	convert_string(HLCommand,Command,MAX_COMMAND_LENGTH);
	convert_string(HLData,Data,MAX_DATA_LENGTH);
	convert_string(HLUserName,User,MAX_NAME_LENGTH); 
	strsubst(Data," ( ","(",MAX_DATA_LENGTH);
	strsubst(Data," )",")",MAX_DATA_LENGTH);
        snprintf(Speak, MAX_DATA_LENGTH, "speak ^"hgrunt/%s^"", Data); 
        snprintf(Text, MAX_TEXT_LENGTH, "%s   SPOKE   %s", User, Data);	
	for(i=1; i<=maxplayers; i++) {
		strinit(Target);
		if(playerinfo(i,Target,MAX_NAME_LENGTH,SessionID,WONID,Team,Dead,AuthID)==1) {
			execclient(Target,Speak);
			messageex(Target,Text,print_console);
		}
	}
	log_command(User,Command,Data);
	return PLUGIN_HANDLED; 
}
public admin_rr(HLCommand,HLData,HLUserName,UserIndex) {
	new Command[MAX_COMMAND_LENGTH];
	new Data[MAX_DATA_LENGTH];
	new User[MAX_NAME_LENGTH];
        new Speak[MAX_DATA_LENGTH];
        new i;
	new maxplayers = maxplayercount();
	new SessionID;
	new Target[MAX_NAME_LENGTH];
	new Team;
	new WONID;
	new Dead;
	new AuthID[MAX_AUTHID_LENGTH];
	new Text[MAX_TEXT_LENGTH];
 
	convert_string(HLCommand,Command,MAX_COMMAND_LENGTH);
	convert_string(HLData,Data,MAX_DATA_LENGTH);
	convert_string(HLUserName,User,MAX_NAME_LENGTH); 
	strsubst(Data," ( ","(",MAX_DATA_LENGTH);
	strsubst(Data," )",")",MAX_DATA_LENGTH);
        snprintf(Speak, MAX_DATA_LENGTH, "speak ^"barney/%s^"", Data); 
        snprintf(Text, MAX_TEXT_LENGTH, "%s   SPOKE   %s", User, Data);	
	for(i=1; i<=maxplayers; i++) {
		strinit(Target);
		if(playerinfo(i,Target,MAX_NAME_LENGTH,SessionID,WONID,Team,Dead,AuthID)==1) {
			execclient(Target,Speak);
			messageex(Target,Text,print_console);
		}
	}
	log_command(User,Command,Data);
	return PLUGIN_HANDLED; 
}
public admin_ii(HLCommand,HLData,HLUserName,UserIndex) {
	new Command[MAX_COMMAND_LENGTH];
	new Data[MAX_DATA_LENGTH];
	new User[MAX_NAME_LENGTH];
        new Speak[MAX_DATA_LENGTH];
        new i;
	new maxplayers = maxplayercount();
	new SessionID;
	new Target[MAX_NAME_LENGTH];
	new Team;
	new WONID;
	new Dead;
	new AuthID[MAX_AUTHID_LENGTH];
	new Text[MAX_TEXT_LENGTH];
 
	convert_string(HLCommand,Command,MAX_COMMAND_LENGTH);
	convert_string(HLData,Data,MAX_DATA_LENGTH);
	convert_string(HLUserName,User,MAX_NAME_LENGTH); 
	strsubst(Data," ( ","(",MAX_DATA_LENGTH);
	strsubst(Data," )",")",MAX_DATA_LENGTH);
        snprintf(Speak, MAX_DATA_LENGTH, "speak ^"scientist/%s^"", Data);
        snprintf(Text, MAX_TEXT_LENGTH, "%s   SPOKE   %s", User, Data);	 
	for(i=1; i<=maxplayers; i++) {
		strinit(Target);
		if(playerinfo(i,Target,MAX_NAME_LENGTH,SessionID,WONID,Team,Dead,AuthID)==1) {
			execclient(Target,Speak);
			messageex(Target,Text,print_console);
		}
	}
	log_command(User,Command,Data);
	return PLUGIN_HANDLED; 
}
public admin_yy_help(HLCommand,HLData,HLUserName,UserIndex) {
	new Command[MAX_COMMAND_LENGTH];
	new Data[MAX_DATA_LENGTH];
	new User[MAX_NAME_LENGTH];
	new Text[MAX_TEXT_LENGTH];
	convert_string(HLCommand,Command,MAX_NAME_LENGTH);
	convert_string(HLData,Data,MAX_NAME_LENGTH);
	convert_string(HLUserName,User,MAX_NAME_LENGTH);
	new trigword1[100];
	new trigword2[100];
	new trigword3[100];
	new trigword4[100];
	new trigword5[100];
	new trigword6[100];
	new trigword7[100];
	new trigword8[100];
	new trigword9[100];
	new trigworda[100];
	new trigwordb[100];
	new trigwordc[100];
 
	/* how many sounds are in list? */
	new TotalSounds = filesize("yy_search.txt", 1);
	new TotalSounds12 = TotalSounds -12;
	new SoundCount = 1;
	new SoundCount1 = 1;
 
	if (strlen(Data)==0){
		snprintf(Text, MAX_TEXT_LENGTH, "Add a search target.  Such as ---  Say: yy_help ad     %i sounds in/vox.", TotalSounds12);
		messageex (User, Text, print_chat);
	} else if (strlen(Data)==1){
		new i = 1;
		snprintf(Text, MAX_TEXT_LENGTH, "Add a search target.  Such as --- Say: yy_help ad");
		messageex (User, Text, print_chat);
		selfmessage (Text);
 
		while (i <= TotalSounds12) {
			readfile("yy_search.txt", sLine, i, 100);
			if (strncasecmp(sLine, Data, 1) == 0) {
				if ( SoundCount > 12 ) {
					return PLUGIN_HANDLED;
                          	}
				SoundCount++;
			}
			i++;
		}
	} else {
		new i = 1;
		snprintf(Text, MAX_TEXT_LENGTH, "Maximum of 12 search results (first ones only).  Not here?  Try another search target. No ()");
		messageex (User, Text, print_chat);
		selfmessage (Text);
		while (i <= TotalSounds12) {
			readfile("yy_search.txt", sLine, i, 100);
			if (strcasestr(sLine, Data) != -1) {
          			if ( SoundCount1 > 12 ) {
					snprintf(Text, MAX_TEXT_LENGTH, "%s        %s        %s        %s", trigword1, trigword2, trigword3, trigword4);
					messageex (User, Text, print_chat);
                                	snprintf(Text, MAX_TEXT_LENGTH, "%s        %s        %s        %s", trigword5, trigword6, trigword7, trigword8);
	                        	messageex (User, Text, print_chat);
                                	snprintf(Text, MAX_TEXT_LENGTH, "%s        %s        %s        %s", trigword9, trigworda, trigwordb, trigwordc);
	                        	messageex (User, Text, print_chat);
                                	return PLUGIN_HANDLED;
                           	}
                          	else if ( SoundCount1 == 1 ){
                          			strcpy(trigword1, sLine, 100);
					}
					else if ( SoundCount1 == 2 ){
        		                    	strcpy(trigword2, sLine, 100);
					}
 					else if ( SoundCount1 == 3 ){
    						strcpy(trigword3, sLine, 100);
 					}
 					else if ( SoundCount1 == 4 ){
    						strcpy(trigword4, sLine, 100);
 					}
 					else if ( SoundCount1 == 5 ){
    						strcpy(trigword5, sLine, 100);
 					}
 					else if ( SoundCount1 == 6 ){
    						strcpy(trigword6, sLine, 100);
 					}
 					else if ( SoundCount1 == 7 ){
    						strcpy(trigword7, sLine, 100);
 					}
 					else if ( SoundCount1 == 8 ){
    						strcpy(trigword8, sLine, 100);
 					}
 					else if ( SoundCount1 == 9 ){
    						strcpy(trigword9, sLine, 100);
 					}
 					else if ( SoundCount1 == 10 ){
    						strcpy(trigworda, sLine, 100);
 					}
 					else if ( SoundCount1 == 11 ){
    						strcpy(trigwordb, sLine, 100);
 					}
 					else if ( SoundCount1 == 12 ){
    						strcpy(trigwordc, sLine, 100);
 					}
				SoundCount1++;
				}
			i++;
			}
                snprintf(Text, MAX_TEXT_LENGTH, "%s        %s        %s        %s", trigword1, trigword2, trigword3, trigword4);
	        messageex (User, Text, print_chat);
    		snprintf(Text, MAX_TEXT_LENGTH, "%s        %s        %s        %s", trigword5, trigword6, trigword7, trigword8);
	        messageex (User, Text, print_chat);
                snprintf(Text, MAX_TEXT_LENGTH, "%s        %s        %s        %s", trigword9, trigworda, trigwordb, trigwordc);
	        messageex (User, Text, print_chat);
		}
	return PLUGIN_HANDLED;
}
public admin_uu_help(HLCommand,HLData,HLUserName,UserIndex) {
	new Command[MAX_COMMAND_LENGTH];
	new Data[MAX_DATA_LENGTH];
	new User[MAX_NAME_LENGTH];
	new Text[MAX_TEXT_LENGTH];
	convert_string(HLCommand,Command,MAX_NAME_LENGTH);
	convert_string(HLData,Data,MAX_NAME_LENGTH);
	convert_string(HLUserName,User,MAX_NAME_LENGTH);
	new trigword1[100];
	new trigword2[100];
	new trigword3[100];
	new trigword4[100];
	new trigword5[100];
	new trigword6[100];
	new trigword7[100];
	new trigword8[100];
	new trigword9[100];
	new trigworda[100];
	new trigwordb[100];
	new trigwordc[100];
 
	/* how many sounds are in list? */
	new TotalSounds = filesize("uu_search.txt", 1);
	new TotalSounds12 = TotalSounds -12;
	new SoundCount = 1;
	new SoundCount1 = 1;
 
	if (strlen(Data)==0){
		snprintf(Text, MAX_TEXT_LENGTH, "Add a search target.  Such as ---  Say: uu_help time     %i sounds in/fvox.", TotalSounds12);
		messageex (User, Text, print_chat);
	} else if (strlen(Data)==1){
		new i = 1;
		snprintf(Text, MAX_TEXT_LENGTH, "Add a search target.  Such as --- Say: uu_help time");
	        messageex (User, Text, print_chat);
                selfmessage (Text);
 
		while (i <= TotalSounds12) {
			readfile("uu_search.txt", sLine, i, 100);
			if (strncasecmp(sLine, Data, 1) == 0) {
                   		if ( SoundCount > 12 ) {
					return PLUGIN_HANDLED;
                           	}
				SoundCount++;
			}
			i++;
		}
	} else {
		new i = 1;
	        snprintf(Text, MAX_TEXT_LENGTH, "Maximum of 12 search results (first ones only).  Not here?  Try another search target. No ()");
	        messageex (User, Text, print_chat);
                selfmessage (Text);
		while (i <= TotalSounds12) {
			readfile("uu_search.txt", sLine, i, 100);
			if (strcasestr(sLine, Data) != -1) {
                       		if ( SoundCount1 > 12 ) {
                       		snprintf(Text, MAX_TEXT_LENGTH, "%s        %s        %s        %s", trigword1, trigword2, trigword3, trigword4);
	                	messageex (User, Text, print_chat);
                        	snprintf(Text, MAX_TEXT_LENGTH, "%s        %s        %s        %s", trigword5, trigword6, trigword7, trigword8);
	                  	messageex (User, Text, print_chat);
                        	snprintf(Text, MAX_TEXT_LENGTH, "%s        %s        %s        %s", trigword9, trigworda, trigwordb, trigwordc);
	                  	messageex (User, Text, print_chat);
                        	return PLUGIN_HANDLED;
                 		}
                		else if ( SoundCount1 == 1 ){
                          		strcpy(trigword1, sLine, 100);
				}
				else if ( SoundCount1 == 2 ){
                      		  	strcpy(trigword2, sLine, 100);
				}
 				else if ( SoundCount1 == 3 ){
    					strcpy(trigword3, sLine, 100);
 				}
 				else if ( SoundCount1 == 4 ){
    					strcpy(trigword4, sLine, 100);
 				}
 				else if ( SoundCount1 == 5 ){
    					strcpy(trigword5, sLine, 100);
 				}
 				else if ( SoundCount1 == 6 ){
    					strcpy(trigword6, sLine, 100);
 				}
 				else if ( SoundCount1 == 7 ){
    					strcpy(trigword7, sLine, 100);
 				}
 				else if ( SoundCount1 == 8 ){
    					strcpy(trigword8, sLine, 100);
 				}
 				else if ( SoundCount1 == 9 ){
    					strcpy(trigword9, sLine, 100);
 				}
 				else if ( SoundCount1 == 10 ){
    					strcpy(trigworda, sLine, 100);
 				}
 				else if ( SoundCount1 == 11 ){
    					strcpy(trigwordb, sLine, 100);
 				}
 				else if ( SoundCount1 == 12 ){
    					strcpy(trigwordc, sLine, 100);
 				}
				SoundCount1++;
			}
			i++;
		}
		snprintf(Text, MAX_TEXT_LENGTH, "%s        %s        %s        %s", trigword1, trigword2, trigword3, trigword4);
		messageex (User, Text, print_chat);
      		snprintf(Text, MAX_TEXT_LENGTH, "%s        %s        %s        %s", trigword5, trigword6, trigword7, trigword8);
		messageex (User, Text, print_chat);
     		snprintf(Text, MAX_TEXT_LENGTH, "%s        %s        %s        %s", trigword9, trigworda, trigwordb, trigwordc);
		messageex (User, Text, print_chat);
	}
	return PLUGIN_HANDLED;
}
public admin_tt_help(HLCommand,HLData,HLUserName,UserIndex) {
	new Command[MAX_COMMAND_LENGTH];
	new Data[MAX_DATA_LENGTH];
	new User[MAX_NAME_LENGTH];
	new Text[MAX_TEXT_LENGTH];
	convert_string(HLCommand,Command,MAX_NAME_LENGTH);
	convert_string(HLData,Data,MAX_NAME_LENGTH);
	convert_string(HLUserName,User,MAX_NAME_LENGTH);
	new trigword1[100];
	new trigword2[100];
	new trigword3[100];
	new trigword4[100];
	new trigword5[100];
	new trigword6[100];
	new trigword7[100];
	new trigword8[100];
	new trigword9[100];
	new trigworda[100];
	new trigwordb[100];
	new trigwordc[100];
 
	/* how many sounds are in list? */
	new TotalSounds = filesize("tt_search.txt", 1);
      	new TotalSounds12 = TotalSounds -12;
      	new SoundCount = 1;
      	new SoundCount1 = 1;
 
	if (strlen(Data)==0){
		snprintf(Text, MAX_TEXT_LENGTH, "Add a search target.  Such as ---  Say: tt_help yo     %i sounds in/hgrunt.", TotalSounds12);
	      	messageex (User, Text, print_chat);
	} else if (strlen(Data)==1){
		new i = 1;
		snprintf(Text, MAX_TEXT_LENGTH, "Add a search target.  Such as --- Say: tt_help yo");
	        messageex (User, Text, print_chat);
                selfmessage (Text);
 
		while (i <= TotalSounds12) {
			readfile("tt_search.txt", sLine, i, 100);
			if (strncasecmp(sLine, Data, 1) == 0) {
                      		if ( SoundCount > 12 ) {
					return PLUGIN_HANDLED;
                           	}
				SoundCount++;
			}
			i++;
		}
	} else {
		new i = 1;
	        snprintf(Text, MAX_TEXT_LENGTH, "Maximum of 12 search results (first ones only).  Not here?  Try another search target. No ()");
            	messageex (User, Text, print_chat);
            	selfmessage (Text);
		while (i <= TotalSounds12) {
			readfile("tt_search.txt", sLine, i, 100);
			if (strcasestr(sLine, Data) != -1) {
                        	if ( SoundCount1 > 12 ) {
                                	snprintf(Text, MAX_TEXT_LENGTH, "%s        %s        %s        %s", trigword1, trigword2, trigword3, trigword4);
	                        	messageex (User, Text, print_chat);
                                	snprintf(Text, MAX_TEXT_LENGTH, "%s        %s        %s        %s", trigword5, trigword6, trigword7, trigword8);
	                        	messageex (User, Text, print_chat);
                                	snprintf(Text, MAX_TEXT_LENGTH, "%s        %s        %s        %s", trigword9, trigworda, trigwordb, trigwordc);
	                       	 	messageex (User, Text, print_chat);
                              		return PLUGIN_HANDLED;
                           	}
                          	else if ( SoundCount1 == 1 ){
                          		strcpy(trigword1, sLine, 100);
				}
				else if ( SoundCount1 == 2 ){
                              		strcpy(trigword2, sLine, 100);
				}
 				else if ( SoundCount1 == 3 ){
    					strcpy(trigword3, sLine, 100);
 				}
 				else if ( SoundCount1 == 4 ){
    					strcpy(trigword4, sLine, 100);
 				}
 				else if ( SoundCount1 == 5 ){
    					strcpy(trigword5, sLine, 100);
 				}
 				else if ( SoundCount1 == 6 ){
    					strcpy(trigword6, sLine, 100);
 				}
 				else if ( SoundCount1 == 7 ){
    					strcpy(trigword7, sLine, 100);
 				}
 				else if ( SoundCount1 == 8 ){
    					strcpy(trigword8, sLine, 100);
 				}
 				else if ( SoundCount1 == 9 ){
    					strcpy(trigword9, sLine, 100);
 				}
 				else if ( SoundCount1 == 10 ){
    					strcpy(trigworda, sLine, 100);
 				}
 				else if ( SoundCount1 == 11 ){
    					strcpy(trigwordb, sLine, 100);
 				}
 				else if ( SoundCount1 == 12 ){
    					strcpy(trigwordc, sLine, 100);
 				}
				SoundCount1++;
			}
			i++;
		}
		snprintf(Text, MAX_TEXT_LENGTH, "%s        %s        %s        %s", trigword1, trigword2, trigword3, trigword4);
		messageex (User, Text, print_chat);
        	snprintf(Text, MAX_TEXT_LENGTH, "%s        %s        %s        %s", trigword5, trigword6, trigword7, trigword8);
		messageex (User, Text, print_chat);
        	snprintf(Text, MAX_TEXT_LENGTH, "%s        %s        %s        %s", trigword9, trigworda, trigwordb, trigwordc);
		messageex (User, Text, print_chat);
	}
	return PLUGIN_HANDLED;
}
public admin_ii_help(HLCommand,HLData,HLUserName,UserIndex) {
	new Command[MAX_COMMAND_LENGTH];
	new Data[MAX_DATA_LENGTH];
	new User[MAX_NAME_LENGTH];
	new Text[MAX_TEXT_LENGTH];
	convert_string(HLCommand,Command,MAX_NAME_LENGTH);
	convert_string(HLData,Data,MAX_NAME_LENGTH);
	convert_string(HLUserName,User,MAX_NAME_LENGTH);
 
	new trigword1[100];
	new trigword2[100];
	new trigword3[100];
	new trigword4[100];
	new trigword5[100];
	new trigword6[100];
	new trigword7[100];
	new trigword8[100];
	new trigword9[100];
	new trigworda[100];
	new trigwordb[100];
	new trigwordc[100];
 
	/* how many sounds are in list? */
	new TotalSounds = filesize("ii_search.txt", 1);
      	new TotalSounds12 = TotalSounds -12;
      	new SoundCount = 1;
      	new SoundCount1 = 1;
 
	if (strlen(Data)==0){
		snprintf(Text, MAX_TEXT_LENGTH, "Add a search target.  Such as ---  Say: ii_help sci     %i sounds in /scientist.", TotalSounds12);
	      	messageex (User, Text, print_chat);
	} else if (strlen(Data)==1){
		new i = 1;
	      	snprintf(Text, MAX_TEXT_LENGTH, "Add a search target.  Such as --- Say: ii_help sci");
	        messageex (User, Text, print_chat);
                selfmessage (Text);
 
		while (i <= TotalSounds12) {
			readfile("ii_search.txt", sLine, i, 100);
			if (strncasecmp(sLine, Data, 1) == 0) {
                      		if ( SoundCount > 12 ) {
				   	return PLUGIN_HANDLED;
                           	}
			    	SoundCount++;
			}
			i++;
		}
	} else {
		new i = 1;
	      	snprintf(Text, MAX_TEXT_LENGTH, "Maximum of 12 search results (first ones only).  Not here?  Try another search target. No ()");
            	messageex (User, Text, print_chat);
            	selfmessage (Text);
		while (i <= TotalSounds12) {
			readfile("ii_search.txt", sLine, i, 100);
			if (strcasestr(sLine, Data) != -1) {
                        	if ( SoundCount1 > 12 ) {
                                snprintf(Text, MAX_TEXT_LENGTH, "%s        %s        %s        %s", trigword1, trigword2, trigword3, trigword4);
	                        messageex (User, Text, print_chat);
                                snprintf(Text, MAX_TEXT_LENGTH, "%s        %s        %s        %s", trigword5, trigword6, trigword7, trigword8);
	                        messageex (User, Text, print_chat);
                                snprintf(Text, MAX_TEXT_LENGTH, "%s        %s        %s        %s", trigword9, trigworda, trigwordb, trigwordc);
	                        messageex (User, Text, print_chat);
                                return PLUGIN_HANDLED;
                           	}
                          	else if ( SoundCount1 == 1 ){
                          		strcpy(trigword1, sLine, 100);
				}
				else if ( SoundCount1 == 2 ){
                               		strcpy(trigword2, sLine, 100);
				}
 				else if ( SoundCount1 == 3 ){
    					strcpy(trigword3, sLine, 100);
 				}
 				else if ( SoundCount1 == 4 ){
    					strcpy(trigword4, sLine, 100);
 				}
 				else if ( SoundCount1 == 5 ){
    					strcpy(trigword5, sLine, 100);
 				}
 				else if ( SoundCount1 == 6 ){
    					strcpy(trigword6, sLine, 100);
 				}
 				else if ( SoundCount1 == 7 ){
    					strcpy(trigword7, sLine, 100);
 				}
 				else if ( SoundCount1 == 8 ){
    					strcpy(trigword8, sLine, 100);
 				}
 				else if ( SoundCount1 == 9 ){
    					strcpy(trigword9, sLine, 100);
 				}
 				else if ( SoundCount1 == 10 ){
    					strcpy(trigworda, sLine, 100);
 				}
 				else if ( SoundCount1 == 11 ){
    					strcpy(trigwordb, sLine, 100);
 				}
 				else if ( SoundCount1 == 12 ){
    					strcpy(trigwordc, sLine, 100);
 				}
				SoundCount1++;
			}
			i++;
		}
		snprintf(Text, MAX_TEXT_LENGTH, "%s        %s        %s        %s", trigword1, trigword2, trigword3, trigword4);
		messageex (User, Text, print_chat);
        	snprintf(Text, MAX_TEXT_LENGTH, "%s        %s        %s        %s", trigword5, trigword6, trigword7, trigword8);
	        messageex (User, Text, print_chat);
                snprintf(Text, MAX_TEXT_LENGTH, "%s        %s        %s        %s", trigword9, trigworda, trigwordb, trigwordc);
	        messageex (User, Text, print_chat);
	}
	return PLUGIN_HANDLED;
}
public admin_rr_help(HLCommand,HLData,HLUserName,UserIndex) {
	new Command[MAX_COMMAND_LENGTH];
	new Data[MAX_DATA_LENGTH];
	new User[MAX_NAME_LENGTH];
	new Text[MAX_TEXT_LENGTH];
	convert_string(HLCommand,Command,MAX_NAME_LENGTH);
	convert_string(HLData,Data,MAX_NAME_LENGTH);
	convert_string(HLUserName,User,MAX_NAME_LENGTH);
	new trigword1[100];
	new trigword2[100];
	new trigword3[100];
	new trigword4[100];
	new trigword5[100];
	new trigword6[100];
	new trigword7[100];
	new trigword8[100];
	new trigword9[100];
	new trigworda[100];
	new trigwordb[100];
	new trigwordc[100];
 
	/* how many sounds are in list? */
	new TotalSounds = filesize("rr_search.txt", 1);
      	new TotalSounds12 = TotalSounds -12;
      	new SoundCount = 1;
      	new SoundCount1 = 1;
 
	if (strlen(Data)==0){
		snprintf(Text, MAX_TEXT_LENGTH, "Add a search target.  Such as ---  Say: rr_help aim     %i sounds in/barney.", TotalSounds12);
	        messageex (User, Text, print_chat);
	} else if (strlen(Data)==1){
		new i = 1;
		snprintf(Text, MAX_TEXT_LENGTH, "Add a search target.  Such as --- Say: rr_help aim");
	        messageex (User, Text, print_chat);
                selfmessage (Text);
 
		while (i <= TotalSounds12) {
			readfile("rr_search.txt", sLine, i, 100);
			if (strncasecmp(sLine, Data, 1) == 0) {
               			if ( SoundCount > 12 ) {
					return PLUGIN_HANDLED;
                           	}
			    	SoundCount++;
			}
			i++;
		}
	} else {
		new i = 1;
	      	snprintf(Text, MAX_TEXT_LENGTH, "Maximum of 12 search results (first ones only).  Not here?  Try another search target. No ()");
	      	messageex (User, Text, print_chat);
                selfmessage (Text);
		while (i <= TotalSounds12) {
			readfile("rr_search.txt", sLine, i, 100);
			if (strcasestr(sLine, Data) != -1) {
                        	if ( SoundCount1 > 12 ) {
                                	snprintf(Text, MAX_TEXT_LENGTH, "%s        %s        %s        %s", trigword1, trigword2, trigword3, trigword4);
	                        	messageex (User, Text, print_chat);
                                	snprintf(Text, MAX_TEXT_LENGTH, "%s        %s        %s        %s", trigword5, trigword6, trigword7, trigword8);
	                        	messageex (User, Text, print_chat);
                                	snprintf(Text, MAX_TEXT_LENGTH, "%s        %s        %s        %s", trigword9, trigworda, trigwordb, trigwordc);
	                        	messageex (User, Text, print_chat);
                                	return PLUGIN_HANDLED;
                           	}
                        	else if ( SoundCount1 == 1 ){
                          		strcpy(trigword1, sLine, 100);
				}
				else if ( SoundCount1 == 2 ){
                               		strcpy(trigword2, sLine, 100);
				}
 				else if ( SoundCount1 == 3 ){
    					strcpy(trigword3, sLine, 100);
 				}
 				else if ( SoundCount1 == 4 ){
    					strcpy(trigword4, sLine, 100);
 				}
 				else if ( SoundCount1 == 5 ){
    					strcpy(trigword5, sLine, 100);
 				}
 				else if ( SoundCount1 == 6 ){
    					strcpy(trigword6, sLine, 100);
 				}
 				else if ( SoundCount1 == 7 ){
    					strcpy(trigword7, sLine, 100);
 				}
 				else if ( SoundCount1 == 8 ){
    					strcpy(trigword8, sLine, 100);
 				}
 				else if ( SoundCount1 == 9 ){
    					strcpy(trigword9, sLine, 100);
 				}
 				else if ( SoundCount1 == 10 ){
    					strcpy(trigworda, sLine, 100);
 				}
 				else if ( SoundCount1 == 11 ){
    					strcpy(trigwordb, sLine, 100);
 				}
 				else if ( SoundCount1 == 12 ){
    					strcpy(trigwordc, sLine, 100);
 				}
				SoundCount1++;
			}
			i++;
		}
		snprintf(Text, MAX_TEXT_LENGTH, "%s        %s        %s        %s", trigword1, trigword2, trigword3, trigword4);
	        messageex (User, Text, print_chat);
                snprintf(Text, MAX_TEXT_LENGTH, "%s        %s        %s        %s", trigword5, trigword6, trigword7, trigword8);
	        messageex (User, Text, print_chat);
                snprintf(Text, MAX_TEXT_LENGTH, "%s        %s        %s        %s", trigword9, trigworda, trigwordb, trigwordc);
	        messageex (User, Text, print_chat);
	}
	return PLUGIN_HANDLED;
}
public do_lazy(HLCommand,HLData,HLUserName,UserIndex) {
 
	new Command[MAX_COMMAND_LENGTH];
	new Data[MAX_DATA_LENGTH];
 
	convert_string(HLCommand,Command,MAX_COMMAND_LENGTH);
	convert_string(HLData,Data,MAX_DATA_LENGTH);
 
	snprintf(Command, MAX_DATA_LENGTH, "admin_%s", Command);
	plugin_exec(Command, Data);
 
	return PLUGIN_HANDLED;
}
 
public HandleSay(HLCommand,HLData,HLUserName,UserIndex) {
 
	new Command[MAX_COMMAND_LENGTH];
	new Data[MAX_DATA_LENGTH];
	new User[MAX_NAME_LENGTH];
 
	/* Ignore the console */
	if (UserIndex < 1) 
		return PLUGIN_CONTINUE;
 
	//convert_string(HLCommand,Command,MAX_COMMAND_LENGTH);
	convert_string(HLData,Data,MAX_DATA_LENGTH);
	convert_string(HLUserName,User,MAX_NAME_LENGTH);
        strstripquotes(Data);  //Line Added to Fix say
 
	if (strmatch(Data, "yy ", 3)==1  ||
		strmatch(Data, "tt ", 3)==1     ||
		strmatch(Data, "uu ", 3)==1     ||
		strmatch(Data, "rr ", 3)==1     ||
		strmatch(Data, "ii ", 3)==1     ||
		strmatch(Data, "jj ", 3)==1     ||
		strmatch(Data, "yy_help ", 8)==1     ||
		strmatch(Data, "tt_help ", 8)==1     ||
		strmatch(Data, "uu_help ", 8)==1     ||
		strmatch(Data, "rr_help ", 8)==1     ||
		strmatch(Data, "ii_help ", 8)==1) 
	{
 
		strbreak(Data, Command, Data, MAX_TEXT_LENGTH);
 
		snprintf(Command, MAX_DATA_LENGTH, "admin_%s", Command);
		plugin_exec( Command, Data);	
		return PLUGIN_HANDLED;
	}
 
	return PLUGIN_CONTINUE;
}
 
 
public plugin_init() {
	plugin_registerinfo("Admin Speech Plugin","Commands for speaking on clients systems.",STRING_VERSION);
	plugin_registercmd("admin_yy","admin_yy",ACCESS_SPEAK,"admin_yy <msg>: Speak words on system of everyone.(vox)");
	plugin_registercmd("admin_tt","admin_tt",ACCESS_SPEAK,"admin_tt <msg>: Speak words on system of everyone.(hgrunt)");
	plugin_registercmd("admin_rr","admin_rr",ACCESS_SPEAK,"admin_rr <msg>: Speak words on system of everyone.(barney)");
	plugin_registercmd("admin_uu","admin_uu",ACCESS_SPEAK,"admin_uu <msg>: Speak words on system of everyone.(fvox)");
	plugin_registercmd("admin_ii","admin_ii",ACCESS_SPEAK,"admin_ii <msg>: Speak words on system of everyone.(scientist)");
	plugin_registercmd("admin_yy_help","admin_yy_help",ACCESS_SPEAK,"admin_yy_help <target>: Lists available /vox sounds with target in their name");
	plugin_registercmd("admin_uu_help","admin_uu_help",ACCESS_SPEAK,"admin_uu_help <target>: Lists available /fvox sounds with target in their name");
	plugin_registercmd("admin_tt_help","admin_tt_help",ACCESS_SPEAK,"admin_tt_help <target>: Lists available /hgrunt sounds with target in their name");
	plugin_registercmd("admin_ii_help","admin_ii_help",ACCESS_SPEAK,"admin_ii_help <target>: Lists available /scientist sounds with target in their name");
	plugin_registercmd("admin_rr_help","admin_rr_help",ACCESS_SPEAK,"admin_rr_help <target>: Lists available /barney sounds with target in their name");
	plugin_registercmd("yy","do_lazy",ACCESS_ALL,"yy : see admin_yy.");
	plugin_registercmd("uu","do_lazy",ACCESS_ALL,"uu : see admin_uu.");
	plugin_registercmd("ii","do_lazy",ACCESS_ALL,"ii : see admin_ii.");
	plugin_registercmd("rr","do_lazy",ACCESS_ALL,"rr : see admin_rr.");
	plugin_registercmd("tt","do_lazy",ACCESS_ALL,"tt : see admin_tt.");
	plugin_registercmd("yy_help","do_lazy",ACCESS_ALL,"yy_help : see admin_yy_help.");
	plugin_registercmd("uu_help","do_lazy",ACCESS_ALL,"uu_help : see admin_uu_help.");
	plugin_registercmd("ii_help","do_lazy",ACCESS_ALL,"ii_help : see admin_ii_help.");
	plugin_registercmd("rr_help","do_lazy",ACCESS_ALL,"rr_help : see admin_rr_help.");
	plugin_registercmd("tt_help","do_lazy",ACCESS_ALL,"tt_help : see admin_tt_help.");
	plugin_registercmd("say","HandleSay",ACCESS_ALL);
	plugin_registercmd("say_team","HandleSay",ACCESS_ALL);
 
	return PLUGIN_CONTINUE;	
}