Server Exports
Server Exports
Section titled “Server Exports”All server exports can be called from other server-side resources using the exports function.
addMessage
Section titled “addMessage”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 playersmessage(string | table) - Message text or message table
Returns:
boolean-trueif successful,falseotherwise
Example:
exports['senor-chat']:addMessage(1, "Hello player!")exports['senor-chat']:addMessage(nil, "Hello everyone!")sendMessage
Section titled “sendMessage”Send a formatted message to a player.
local success = exports['senor-chat']:sendMessage(playerId, data)Parameters:
playerId(number) - Target player IDdata(table) - Message data table
Data Structure:
{ message = string, channel = { id = number }, tags = table, color = table}Returns:
boolean-trueif successful,falseotherwise
sendLocalMessage
Section titled “sendLocalMessage”Send a message to a specific player.
exports['senor-chat']:sendLocalMessage(playerId, data)Parameters:
playerId(number) - Target player IDdata(table) - Message data table
sendStaffMessage
Section titled “sendStaffMessage”Send a message to all staff members.
exports['senor-chat']:sendStaffMessage(data)Parameters:
data(table) - Message data table
addChannel
Section titled “addChannel”Add a new chat channel.
local success = exports['senor-chat']:addChannel(channelName, channelId, timeout)Parameters:
channelName(string) - Channel namechannelId(number) - Channel IDtimeout(number) - Message timeout in seconds
Returns:
boolean-trueif successful,falseotherwise
getChannel
Section titled “getChannel”Get channel data by name.
local channel = exports['senor-chat']:getChannel(channelName)Parameters:
channelName(string) - Channel name
Returns:
table | false- Channel data table orfalseif not found
Channel Data Structure:
{ id = number, name = string, timeout = number}getChannels
Section titled “getChannels”Get all available channels.
local channels = exports['senor-chat']:getChannels()Returns:
table- Table of all channels
getChannelById
Section titled “getChannelById”Get channel data by ID.
local channel = exports['senor-chat']:getChannelById(channelId)Parameters:
channelId(number) - Channel ID
Returns:
table | false- Channel data table orfalseif not found
hasChannelAccess
Section titled “hasChannelAccess”Check if a player has access to a channel.
local hasAccess = exports['senor-chat']:hasChannelAccess(playerId, channelName)Parameters:
playerId(number) - Player IDchannelName(string) - Channel name
Returns:
boolean-trueif player has access,falseotherwise
isUserMuted
Section titled “isUserMuted”Check if a player is muted.
local isMuted, timeRemaining = exports['senor-chat']:isUserMuted(playerId)Parameters:
playerId(number) - Player ID
Returns:
boolean-trueif muted,falseotherwisenumber | nil- Time remaining in seconds, ornilif not muted
muteUser
Section titled “muteUser”Mute a player for a specified duration.
local success = exports['senor-chat']:muteUser(playerId, durationMinutes, adminId, reason, notify, channel)Parameters:
playerId(number) - Target player IDdurationMinutes(number) - Mute duration in minutesadminId(number | nil) - Admin player ID who mutedreason(string | nil) - Mute reasonnotify(boolean | nil) - Whether to notify the playerchannel(table | nil) - Channel to mute in
Returns:
boolean-trueif successful,falseotherwise
unmuteUser
Section titled “unmuteUser”Unmute a player.
local success = exports['senor-chat']:unmuteUser(playerId, adminId)Parameters:
playerId(number) - Target player IDadminId(number | nil) - Admin player ID who unmuted
Returns:
boolean-trueif successful,falseotherwise
deleteMessage
Section titled “deleteMessage”Delete a message from chat.
local success = exports['senor-chat']:deleteMessage(messageId, messageChannel, adminId)Parameters:
messageId(number) - Message IDmessageChannel(string) - Channel nameadminId(number | nil) - Admin player ID who deleted
Returns:
boolean-trueif successful,falseotherwise
addCustomSuggestion
Section titled “addCustomSuggestion”Add a custom command suggestion for a player.
local success = exports['senor-chat']:addCustomSuggestion(playerId, name, help, params)Parameters:
playerId(number) - Player IDname(string) - Command name (with or without/)help(string | nil) - Help textparams(table | nil) - Command parameters
Returns:
boolean-trueif successful,falseotherwise
getPlayerInfo
Section titled “getPlayerInfo”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 ornilif player not found
Player Info Structure:
{ picture = string, tags = table, color = table | nil, sender = string, senderId = number, gang = string | nil, admin = boolean}getPlayerTags
Section titled “getPlayerTags”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}getPlayerColors
Section titled “getPlayerColors”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}getPlayerSelectedTag
Section titled “getPlayerSelectedTag”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 ornilif none selected
getPlayerSelectedColor
Section titled “getPlayerSelectedColor”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 ornilif none selected
setPlayerSelectedTag
Section titled “setPlayerSelectedTag”Set a player’s selected tag.
local success = exports['senor-chat']:setPlayerSelectedTag(playerId, tagId)Parameters:
playerId(number) - Player IDtagId(string | number | nil) - Tag ID to select, ornilto clear selection
Returns:
boolean-trueif successful,falseotherwise
setPlayerSelectedColor
Section titled “setPlayerSelectedColor”Set a player’s selected color.
local success = exports['senor-chat']:setPlayerSelectedColor(playerId, colorId)Parameters:
playerId(number) - Player IDcolorId(string | number | nil) - Color ID to select, ornilto clear selection
Returns:
boolean-trueif successful,falseotherwise
addPlayerTag
Section titled “addPlayerTag”Add a custom tag to a player.
local success = exports['senor-chat']:addPlayerTag(playerId, tag)Parameters:
playerId(number) - Player IDtag(table) - Tag object
Tag Structure:
{ id = string | number, -- Optional, auto-generated if not provided text = string, color = string, bgColor = string}Returns:
boolean-trueif successful,falseotherwise
removePlayerTag
Section titled “removePlayerTag”Remove a tag from a player.
local success = exports['senor-chat']:removePlayerTag(playerId, tagId)Parameters:
playerId(number) - Player IDtagId(string | number) - Tag ID to remove
Returns:
boolean-trueif successful,falseotherwise
addPlayerColor
Section titled “addPlayerColor”Add a custom color to a player.
local success = exports['senor-chat']:addPlayerColor(playerId, color)Parameters:
playerId(number) - Player IDcolor(table) - Color object
Color Structure:
{ id = string | number, -- Optional, auto-generated if not provided name = string, color = string, bgColor = string}Returns:
boolean-trueif successful,falseotherwise
removePlayerColor
Section titled “removePlayerColor”Remove a color from a player.
local success = exports['senor-chat']:removePlayerColor(playerId, colorId)Parameters:
playerId(number) - Player IDcolorId(string | number) - Color ID to remove
Returns:
boolean-trueif successful,falseotherwise