
/* AMX Mod script.
*
* (c) Copyright 2002, OLO
* This file is provided as is (no warranties).
*
*/

#include <amxmod>

new Float:last_chat
new gmsgSayText

public pc_say(id){
	new Float:gametime = get_gametime()
	if (gametime > last_chat) {
		last_chat = gametime + 0.01
		return PLUGIN_CONTINUE
	}
	new name[32]
	get_user_name(id,name,32)
	new said[128]
	/* if you want to say something from console use: say "hello world" instead of say hello world */
	read_argv(1,said,128)
	new message[128]
	format(message,128,"%c%s :    %s^n",2,name,said)
	new origin[3]
	message_begin( MSG_ALL ,gmsgSayText,origin,id)
	write_byte( id )
	write_string( message )
	message_end()
	return PLUGIN_HANDLED
}

public pc_say_team(id){
	new Float:gametime = get_gametime()
	if (gametime > last_chat) {
		last_chat = gametime + 0.01
		return PLUGIN_CONTINUE
	}
	new team[32]
	get_user_team(id,team,32)
	new gplayers[32]
	new inum
	get_players(gplayers,inum,"e",team)
	new said[128]
	read_argv(1,said,128)
	new name[32]
	get_user_name(id,name,32)
	new message[128]
	format(message,128,"%c(%s) %s :    %s^n",2,team,name,said)
	new origin[3]
	for(new a = 0; a < inum; a++)	{
		message_begin( MSG_ONE ,gmsgSayText,origin,gplayers[a])
		write_byte( id )
		write_string( message )
		message_end()
	}
	return PLUGIN_HANDLED
}

public plugin_init(){
	register_plugin("Paused Chat","0.4","default")
	gmsgSayText = get_user_msgid("SayText")
	register_clcmd("say","pc_say")
	register_clcmd("say_team","pc_say_team")
	last_chat = 0.0
	return PLUGIN_CONTINUE
}

