Skip to main content

Chat Component

Component Available
ServerYes
ClientNo

Chat component is added ontop of a modified FiveM chat resource, this has been modified to use our permissions system.

Required Attributes


Server

  • Send: table

Client

  • None

Methods


Server

RegisterCommand

  • Parameters: command: string, callback: function, suggestion: table, arguments: int, job: table
  • Return: None
  • Description: Registers a standard command for all players to use, so long as they meet any job requirements.

RegisterAdminCommand

  • Parameters: command: string, callback: function, suggestion: table, arguments: number
  • Return: None
  • Description: Registers a command only admins can use. Admin access is controlled through the Player entity

ClearAll

  • Parameters: None
  • Return: None
  • Description: Clears chat on all clients.

Send (Prefix: Send)

OOC

  • Parameters: source: int, message: string
  • Return: None
  • Description: Sends chat message to OOC channel to all clients.

Server (Prefix: Send.Server)

All

  • Parameters: message: string
  • Return: None
  • Description: Sends chat message to Server channel to all clients.

Single

  • Parameters: source: int, message: string
  • Return: None
  • Description: Sends chat message to Server channel to specified client.

System (Prefix: Send.System)

All

  • Parameters: message: string
  • Return: None
  • Description: Sends chat message to System channel to all clients.

Single

  • Parameters: source: int, message: string
  • Return: None
  • Description: Sends chat message to System channel to specified client.

Help

  • Parameters: source: int, message: string
  • Return: None
  • Description: Sends chat message to System Help channel to specified client.

Client

This component has no client methods.

Events


As stated, this is a modified default FiveM chat resource so it also includes all of the standard chat events. These will not be documented here, if you want to see docs about this you can find them here.

Server

Client

Suggestion Table


This is the expected table layout that should be passed when registering a command.

{
help = 'Quick help line for what the command does',
params = {{
name = 'Argument Name',
help = 'Description of what the argument is'
}
}

For as many parameters your call defines, you should add an object to the params list describing the required arguments.

Job Table


NOT YET IMPLEMENTED

Example Command Register


Chat:RegisterCommand('clear', function(source, args, rawCommand)
TriggerClientEvent('chat:clearChat', source)
end, {
help = 'Clear The Chat'
})