Scripting/Server/Events/onPlayerChat

A player sent a normal chat line (not starting with /).

Syntax

onPlayerChat(player, message)

Arguments

Returns

false/0 blocks the message from being shown to others. Anything else allows it.

Example

function onPlayerChat( player, message )
{
	// block shouting
	if ( message == message.toupper() && message.len() > 6 )
	{
		MessagePlayer( "Please do not shout.", player, Colour( 255, 80, 80 ) );
		return false;               // swallow the message
	}
	return true;
}

Section: Chat and commands

Categories: Server events | Chat and commands