Usage

Syntax: function onPlayerChats() { }

Explanation

The onPlayerChats event behaves two different ways, depending on if it clientside or serverside. When it is clientside, onPlayerChats is called when the player says something. If it is serverside, it is called when any player says something. In other words, only use onPlayerChats serverside if you want it to be called for all players, whenever anybody says something.

Most of the time, conditional statements are used to limit this function.

Example

//#CLIENTSIDE
function onPlayerChats()
{
  this.chat = "Wow";
}

... sets the chat of the NPC to "Wow" when a player says something. Note that because this script is clientside, the chat of the NPC will only be visible to the person who said something.

On the other hand...
function onPlayerChats()
{
  this.chat = "Wow";
}

... sets the chat of the NPC to "Wow" for everybody when anybody says something.

function onPlayerChats()
{
  if (player.chat == "Foo")
  {
	this.chat = "Bar";
  }
}

... sets the chat of the NPC to "Bar" only when a person says "Foo".

Categories

CategoryFunctionEvent
Comments [Hide comments/form]
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki