/*
 * Admin mod script. Copyright (C) 2000, Alfred Reynolds.
 * $Id: plugin_base.sma,v 1.2.2.12 2002/01/16 01:28:47 darope Exp $
 * modified by Caveman 14:43 30/03/2002
*/
 
/* This is a replacement for the standard tsay that adds some extra functionality.
   Please read the readme. http://gosh.ex.ac.uk/~py99jan/                          */
 
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
 
new STRING_VERSION[MAX_DATA_LENGTH] = "2.51.00";
 
 
public admin_tsay(HLCommand,HLData,HLUserName,UserIndex) {
	new Command[MAX_COMMAND_LENGTH];
	new Data[MAX_DATA_LENGTH];
	new User[MAX_NAME_LENGTH];
	new Color[MAX_NAME_LENGTH];
	new Message[MAX_DATA_LENGTH];
	new Text[MAX_DATA_LENGTH];
 
	convert_string(HLCommand,Command,MAX_COMMAND_LENGTH);
	convert_string(HLData,Data,MAX_DATA_LENGTH);
	convert_string(HLUserName,User,MAX_NAME_LENGTH);
 
	strbreak(Data,Color,Text,MAX_DATA_LENGTH);
 
	snprintf(Message,MAX_DATA_LENGTH,"%s: %s",User, Text);
	if (streq(Color,"red")==1) {
		typesay(Message,10,250,10,10);
	} else if ( streq(Color, "blue")==1) {
		typesay(Message,10,10,10,250);
	} else if ( streq(Color, "green")==1) {
		typesay(Message,10,10,250,10);
	} else if ( streq(Color, "white")==1) {
		typesay(Message,10,250,250,250);
	} else if ( streq(Color, "yellow")==1) {
		typesay(Message,10,250,250,10);
	} else if ( streq(Color, "purple")==1) {
		typesay(Message,10,250,10,250);
	} else {
		snprintf(Message,MAX_DATA_LENGTH,"%s: %s",User, Data);
		typesay(Message,10,220,220,220);
	}
	log_command(User,Command,Data);
	return PLUGIN_HANDLED;
}
 
 
public plugin_init() {
	plugin_registerinfo("Base Plugin Extension","Extension to the standard tsay function.",STRING_VERSION);
 
	plugin_registercmd("admin_tsay","admin_tsay",ACCESS_SAY,"admin_tsay [color] <msg>: Prints msg on lower left of screen.");
 
	return PLUGIN_CONTINUE;
}
/*
 * Admin mod script. Copyright (C) 2000, Alfred Reynolds.
 * $Id: plugin_base.sma,v 1.2.2.12 2002/01/16 01:28:47 darope Exp $
 * modified by Caveman 14:43 30/03/2002
*/
 
/* This is a replacement for the standard tsay that adds some extra functionality.
   Please read the readme. http://gosh.ex.ac.uk/~py99jan/                          */
 
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
 
new STRING_VERSION[MAX_DATA_LENGTH] = "2.51.00";
 
 
public admin_tsay(HLCommand,HLData,HLUserName,UserIndex) {
	new Command[MAX_COMMAND_LENGTH];
	new Data[MAX_DATA_LENGTH];
	new User[MAX_NAME_LENGTH];
	new Color[MAX_NAME_LENGTH];
	new Message[MAX_DATA_LENGTH];
	new Text[MAX_DATA_LENGTH];
	new i;
	new Name[MAX_NAME_LENGTH];
 
	convert_string(HLCommand,Command,MAX_COMMAND_LENGTH);
	convert_string(HLData,Data,MAX_DATA_LENGTH);
	convert_string(HLUserName,User,MAX_NAME_LENGTH);
 
	strbreak(Data,Color,Message,MAX_DATA_LENGTH);
	snprintf(Text, MAX_TEXT_LENGTH, "%s: %s", User, Message);
	if (streq(Color,"red")==1) {
		typesay(Message,10,250,10,10);
	} else if ( streq(Color, "blue")==1) {
		typesay(Message,10,10,10,250);
	} else if ( streq(Color, "green")==1) {
		typesay(Message,10,10,250,10);
	} else if ( streq(Color, "white")==1) {
		typesay(Message,10,250,250,250);
	} else if ( streq(Color, "yellow")==1) {
		typesay(Message,10,250,250,10);
	} else if ( streq(Color, "purple")==1) {
		typesay(Message,10,250,10,250);
	} else {
		strinit(Text);
		snprintf(Text, MAX_TEXT_LENGTH, "%s: %s", User, Data);
		typesay(Data,10,220,220,220);
	}
	for(i=1; i<=maxplayercount(); i++) {
		strinit(Name);
		if(playerinfo(i,Name,MAX_NAME_LENGTH)==1) {
			if(access(ACCESS_CHAT,Name)!=0) {
				messageex(Name, Text, print_tty);
			}
		}
	}
	log_command(User,Command,Data);
	return PLUGIN_HANDLED;
}
 
 
public plugin_init() {
	plugin_registerinfo("Base Plugin Extension","Extension to the standard tsay function.",STRING_VERSION);
 
	plugin_registercmd("admin_tsay","admin_tsay",ACCESS_SAY,"admin_tsay [color] <msg>: Prints msg on lower left of screen.");
 
	return PLUGIN_CONTINUE;
}
/*
 * Admin mod script. Copyright (C) 2000, Alfred Reynolds.
 * $Id: plugin_base.sma,v 1.2.2.12 2002/01/16 01:28:47 darope Exp $
 * modified by Caveman 14:43 30/03/2002
*/
 
/* This is a replacement for the standard tsay that adds some extra functionality.
   Please read the readme. http://gosh.ex.ac.uk/~py99jan/                          */
 
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
 
new STRING_VERSION[MAX_DATA_LENGTH] = "2.51.00";
 
 
public admin_tsay(HLCommand,HLData,HLUserName,UserIndex) {
	new Command[MAX_COMMAND_LENGTH];
	new Data[MAX_DATA_LENGTH];
	new User[MAX_NAME_LENGTH];
	new Color[MAX_NAME_LENGTH];
	new Message[MAX_DATA_LENGTH];
	new Text[MAX_DATA_LENGTH];
	new i;
	new Name[MAX_NAME_LENGTH];
 
	convert_string(HLCommand,Command,MAX_COMMAND_LENGTH);
	convert_string(HLData,Data,MAX_DATA_LENGTH);
	convert_string(HLUserName,User,MAX_NAME_LENGTH);
 
	strbreak(Data,Color,Message,MAX_DATA_LENGTH);
	snprintf(Text, MAX_TEXT_LENGTH, "%s: %s", User, Message);
	if (streq(Color,"red")==1) {
		typesay(Message,10,250,10,10);
	} else if ( streq(Color, "blue")==1) {
		typesay(Message,10,10,10,250);
	} else if ( streq(Color, "green")==1) {
		typesay(Message,10,10,250,10);
	} else if ( streq(Color, "white")==1) {
		typesay(Message,10,250,250,250);
	} else if ( streq(Color, "yellow")==1) {
		typesay(Message,10,250,250,10);
	} else if ( streq(Color, "purple")==1) {
		typesay(Message,10,250,10,250);
	} else {
		strinit(Text);
		snprintf(Text, MAX_TEXT_LENGTH, "%s: %s", User, Data);
		typesay(Data,10,220,220,220);
	}
	for(i=1; i<=maxplayercount(); i++) {
		strinit(Name);
		if(playerinfo(i,Name,MAX_NAME_LENGTH)==1) {
			if(access(ACCESS_CHAT,Name)!=0) {
				messageex(Name, Text, print_chat);
			}
		}
	}
	log_command(User,Command,Data);
	return PLUGIN_HANDLED;
}
 
 
public plugin_init() {
	plugin_registerinfo("Base Plugin Extension","Extension to the standard tsay function.",STRING_VERSION);
 
	plugin_registercmd("admin_tsay","admin_tsay",ACCESS_SAY,"admin_tsay [color] <msg>: Prints msg on lower left of screen.");
 
	return PLUGIN_CONTINUE;
}