Skip to content

Server Exports

All server exports can be called from other server-side resources using the exports function.

Send a message to a player or all players.

local success = exports['senor-chat']:addMessage(target, message)

Parameters:

  • target (number | nil) - Player ID, or nil/omit for all players
  • message (string | table) - Message text or message table

Returns:

  • boolean - true if successful, false otherwise

Example:

exports['senor-chat']:addMessage(1, "Hello player!")
exports['senor-chat']:addMessage(nil, "Hello everyone!")

Send a formatted message to a player.

local success = exports['senor-chat']:sendMessage(playerId, data)

Parameters:

  • playerId (number) - Target player ID
  • data (table) - Message data table

Data Structure:

{
message = string,
channel = { id = number },
tags = table,
color = table
}

Returns:

  • boolean - true if successful, false otherwise

Send a message to a specific player.

exports['senor-chat']:sendLocalMessage(playerId, data)

Parameters:

  • playerId (number) - Target player ID
  • data (table) - Message data table

Send a message to all staff members.

exports['senor-chat']:sendStaffMessage(data)

Parameters:

  • data (table) - Message data table

Add a new chat channel.

local success = exports['senor-chat']:addChannel(channelName, channelId, timeout)

Parameters:

  • channelName (string) - Channel name
  • channelId (number) - Channel ID
  • timeout (number) - Message timeout in seconds

Returns:

  • boolean - true if successful, false otherwise

Get channel data by name.

local channel = exports['senor-chat']:getChannel(channelName)

Parameters:

  • channelName (string) - Channel name

Returns:

  • table | false - Channel data table or false if not found

Channel Data Structure:

{
id = number,
name = string,
timeout = number
}

Get all available channels.

local channels = exports['senor-chat']:getChannels()

Returns:

  • table - Table of all channels

Get channel data by ID.

local channel = exports['senor-chat']:getChannelById(channelId)

Parameters:

  • channelId (number) - Channel ID

Returns:

  • table | false - Channel data table or false if not found

Check if a player has access to a channel.

local hasAccess = exports['senor-chat']:hasChannelAccess(playerId, channelName)

Parameters:

  • playerId (number) - Player ID
  • channelName (string) - Channel name

Returns:

  • boolean - true if player has access, false otherwise

Check if a player is muted.

local isMuted, timeRemaining = exports['senor-chat']:isUserMuted(playerId)

Parameters:

  • playerId (number) - Player ID

Returns:

  • boolean - true if muted, false otherwise
  • number | nil - Time remaining in seconds, or nil if not muted

Mute a player for a specified duration.

local success = exports['senor-chat']:muteUser(playerId, durationMinutes, adminId, reason, notify, channel)

Parameters:

  • playerId (number) - Target player ID
  • durationMinutes (number) - Mute duration in minutes
  • adminId (number | nil) - Admin player ID who muted
  • reason (string | nil) - Mute reason
  • notify (boolean | nil) - Whether to notify the player
  • channel (table | nil) - Channel to mute in

Returns:

  • boolean - true if successful, false otherwise

Unmute a player.

local success = exports['senor-chat']:unmuteUser(playerId, adminId)

Parameters:

  • playerId (number) - Target player ID
  • adminId (number | nil) - Admin player ID who unmuted

Returns:

  • boolean - true if successful, false otherwise

Delete a message from chat.

local success = exports['senor-chat']:deleteMessage(messageId, messageChannel, adminId)

Parameters:

  • messageId (number) - Message ID
  • messageChannel (string) - Channel name
  • adminId (number | nil) - Admin player ID who deleted

Returns:

  • boolean - true if successful, false otherwise

Add a custom command suggestion for a player.

local success = exports['senor-chat']:addCustomSuggestion(playerId, name, help, params)

Parameters:

  • playerId (number) - Player ID
  • name (string) - Command name (with or without /)
  • help (string | nil) - Help text
  • params (table | nil) - Command parameters

Returns:

  • boolean - true if successful, false otherwise

Get a player’s chat information and attributes.

local playerInfo = exports['senor-chat']:getPlayerInfo(playerId)

Parameters:

  • playerId (number) - Player ID

Returns:

  • table | nil - Player info table or nil if player not found

Player Info Structure:

{
picture = string,
tags = table,
color = table | nil,
sender = string,
senderId = number,
gang = string | nil,
admin = boolean
}

Get all tags available to a player.

local tags = exports['senor-chat']:getPlayerTags(playerId)

Parameters:

  • playerId (number) - Player ID

Returns:

  • table - Array of tag objects

Tag Structure:

{
id = string | number,
text = string,
color = string,
bgColor = string
}

Get all colors available to a player.

local colors = exports['senor-chat']:getPlayerColors(playerId)

Parameters:

  • playerId (number) - Player ID

Returns:

  • table - Array of color objects

Color Structure:

{
id = string | number,
name = string,
color = string,
bgColor = string
}

Get a player’s currently selected tag.

local selectedTag = exports['senor-chat']:getPlayerSelectedTag(playerId)

Parameters:

  • playerId (number) - Player ID

Returns:

  • table | nil - Selected tag object or nil if none selected

Get a player’s currently selected color.

local selectedColor = exports['senor-chat']:getPlayerSelectedColor(playerId)

Parameters:

  • playerId (number) - Player ID

Returns:

  • table | nil - Selected color object or nil if none selected

Set a player’s selected tag.

local success = exports['senor-chat']:setPlayerSelectedTag(playerId, tagId)

Parameters:

  • playerId (number) - Player ID
  • tagId (string | number | nil) - Tag ID to select, or nil to clear selection

Returns:

  • boolean - true if successful, false otherwise

Set a player’s selected color.

local success = exports['senor-chat']:setPlayerSelectedColor(playerId, colorId)

Parameters:

  • playerId (number) - Player ID
  • colorId (string | number | nil) - Color ID to select, or nil to clear selection

Returns:

  • boolean - true if successful, false otherwise

Add a custom tag to a player.

local success = exports['senor-chat']:addPlayerTag(playerId, tag)

Parameters:

  • playerId (number) - Player ID
  • tag (table) - Tag object

Tag Structure:

{
id = string | number, -- Optional, auto-generated if not provided
text = string,
color = string,
bgColor = string
}

Returns:

  • boolean - true if successful, false otherwise

Remove a tag from a player.

local success = exports['senor-chat']:removePlayerTag(playerId, tagId)

Parameters:

  • playerId (number) - Player ID
  • tagId (string | number) - Tag ID to remove

Returns:

  • boolean - true if successful, false otherwise

Add a custom color to a player.

local success = exports['senor-chat']:addPlayerColor(playerId, color)

Parameters:

  • playerId (number) - Player ID
  • color (table) - Color object

Color Structure:

{
id = string | number, -- Optional, auto-generated if not provided
name = string,
color = string,
bgColor = string
}

Returns:

  • boolean - true if successful, false otherwise

Remove a color from a player.

local success = exports['senor-chat']:removePlayerColor(playerId, colorId)

Parameters:

  • playerId (number) - Player ID
  • colorId (string | number) - Color ID to remove

Returns:

  • boolean - true if successful, false otherwise