Module cityrp.chatBox

Clientside code relating to the chatbox.

Module Overview

Client Globals

chat.AddText(...) Function to add text to a player's console and chatbox.
table.copy(orig) Create a deep copy of an object.

Client Fields

cityrp.chatBox.joinSpam List of messages spamming join.
cityrp.chatBox.leaveSpam List of messages spamming leave.
cityrp.chatBox.messages Recent message.
cityrp.chatBox.derma Client derma store.
cityrp.chatBox.history Table to store the chat history.
cityrp.chatBox.history.messages Recently recieved messages in the history.
cityrp.chatBox.history.position Current cursor position within history.
cityrp.chatBox.sendhistory Table to store the sent chat history.
cityrp.chatBox.sendhistory.messages Table to store the chat message sent.
cityrp.chatBox.sendhistory.position Store the history cursor pos.
cityrp.chatBox.sendhistory.useposition Store for the current used position.

Client Functions

cityrp.chatBox.getPosition() Gets the chatbox position.
cityrp.chatBox.getX() Gets the chatbox's x position.
cityrp.chatBox.getY() Gets the chatbox's y position.
cityrp.chatBox.getSpacing() Gets the chatbox's spacing between messages.
cityrp.chatBox.wrapText(text, font, width, overhead, base) Provides a table of wrapped strings.
cityrp.chatBox.createDermaAll() Create the chatbox panels.

Client Functions

cityrp.chatBox.getPosition() Gets the chatbox position.
cityrp.chatBox.getX() Gets the chatbox's x position.
cityrp.chatBox.getY() Gets the chatbox's y position.
cityrp.chatBox.getSpacing() Gets the chatbox's spacing between messages.
cityrp.chatBox.wrapText(text, font, width, overhead, base) Provides a table of wrapped strings.
cityrp.chatBox.createDermaAll() Create the chatbox panels.

Client Internals

cityrp.chatBox.createDermaButtons() Creates the chatbox control buttons.
cityrp.chatBox.createDermaButton(name, text, x, width, toolTip, doClick, think) Create a derma button parented to the chatbox.
cityrp.chatBox.createDermaCheckBoxes() Create derma check boxes.
cityrp.chatBox.createDermaCheckBox(name, conVar, x, toolTip, label, parent, y) Create a derma check box parented to the chat panel.
cityrp.chatBox.createDermaTextEntry() Create the derma text entry.
cityrp.chatBox.createDermaFilters() Create a derma filter checkboxes.
cityrp.chatBox.createDermaPanel() Create the main derma panel.
cityrp.chatBox.playerBindPress(player, bind, press) Update the chatbox when the player presses a bind.
cityrp.chatBox.messageAdd([title][, name], text[, filtered[, icon[, consoleSuffix]]]) Create and send a new message to the chatbox.
cityrp.chatBox.printConsole(message) Output a message to console.
cityrp.chatBox.extractClasses(message) Wrap text from string to blocks.
cityrp.chatBox.think() Think hook function for the chatbox.
cityrp.chatBox.hudPaint() Called on HUDPaint.
cityrp.chatBox.explodeByTags(variable, seperator, open, close) Explode a string by seperator or by tag.
cityrp.chatBox.chatText(index, name, text, class[, customColor]) Process a message and add it to the chatbox.

Shared Fields

cityrp.chatBox.actionTypes The list of actions to have "overhead text" for.

Server Functions

cityrp.chatBox.add(recipientFilter[, ply], filter, text[, color]) Add a new line.
cityrp.chatBox.addInRadius(ply, filter, text, position, radius) Add a new line to players within the radius of a position.

Client Globals

chat.AddText(...)
Function to add text to a player's console and chatbox. Currently semi-broken, requires a manual catch to be added to the chatbox.

Parameters:

  • ... Vararg. Converts players to their name, takes strings as-is and discards other values.
table.copy(orig)
Create a deep copy of an object.

Parameters:

  • orig The object to copy.

Client Fields

cityrp.chatBox.joinSpam
List of messages spamming join.
cityrp.chatBox.leaveSpam
List of messages spamming leave.
cityrp.chatBox.messages
Recent message.
cityrp.chatBox.derma
Client derma store.
cityrp.chatBox.history
Table to store the chat history.
cityrp.chatBox.history.messages
Recently recieved messages in the history.
cityrp.chatBox.history.position
Current cursor position within history.
cityrp.chatBox.sendhistory
Table to store the sent chat history.
cityrp.chatBox.sendhistory.messages
Table to store the chat message sent.
cityrp.chatBox.sendhistory.position
Store the history cursor pos.
cityrp.chatBox.sendhistory.useposition
Store for the current used position.

Client Functions

cityrp.chatBox.getPosition()
Gets the chatbox position.

Returns:

  1. int The current X position.
  2. int The current Y position.
cityrp.chatBox.getX()
Gets the chatbox's x position.

Returns:

    int The current X position.
cityrp.chatBox.getY()
Gets the chatbox's y position.

Returns:

    int The current Y position.
cityrp.chatBox.getSpacing()
Gets the chatbox's spacing between messages.

Returns:

    int Spacing distance.
cityrp.chatBox.wrapText(text, font, width, overhead, base)
Provides a table of wrapped strings.

Parameters:

  • text string The string to wrap.
  • font string The font to check widths again.
  • width number Maximum line width to explode at.
  • overhead number The buffer between text width and maximum width for the first line.
  • base table Table to insert the lines in.
cityrp.chatBox.createDermaAll()
Create the chatbox panels.

Client Functions

cityrp.chatBox.getPosition()
Gets the chatbox position.

Returns:

  1. int The current X position.
  2. int The current Y position.
cityrp.chatBox.getX()
Gets the chatbox's x position.

Returns:

    int The current X position.
cityrp.chatBox.getY()
Gets the chatbox's y position.

Returns:

    int The current Y position.
cityrp.chatBox.getSpacing()
Gets the chatbox's spacing between messages.

Returns:

    int Spacing distance.
cityrp.chatBox.wrapText(text, font, width, overhead, base)
Provides a table of wrapped strings.

Parameters:

  • text string The string to wrap.
  • font string The font to check widths again.
  • width number Maximum line width to explode at.
  • overhead number The buffer between text width and maximum width for the first line.
  • base table Table to insert the lines in.
cityrp.chatBox.createDermaAll()
Create the chatbox panels.

Client Internals

cityrp.chatBox.createDermaButtons()
Creates the chatbox control buttons.
cityrp.chatBox.createDermaButton(name, text, x, width, toolTip, doClick, think)
Create a derma button parented to the chatbox.

Parameters:

  • name string The internal name of the button.
  • text string The label of the button.
  • x number The x position of the button.
  • width number The width of the button.
  • toolTip string The hover text for the button.
  • doClick function The function to be called when clicked.
  • think function Think function.
cityrp.chatBox.createDermaCheckBoxes()
Create derma check boxes.
cityrp.chatBox.createDermaCheckBox(name, conVar, x, toolTip, label, parent, y)
Create a derma check box parented to the chat panel.

Parameters:

  • name string The internal name of the button.
  • conVar string The attached ConVar to change.
  • x number The x position of the button.
  • toolTip string The hover text for the button.
  • label string The label for the checkbox.
  • parent Panel Optional parent for the checkbox.
  • y number The y position to put the checkbox.
cityrp.chatBox.createDermaTextEntry()
Create the derma text entry.
cityrp.chatBox.createDermaFilters()
Create a derma filter checkboxes.
cityrp.chatBox.createDermaPanel()
Create the main derma panel.
cityrp.chatBox.playerBindPress(player, bind, press)
Update the chatbox when the player presses a bind.

Parameters:

  • player Player The player who pressed the bind.
  • bind string The bind which was pressed.
  • press bool If the bind is being pressed or released.

Returns:

    boolean If the default action should be supressed.
cityrp.chatBox.messageAdd([title][, name], text[, filtered[, icon[, consoleSuffix]]])
Create and send a new message to the chatbox.

Parameters:

  • title {string,Color} Optional the title table for the message. (optional)
  • name {string,Color} Optional the name table for the message. (optional)
  • text {string,Color} The text table for the message.
  • filtered boolean Optional if the message was filtered, and thus won't display in the chatbox. (optional)
  • icon string Optional the icon for the message. (optional)
  • consoleSuffix string The prefix to be put in console. (optional)
cityrp.chatBox.printConsole(message)
Output a message to console.

Parameters:

  • message table Message table from messageAdd.
cityrp.chatBox.extractClasses(message)
Wrap text from string to blocks.

Parameters:

  • message table Message table from messageAdd.
cityrp.chatBox.think()
Think hook function for the chatbox.
cityrp.chatBox.hudPaint()
Called on HUDPaint.
cityrp.chatBox.explodeByTags(variable, seperator, open, close)
Explode a string by seperator or by tag.

Parameters:

  • variable string The input string to explode.
  • seperator string The seperator to explode by.
  • open string The opening tag.
  • close string The closing tag.
cityrp.chatBox.chatText(index, name, text, class[, customColor])
Process a message and add it to the chatbox. Called when a player says something or a message is received from the server.

Parameters:

  • index number, Player or table The player ID, entity or enttable which sent the message.
  • name string The 'name' param to use.
  • text string The message to send.
  • class string The message type.
  • customColor Color Optional custom color for the message. (optional)

Shared Fields

cityrp.chatBox.actionTypes
The list of actions to have "overhead text" for.

Server Functions

cityrp.chatBox.add(recipientFilter[, ply], filter, text[, color])
Add a new line.

Parameters:

  • recipientFilter RecipientFilter, Player or table(Player) Players to send to.
  • ply Player Player who is making the message. (optional)
  • filter string The type of message being sent.
  • text string The message body.
  • color Color Optional custom color for the message. (optional)
cityrp.chatBox.addInRadius(ply, filter, text, position, radius)
Add a new line to players within the radius of a position.

Parameters:

  • ply Player Player who is making the message.
  • filter string The type of message being sent.
  • text string The message body.
  • position Vector The position to send from.
  • radius number The radius to send the message in.