All resources

rsg-voice – Docs (v3.2.0)#

Contents#

  1. Files
  2. How it works
  3. Configuration
  4. Exports, events and commands
  5. Database
  6. Security
  7. Server owner how-tos
  8. Troubleshooting

1. Files#

FilePurpose
fxmanifest.luaManifest; depends on rsg-core, oxmysql
shared/config.luaRanges, HUD, mute, muffle, talk icon, party, radio
client/client.luaRanges, HUD, muffle, talk icon, party, radio, exports
server/server.luaAdmin mutes, radio channels, party management, exports
server/versionchecker.luaGitHub version check
html/index.htmlHUD
install.sqlManual database install
locales/*.jsonen, de, el, es, fr, ja, nl, pl, pt-br, ro, ru

2. How it works#

Proximity voice on RedM's native Mumble voice.

  • Ranges: Whisper 2.5 m, Normal 8 m (default), Shout 20 m, Trail 35 m. Cycle with ] or /voice; the last range is remembered. A ground ring shows the range briefly.

  • You always hear shouting out to the largest range, whatever your own range is.

  • HUD: compact indicator (range, talking light, muted). Move it with /voicehud; hide/show with /togglevoicehud. Position is saved per client.

  • Muffled voices: players in a different interior sound quieter.

  • Speaker icon above nearby players while they talk (amber for party talk).

  • Auto-mute while dead or in last stand, and optionally while cuffed (rsg-core metadata).

  • Admin mute: server-enforced, saved in the database by licence, timed or permanent, with a reason.

  • Riding parties: /party opens a menu to invite nearby riders (up to 8). Hold [ to talk to party members within 100 m. Party members show on the map, and /partywaypoint shares a waypoint.

  • Radio channels: voice only. Another resource (rsg-radio) calls the server export JoinRadio(src, freq); the server keeps the channel list and sends the member list to each member. While the player holds the radio key (Config.Radio.Key, default O, registered with RegisterKeyMapping so it can be rebound in the game's key settings; set UseKeyMapping = false to use the TalkKey control hash instead), their voice goes to a Mumble voice target (id 3) holding every channel member (any distance) plus, with NearbyHear, everyone inside their own voice range. Members hear the transmitter at full volume: the server relays "started/stopped transmitting" to the channel, so this works even when the transmitter is not streamed in. Party talk (target 2) and radio never run at the same time; the radio wins. Static: the HUD page synthesises the radio sound with WebAudio (filtered noise): a squelch burst when a transmission starts and ends, and a low hiss while someone on your channel (and optionally you) transmits. The game's voice itself is not filtered; Lua cannot change how Mumble audio sounds.

3. Configuration#

shared/config.lua:

OptionDefaultMeaning
Rangeslist{ name, range, default? }
CycleKey / CycleCommand] / 'voice'Change range
SaveRangetrueRemember last range (client KVP)
ShowRangeRing, RingDuration, RingColourGround ring
ShowHud, HudEditCommand, HudToggleCommandtrue, voicehud, togglevoicehudHUD
MuteWhenDead / MuteWhenCuffedtrue / falseAuto-mute
AdminMuteCommand / AdminUnmuteCommandvoicemute / voiceunmuteAdmin commands
AdminPermission'admin'Permission needed
MuteExpiryCheck30Seconds between expiry checks
MuffletableEnabled, Volume (0.35), Interval
TalkIcontableEnabled, Distance, ShowSelf, texture, size, colours
RadiotableEnabled, UseKeyMapping (true), Key ('O'), TalkKey (0xF1301666, fallback), NearbyHear (true), MaxMembers (64), Debug (false), Static (Enabled, Volume 0.3, Hiss, Squelch, SelfHiss)
Radio.MaxTransmitSeconds / Radio.TransmitCooldown0 / 3Longest single transmission (0 = unlimited) and the wait after hitting it
PrioritytableRadioVsParty ('first', 'radio', 'party') and Call (Enabled, BlockRadioTransmit, BlockPartyTransmit, MuteIncomingRadio, MutePartyVoice), see Priority
PartytableEnabled, Command, TalkKey, TalkRange (100), InviteRange (10), MaxMembers (8), InviteTimeout (30), Blips, Waypoint

4. Exports, events and commands#

Client exports#

ExportReturns
GetVoiceRange()Current range in metres
SetVoiceRangeIndex(i)Set the range by index
IsMuted()bool
IsPlayerTalking(serverId)bool
SetMuteOverride(state, reason)Force mute from a script
GetPartyMembers() / IsInParty()Party info
GetRadio(){ freq, members = { serverId, ... } } or nil
IsRadioTalking()bool, true while the transmit key is held
GetRadioTalkKey()Control hash of the transmit key (keep it enabled in your own NUI)
SetRadioVolume(v) / GetRadioVolume()Radio volume for this player, 0.0-1.0 (rsg-radio sets it from the saved settings)
SetRadioMuted(state) / IsRadioMuted()Mute incoming radio (transmitting still works)
SetRadioSignal(q) / GetRadioSignal()Radio signal 0.0-1.0: scales incoming radio, 0.0 also blocks transmitting
SetCallActive(state) / IsCallActive()A phone call is running (rsg-telephone). Applies Config.Priority.Call

Priority#

  • Call: while SetCallActive(true), radio and party transmit are blocked, incoming radio and party voice are muted (each switch in Config.Priority.Call). Letting go of radio or party no longer resets the voice target while a call is active.
  • Radio vs party: Config.Priority.RadioVsParty. 'first' is the old behaviour (the key pressed first keeps the line), 'radio' and 'party' let that channel take over when both keys are held.
  • Transmit limit: Config.Radio.MaxTransmitSeconds ends a transmission after that many seconds; the key must be released and TransmitCooldown seconds must pass.

Server exports#

ExportNotes
SetPlayerMuted(src, state, reason)e.g. exports['rsg-voice']:SetPlayerMuted(src, true, 'prison')
IsPlayerMuted(src)bool
GetPartyMembers(src){ src, ... }, leaderSrc or nil
IsInParty(src)bool
JoinRadio(src, freq)ok, reason. freq is any string up to 32 chars. Leaves the current channel first. reason: disabled, invalid, full
LeaveRadio(src)bool, true if the player was on a channel
GetPlayerRadio(src)Frequency string or nil
GetRadioMembers(freq){ src, ... } or nil

Events and callbacks#

NameSideNotes
rsg-voice:server:isMutedcallbackMute state for the caller
rsg-voice:server:getPartycallbackCurrent party
rsg-voice:server:partyInvite / partyRespond / partyKick / partyLeave / partyWaypointserver eventsParty actions
rsg-voice:client:muteStateclient event(state)
rsg-voice:server:radioTalkserver event(state) from the transmitting client; relayed to the channel (rate-limited, ignored when muted or off-channel)
rsg-voice:client:radioUpdateclient event({ freq, members }) or nil, sent by the server only
rsg-voice:client:radioTalkclient event(serverId, state), sent by the server only
rsg-voice:client:onRadioTalklocal client event(state): you started/stopped transmitting. Use it for animations or sounds
rsg-voice:server:radioChangedlocal server event(src, newFreq, oldFreq): a player joined, switched or left a channel
rsg-voice:client:partyUpdate / partyInvite / partyPositions / partyWaypointclient eventsParty UI and blips

Commands#

CommandWhoWhat
/voiceeveryoneCycle range
/voicehud, /togglevoicehudeveryoneMove / hide the HUD
/party, /partywaypointeveryoneParty menu, share waypoint
/voicemute [id] [minutes] [reason]adminMute (0 or blank = permanent)
/voiceunmute [id]adminUnmute

5. Database#

CREATE TABLE IF NOT EXISTS `rsg_voice_mutes` (
    `license`    VARCHAR(64)  NOT NULL,
    `reason`     VARCHAR(255) DEFAULT NULL,
    `muted_by`   VARCHAR(100) DEFAULT NULL,
    `expires_at` INT UNSIGNED DEFAULT NULL, -- unix time, NULL = permanent
    `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (`license`)
);

Mutes are tied to the player's licence, so they survive reconnects.

6. Security#

Admin mutes are enforced on the server, so the client can't undo them. Party invites check range, member cap and timeout on the server. Admin commands are permission-checked. Radio membership can only be changed by server scripts (there is no client event to join a channel), so a client can't put itself on a frequency. Muted players can't start a transmission on the server relay. The Mumble voice target itself is built on the client (as with party talk), so a modified client could aim its voice at other players; keep that in mind for anything sensitive.

7. How-tos#

  • Mute a player from a script: exports['rsg-voice']:SetPlayerMuted(src, true, 'jail').
  • Change ranges by editing Config.Ranges.
  • Put a player on a radio channel from a script: exports['rsg-voice']:JoinRadio(src, '101'). For items, UI and job-locked frequencies use rsg-radio.
  • Language: setr rsg:locale "de" in server.cfg.

8. Troubleshooting#

ProblemFix
Nobody hears anyoneEnable native Mumble voice in the server config
Can't talk after unmuteCheck MuteWhenDead/MuteWhenCuffed and SetMuteOverride calls
HUD missingShowHud, or the player toggled it off
Party invite failsTarget must be within InviteRange
Can't hear the radioThe player must be on a channel (GetPlayerRadio), not muted, and the transmitter must hold Config.Radio.TalkKey
No radio staticConfig.Radio.Static.Enabled, Volume, and that the HUD page is loaded (the page must be running; it is the same page as the voice HUD)
Radio drops after restarting rsg-voiceChannels live in memory; the joining resource must call JoinRadio again (rsg-radio does this)

Support the Project : https://rexshack.tebex.store/

<!-- BEGIN AUTO-REFERENCE (generated from the code; re-run the generator instead of editing by hand) -->

Technical reference#

Generated from the source of rsg-voice 3.0.4 (radio rows added by hand for 3.1.0). Names, arguments and defaults below are read straight from the code.

Dependencies#

rsg-core, oxmysql

Database#

Tables: rsg_voice_mutes.

Tables are created automatically on start while Config.AutoDatabase = true (default). Nothing is ever dropped or overwritten. For a manual install set Config.AutoDatabase = false and import install.sql once.

-- shared/config.lua
Config.AutoDatabase = true -- false = import the SQL file yourself

Configuration#

OptionDefaultNotes
Config.AutoDatabasetruebuild the database tables automatically on start (set false and import the SQL file for a manual install)
Config.RangestableVoice ranges (metres). The entry with default = true is used on spawn.
Config.CycleKey0xA5BDCD3CRIGHTBRACKET
Config.CycleCommand'voice'
Config.SaveRangetrueremember each player's last range between sessions (client KVP)
Config.ShowRangeRingtrueGround ring shown when changing range
Config.RingDuration1500
Config.RingColour{ r = 255, g = 255, b = 255, a = 90 }
Config.ShowHudtrueHUD
Config.HudEditCommand'voicehud'drag the HUD box to move it
Config.HudToggleCommand'togglevoicehud'players can hide/show their own HUD (saved per client)
Config.MuteWhenDeadtrueAuto-mute (rsg-core metadata)
Config.MuteWhenCuffedfalse
Config.AdminMuteCommand'voicemute'/voiceunmute [id]
Config.AdminUnmuteCommand'voiceunmute'
Config.AdminPermission'admin'
Config.MuteExpiryCheck30seconds between checks for expired mutes
Config.MuffletableMuffled voices: players in a different interior (inside vs outside, another building) sound quieter
Config.Enabledtrue
Config.Volume0.35
Config.Interval500
Config.TalkIcontableTexture: overhead / overhead_speaker (rdr3_discoveries textures/overhead)
Config.Distance15.0
Config.ShowSelffalse
Config.Dict'overhead'
Config.Texture'overhead_speaker'
Config.Size0.022
Config.ZOffset1.05
Config.Colour{ r = 255, g = 255, b = 255, a = 220 }
Config.PartyColour{ r = 217, g = 164, b = 65, a = 230 }
Config.RadiotableRadio channels: Enabled, UseKeyMapping, Key, TalkKey (fallback), NearbyHear, MaxMembers, Debug
Config.RadioColour{ r = 111, g = 191, b = 115, a = 230 }Speaker icon colour for radio transmitters
Config.PartytableParty members within TalkRange hear each other while holding the party talk key.
Config.Command'party'
Config.TalkKey0x430593AA
Config.TalkRange100.0
Config.InviteRange10.0
Config.MaxMembers8
Config.InviteTimeout30
Config.BlipstableMap blips for your party members
Config.WaypointtableShare your map waypoint with the party (/partywaypoint, run again with no waypoint to clear)

Exports#

Server

ExportArgumentsFile
SetPlayerMutedsrc, state, reasonserver/server.lua
IsPlayerMutedsrcserver/server.lua
GetPartyMembers``server/server.lua
IsInPartysrcserver/server.lua
JoinRadiosrc, freqserver/server.lua
LeaveRadiosrcserver/server.lua
GetPlayerRadiosrcserver/server.lua
GetRadioMembersfreqserver/server.lua

Client

ExportArgumentsFile
GetVoiceRange``client/client.lua
SetVoiceRangeIndexiclient/client.lua
IsMuted``client/client.lua
IsPlayerTalkingsidclient/client.lua
SetMuteOverridestate, reasonclient/client.lua
GetPartyMembers``client/client.lua
IsInParty``client/client.lua
GetRadio``client/client.lua
IsRadioTalking``client/client.lua
GetRadioTalkKey``client/client.lua
-- example
local result = exports['rsg-voice']:SetPlayerMuted(src, state, reason)

Callbacks#

CallbackSideArgumentsFile
rsg-voice:server:isMutedserversrc, cbserver/server.lua
rsg-voice:server:getPartyserversrc, cbserver/server.lua
-- client side
RSGCore.Functions.TriggerCallback('rsg-voice:server:isMuted', function(result)
    -- use result
end)

Events#

Server events can be fired by any client, so every handler re-validates the player, the arguments and any permission, distance or cooldown on the server. Never add a reward to a handler without those checks.

EventSideArgumentsFile
RSGCore:Client:OnPlayerLoadedclient``client/client.lua
RSGCore:Client:OnPlayerUnloadclient``client/client.lua
RSGCore:Player:SetPlayerDataclientdataclient/client.lua
rsg-voice:client:muteStateclientstateclient/client.lua
rsg-voice:client:partyPositionsclientlistclient/client.lua
rsg-voice:client:partyWaypointclientc, fromNameclient/client.lua
rsg-voice:client:partyUpdateclientdataclient/client.lua
rsg-voice:client:partyInviteclientfromName, timeoutclient/client.lua
rsg-voice:server:partyInviteservertargetserver/server.lua
rsg-voice:server:partyRespondserveracceptserver/server.lua
rsg-voice:server:partyKickservertargetserver/server.lua
rsg-voice:server:partyLeaveserver``server/server.lua
rsg-voice:server:partyWaypointservercoordsserver/server.lua
rsg-voice:server:radioTalkserverstateserver/server.lua
rsg-voice:client:radioUpdateclientdataclient/client.lua
rsg-voice:client:radioTalkclientsid, stateclient/client.lua
-- from a client script
TriggerServerEvent('rsg-voice:server:partyInvite', target)
-- from a server script
TriggerClientEvent('RSGCore:Client:OnPlayerLoaded', source)

Locales#

Language files in locales/: de, el, en, es, fr, ja, nl, pl, pt-br, ro, ru. Set the language with setr rsg:locale "en".

<!-- END AUTO-REFERENCE -->