yaca.systems for FiveM & RedM
This is a example implementation for FiveM & RedM. Feel free to report bugs via issues or contribute via pull requests.
Join our Discord to get help or make suggestions and start using yaca.systems today!
Before you start, make sure you have OneSync enabled and your server artifacts are up to date.
- Download and install the latest release of this resource.
- Add
start yaca-voice
into yourserver.cfg
. - Open
config/server.json5
and adjust the variables to your needs. - Open
config/shared.json5
and adjust the variables to your needs.
Client
Get the current voice range of the player as int
.
Get all voice ranges as int[]
.
Change the voice range of the player.
Get the microphone mute state of the player as boolean
.
Get the microphone disabled state of the player as boolean
.
Get the sound mute state of the player as boolean
.
Get the sound disabled state of the player as boolean
.
Get the current plugin state as string
.
The state can be one of the following:
"NOT_CONNECTED"
: The plugin is not connected"CONNECTED
: The plugin is connected"OUTDATED_VERSION"
: The plugin is not the version set in the dashboard"WRONG_TS_SERVER"
: The user is connected to the wrong Teamspeak server"IN_INGAME_CHANNEL"
: The user is in the ingame channel"IN_EXCLUDED_CHANNEL"
: The user is in an excluded channel
Get the global error level as number
.
Set the player to spectate.
Parameter | Type | Description |
---|---|---|
playerId | number | false |
the player to set |
Get the player the user is spectating as number
.
Enables or disables the radio system.
Parameter | Type | Description |
---|---|---|
state | boolean |
true to enable the radio, false to disable |
Returns whether the radio system is enabled as boolean
.
Changes the radio frequency of the active channel.
Parameter | Type | Description |
---|---|---|
frequency | string |
The frequency to set the active channel to |
Changes the radio frequency.
Parameter | Type | Description |
---|---|---|
channel? | number |
the channel number. Defaults to the current active channel when no channel is passed. |
frequency | string |
the frequency to set the channel to |
Returns the frequency of a radio channel as string
.
Parameter | Type | Description |
---|---|---|
channel? | number |
the channel number. Defaults to the current active channel when no channel is passed. |
Mutes the current active radio channel.
Mutes a radio channel.
Parameter | Type | Description |
---|---|---|
channel? | number |
the channel to mute. Defaults to the current active channel when no channel is passed. |
Returns whether a radio channel is muted as boolean
.
Parameter | Type | Description |
---|---|---|
channel | number |
the channel number |
Changes the active radio channel. Returns whether the operation was successful as bool
.
Parameter | Type | Description |
---|---|---|
channel | number |
the new radio channel |
Returns the active radio channel as number
.
Changes the secondary radio channel. Returns whether the operation was successful as bool
.
Parameter | Type | Description |
---|---|---|
channel | number |
the new radio channel |
Returns the secondary radio channel as number
.
Changes the volume of the active radio channel. Returns whether the operation was successful as bool
.
Parameter | Type | Description |
---|---|---|
higher | boolean |
whether to increase the volume |
Changes the volume of a radio channel. Returns whether the operation was successful as bool
.
Parameter | Type | Description |
---|---|---|
channel | number |
the channel number |
volume | number |
the volume to set |
Returns the volume of a radio channel as number
.
Parameter | Type | Description |
---|---|---|
channel | number |
the channel number |
Changes the stereo mode of the active radio channel. Returns whether the operation was successful as bool
.
Changes the stereo mode of a radio channel. Returns whether the operation was successful as bool
.
Parameter | Type | Description |
---|---|---|
channel | number |
the channel number |
stereo | string |
the stereo mode ("MONO_LEFT" , "MONO_RIGHT" or "STEREO" ) |
Returns the stereo mode of a radio channel as string
.
Parameter | Type | Description |
---|---|---|
channel | number |
the channel number |
Starts or stops talking on the radio.
Parameter | Type | Description |
---|---|---|
state | boolean |
true to start talking, false to stop |
channel | number |
the channel to talk on |
Returns whether the player is in a phone call as a boolean
.
Returns whether the player can use the megaphone as a boolean
.
Sets whether the player can use the megaphone.
Parameter | Type | Description |
---|---|---|
state | boolean |
true to allow using of megaphone, false to disallow |
Starts or stops using the megaphone.
Parameter | Type | Description |
---|---|---|
state | boolean |
true to start using, false to stop |
Server
Get the alive status of a player as bool
.
Parameter | Type | Description |
---|---|---|
source | number |
the player source |
Set the alive status of a player.
Parameter | Type | Description |
---|---|---|
source | number |
the player source |
state | boolean |
the new alive state |
Get the voice range of a player as number
.
Parameter | Type | Description |
---|---|---|
source | number |
the player source |
Set the voice range of a player.
Parameter | Type | Description |
---|---|---|
source | number |
the player source |
range | number |
The new voice range. Defaults to the default voice range if not provided. |
Returns all players in a radio frequency as int[]
.
Parameter | Type | Description |
---|---|---|
frequency | string |
the frequency to get |
Sets the radio channel of a player.
Parameter | Type | Description |
---|---|---|
source | number |
the player source |
channel | number |
the channel to set |
frequency | string |
the frequency to set |
Returns whether a player has long range enabled as bool
.
Parameter | Type | Description |
---|---|---|
source | number |
the player source |
Sets the long range state of a player.
Parameter | Type | Description |
---|---|---|
source | number |
the player source |
state | boolean |
the long range state |
Creates a phone call between two players.
Parameter | Type | Description |
---|---|---|
source | number |
the player source |
target | number |
the target player source |
state | boolean |
the state of the call |
Creates a phone call between two players with the old effect.
Parameter | Type | Description |
---|---|---|
source | number |
the player source |
target | number |
the target player source |
state | boolean |
the state of the call |
Mutes the player when using the phone.
Parameter | Type | Description |
---|---|---|
source | number |
the player source |
state | boolean |
the mute state |
Enable or disable the phone speaker for a player.
Parameter | Type | Description |
---|---|---|
source | number |
the player source |
state | boolean |
the phone speaker state |
Returns whether a player is in a phone call as [bool, number[]]
.
Parameter | Type | Description |
---|---|---|
source | number |
the player source |
Sets the global error level.
Parameter | Type | Description |
---|---|---|
level | number |
the error level |
Returns the global error level as number
.
Client
The event is triggered when the plugin is initialized.
Parameter | Type | Description |
---|---|---|
clientId | int |
the client id of the local user in teamspeak |
The event is triggered when the plugin state changes.
Parameter | Type | Description |
---|---|---|
state | string |
the current plugin state, as explained below |
The state can be one of the following:
"NOT_CONNECTED"
: The plugin is not connected"CONNECTED
: The plugin is connected"OUTDATED_VERSION"
: The plugin is not the version set in the dashboard"WRONG_TS_SERVER"
: The user is connected to the wrong Teamspeak server"IN_INGAME_CHANNEL"
: The user is in the ingame channel"IN_EXCLUDED_CHANNEL"
: The user is in an excluded channel
This event is triggered when the voice range of a player is updated.
Parameter | Type | Description |
---|---|---|
range | int |
the newly set voice range |
rangeIndex | int |
the index of the range |
DEPRECATED: Use yaca:external:microphoneMuteStateChanged
instead.
The event is triggered when the mute state of a player changes.
Parameter | Type | Description |
---|---|---|
state | boolean |
the new mute state |
The event is triggered when the microphone mute state of a player changes.
Parameter | Type | Description |
---|---|---|
state | boolean |
the new mute state |
The event is triggered when the microphone disabled state of a player changes.
Parameter | Type | Description |
---|---|---|
state | boolean |
the new mute state |
The event is triggered when the sound mute state of a player changes.
Parameter | Type | Description |
---|---|---|
state | boolean |
the new mute state |
The event is triggered when the sound disabled state of a player changes.
Parameter | Type | Description |
---|---|---|
state | boolean |
the new mute state |
The event is triggered when a player starts or stops talking.
Parameter | Type | Description |
---|---|---|
state | boolean |
the new talking state |
The event is triggered when the megaphone state of a player changes.
Parameter | Type | Description |
---|---|---|
state | boolean |
the new megaphone state |
The event is triggered when the radio mute state of a player changes.
Parameter | Type | Description |
---|---|---|
channel | number |
the channel where the mute state is changed |
state | boolean |
the new mute state |
The event is triggered when the radio state of a player changes.
Parameter | Type | Description |
---|---|---|
state | boolean |
true when the radio is enabled, false when the radio is disabled |
The event is triggered when the active radio channel of a player changes.
Parameter | Type | Description |
---|---|---|
channel | number |
the new active radio channel |
The event is triggered when the secondary radio channel of a player changes.
Parameter | Type | Description |
---|---|---|
channel | number |
the new active radio channel, or -1 if disabled |
The event is triggered when the radio volume of a player changes.
Parameter | Type | Description |
---|---|---|
channel | number |
the channel to change |
volume | number |
the new volume to set |
The event is triggered when the stereo mode of a radio channel changes.
Parameter | Type | Description |
---|---|---|
channel | number |
the channel to change |
stereo | string |
"MONO_LEFT" for the left ear, "MONO_RIGHT" for the right ear and "STEREO" for both ears |
The event is triggered when the radio frequency of a player changes.
Parameter | Type | Description |
---|---|---|
channel | number |
the channel to set |
frequency | string |
the frequency to set |
The event is triggered when a player starts or stops talking on the radio.
Parameter | Type | Description |
---|---|---|
state | boolean |
the new talking state |
channel | number |
the channel where the player is talking at |
The event is triggered when a player starts or stops receiving on the radio.
Parameter | Type | Description |
---|---|---|
state | boolean |
the new receiver state |
channel | number |
the channel from which the player is receiving |
The event is triggered when a notification should be shown.
Parameter | Type | Description |
---|---|---|
message | string |
the message to show |
type | string |
the type of the message ("inform" , "error" , "success" ) |
Example for custom notification:
AddEventHandler('yaca:external:notification', function (message, type)
-- Call your Notifications System here.
end)
The event is triggered when the player changes the channel to the ingame or excluded channel.
Parameter | Type | Description |
---|---|---|
channelType | string |
INGAME_CHANNEL when moving into the ingame channel and EXCLUDED_CHANNEL when moving into a excluded channel. |
Server
The event is triggered when the megaphone state of a player changes.
Parametr | Type | Description |
---|---|---|
source | int |
the player source |
state | boolean |
the new megaphone state |
The event is triggered when a phone call is started or ended.
Parameter | Type | Description |
---|---|---|
source | int |
the player source |
target | int |
the target player source |
state | boolean |
the new phone call state |
filter | YacaFilterEnum |
the used filter for the phone call, can be either PHONE or PHONE_HISTORICAL |
The event is triggered when the phone speaker state of a player changes.
Parameter | Type | Description |
---|---|---|
source | int |
the player source |
state | boolean |
the new phone speaker state |
The event is triggered when the radio frequency of a player changes.
Parameter | Type | Description |
---|---|---|
source | int |
the player source |
channel | int |
the channel where the frequency was set |
frequency | string |
the frequency to set |
The event is triggered when the radio mute state of a player changes.
Parameter | Type | Description |
---|---|---|
source | int |
the player source |
channel | int |
the channel where the mute state was changed |
state | boolean |
the new mute state |
If you want to contribute to this project, feel free to do so. We are happy about every contribution. If you have any questions, feel free to ask in our Discord.
To build the resource, you need to have Node.js installed. After that, you can run the following commands to build the resource:
pnpm install
pnpm run build
The built resource will be located in the resource
folder, which you can then use in your FiveM server.