Library chat

Chat functions

Functions

botSay( prefix, ... ) Displays a message in the chat with a prefix to all faction members.
botSayAlliance( prefix, ... ) Displays a message in the chat with a prefix to all alliance members.
canSay() Returns whether a chat message through chat.say, chat.botSay etc.
canTell( target ) Returns whether the given player can be sent a direct message.
interval() Returns the enforced delay (in seconds) between chat messages through chat.say, chat.botSay etc.
listen( callback, ply ) Registers a new listener function to chat.
nextSay() Returns the time left (in seconds) until the next chat message through chat.say, chat.botSay etc.
nextTell( target ) Returns the time until the next tell is allowed (in seconds).
say( ... ) Displays a message to all players in your faction.
sayAlliance( ... ) Displays a message to all players in your alliance.
stop( callback, ply ) Removes a listener.
tell( target, ... ) Displays a message to a specific player.


Functions

chat.botSay( prefix, ... )
Displays a message in the chat with a prefix to all faction members.

Environment:

Server

Parameters:

  • prefix: The prefix text to display in [] brackets.
  • ...: Colour, string, colour...
chat.botSayAlliance( prefix, ... )
Displays a message in the chat with a prefix to all alliance members.

Environment:

Server

Parameters:

  • prefix: The prefix text to display in [] brackets.
  • ...: Colour, string, colour...
chat.canSay()
Returns whether a chat message through chat.say, chat.botSay etc. can be sent.

Environment:

Server
chat.canTell( target )
Returns whether the given player can be sent a direct message.

Environment:

Server

Parameters:

  • target: The player to check.
chat.interval()
Returns the enforced delay (in seconds) between chat messages through chat.say, chat.botSay etc.

Environment:

Server
chat.listen( callback, ply )
Registers a new listener function to chat. Return true in your callback to hide your own chat.

Environment:

Server

Parameters:

  • callback: The function that will listen to chat, receives chat message, player and channel name (e.g. "global", "local").
  • ply: (Optional) The specific player you want to listen for. Pass nil to listen to all chat.
chat.nextSay()
Returns the time left (in seconds) until the next chat message through chat.say, chat.botSay etc. can be sent.

Environment:

Server
chat.nextTell( target )
Returns the time until the next tell is allowed (in seconds). Pass a player to get their specific cooldown.

Environment:

Server

Parameters:

  • target: (Optional) Target player to get the cooldown for.
chat.say( ... )
Displays a message to all players in your faction. Takes colour, string, colour, string...

Environment:

Server

Parameters:

  • ...: Colour, string, colour...
chat.sayAlliance( ... )
Displays a message to all players in your alliance. Takes colour, string, colour, string...

Environment:

Server

Parameters:

  • ...: Colour, string, colour...
chat.stop( callback, ply )
Removes a listener.

Environment:

Server

Parameters:

  • callback: The function getting removed, should be the same one added by chat.listen().
  • ply: (Optional) The player that you are no longer listening to. Pass nil if you did so in chat.listen().
chat.tell( target, ... )
Displays a message to a specific player. Same arguments as chat.say after the player argument.

Environment:

Server

Parameters:

  • target: The player to send the message to.
  • ...: Colour, string, colour...

Valid XHTML 1.0!