2026-04-14 17:41:39 +02:00

152 lines
8.0 KiB
Lua

Config, Event, State, NuiEvent = {}, {}, {}, {}
-- This implementation is in active development; for a more stable experience, consider using the C# version:
-- Use this if you want to decrease server load. This ressource is for FiveM only!
-- https://github.com/SaltyHub-net/saltychat-fivem/releases/tag/v1.2.4
--[[
Pending Features (not yet supported in this version):
• Secondary radio channels
If you require any of these features, please use the C# release linked above.
]]
Config.BlockShootingWhileInRadio = true -- Prevents weapon discharge while transmitting on radio (enable for immersive gameplay)
Config.UpdateStateTick = 350 -- Interval (ms) for state updates (e.g., proximity checks). Increase for lower CPU usage or decrease for higher responsiveness.
Config.LoudspeakerRadius = 3.0 -- Radius (meters) within which bystanders can overhear loudspeaker transmissions
Config.usePhoneSpeaker = true -- Enable custom phone speaker audio routing
Config.DropPlayerForVersionMismatch = false -- Disconnect players if their plugin version is incompatible with the server's requirements
-- Animations for radio:
-- Config.animDict = "random@arrests"
Config.radioAnimation = {
animDictionary = "random@arrests",
animationName = "generic_radio_enter",
blendInSpeed = 10.0,
blendOutSpeed = -1,
duration = -1,
flag = 50,
playbackRate = 0,
lockX = false,
lockY = false,
lockZ = false,
}
-- change
-- Global Plugin Settings
Config.IsDebug = false -- Toggle debug logging
Config.VoiceEnabled = true -- Master switch for in-game voice
Config.ServerUniqueIdentifier = "Fq/CcsDzbMJAlEAw741HEcM8kiQ=" -- Unique key for server association
Config.MinimumPluginVersion = "3.1.0" -- Minimum compatible plugin version
Config.SoundPack = "default" -- Audio asset pack in use
-- Channel and Range Definitions
-- PLEASE MAKE SURE THIS IS 100% CORRECT BEFORE OPENING A TICKET!
-- Read the documentation: https://saltyhub.gitbook.io/saltyhub/d2VH6nTF48NhyZx7otC6
Config.IngameChannelId = 2 -- Channel ID reserved for in-game communications
Config.IngameChannelPassword = "" -- Password for the in-game channel (optional)
Config.SwissChannelIds = { 3 } -- Support channel IDs (for administrative use)
-- Radio and Voice Range Settings (in meters)
Config.VoiceRanges = { 0.8, 2.0, 5.0, 15.0 } -- Discrete range options for voice chat
Config.EnableVoiceRangeNotification = true -- (Unused) Toggle on-screen notifications for range changes
Config.VoiceRangeNotification = "Reichweite auf %s meter gesetzt." -- (Unused) Notification text template
Config.IgnoreInvisiblePlayers = false -- Exclude invisible players from proximity checks
Config.RadioType = 4 -- Radio communication model (refer to documentation for types)
Config.EnableRadioHardcoreMode = false -- Restricts radio use under certain conditions (e.g., swimming).
Config.UltraShortRangeDistance = 5000.0 -- Ultra-short range maximum distance for radio signals
Config.ShortRangeDistance = 10000.0 -- Short range maximum distance
Config.LongRangeDistace = 30000.0 -- Long range maximum distance
Config.MegaphoneRange = 120.0 -- Maximum range for megaphone broadcasts
Config.VariablePhoneDistortion = false -- Enable variable distortion based on distance
Config.NamePattern = "[{serverid}]" -- Template for display names (e.g., "[12]")
-- Keybinds and Input Controls
Config.RequestTalkStates = true -- (Not implemented) Enable talk-state requests via input
Config.RequestRadioTrafficStates = false -- (Not implemented) Toggle radio traffic status requests
Config.ToggleRange = "Z" -- Key to cycle through voice ranges
Config.TalkPrimary = "CAPITAL" -- Primary radio key
Config.TalkSecondary = "" -- Secondary radio key
Config.TalkMegaphone = "" -- Key to activate megaphone
-- Audio Volume Settings
Config.PhoneVolume = 1.0 -- Master volume for phone calls
Config.RadioVolume = 1.0 -- Master volume for radio channels
-- Internal Event Identifiers
Event.SaltyChat_Initialize = 'SaltyChat_Initialize'
Event.SaltyChat_CheckVersion = 'SaltyChat_CheckVersion'
Event.SaltyChat_UpdateVoiceRange = 'SaltyChat_UpdateVoiceRange'
Event.SaltyChat_RemoveClient = 'SaltyChat_RemoveClient'
Event.SaltyChat_PluginStateChanged = 'SaltyChat_PluginStateChanged'
Event.SaltyChat_TalkStateChanged = 'SaltyChat_TalkStateChanged'
Event.SaltyChat_VoiceRangeChanged = 'SaltyChat_VoiceRangeChanged'
Event.SaltyChat_MicStateChanged = 'SaltyChat_MicStateChanged'
Event.SaltyChat_MicEnabledChanged = 'SaltyChat_MicEnabledChanged'
Event.SaltyChat_SoundStateChanged = 'SaltyChat_SoundStateChanged'
Event.SaltyChat_SoundEnabledChanged = 'SaltyChat_SoundEnabledChanged'
Event.SaltyChat_RadioChannelChanged = 'SaltyChat_RadioChannelChanged'
Event.SaltyChat_RadioTrafficStateChanged = 'SaltyChat_RadioTrafficStateChanged'
Event.SaltyChat_EstablishCall = 'SaltyChat_EstablishCall'
Event.SaltyChat_EstablishCallRelayed = 'SaltyChat_EstablishCallRelayed'
Event.SaltyChat_EndCall = 'SaltyChat_EndCall'
Event.SaltyChat_SetRadioSpeaker = 'SaltyChat_SetRadioSpeaker'
Event.SaltyChat_ChannelInUse = 'SaltyChat_ChannelInUse'
Event.SaltyChat_IsSending = 'SaltyChat_IsSending'
Event.SaltyChat_SetRadioChannel = 'SaltyChat_SetRadioChannel'
Event.SaltyChat_UpdateRadioTowers = 'SaltyChat_UpdateRadioTowers'
Event.SaltyChat_UpdateDeathState = 'SaltyChat_UpdateDeathState'
-- Player State Keys for NUI and Internal Tracking
State.SaltyChat_TeamSpeakName = 'SaltyChat_TeamSpeakName'
State.SaltyChat_VoiceRange = 'SaltyChat_VoiceRange'
State.SaltyChat_IsAlive = 'SaltyChat_IsAlive'
State.SaltyChat_IsUsingMegaphone = 'SaltyChat_IsUsingMegaphone'
State.SaltyChat_RadioChannelMember = 'SaltyChat_RadioChannelMember'
State.SaltyChat_RadioChannelSender = 'SaltyChat_RadioChannelSender'
-- NUI (Browser UI) Event Hooks
NuiEvent.SaltyChat_OnConnected = "SaltyChat_OnConnected"
NuiEvent.SaltyChat_OnDisconnected = "SaltyChat_OnDisconnected"
NuiEvent.SaltyChat_OnMessage = "SaltyChat_OnMessage"
NuiEvent.SaltyChat_OnError = "SaltyChat_OnError"
NuiEvent.SaltyChat_OnNuiReady = "SaltyChat_OnNuiReady"
function DumpTable(table, nb) -- copy pasted from es_extended
if nb == nil then nb = 0 end
if type(table) == "table" then
local s = ""
for _ = 1, nb + 1, 1 do s = s .. " " end
s = "{\n"
for k, v in pairs(table) do
if type(k) ~= "number" then k = '"' .. k .. '"' end
for _ = 1, nb, 1 do s = s .. " " end
s = s .. "[" .. k .. "] = " .. DumpTable(v, nb + 1) .. ",\n"
end
for _ = 1, nb, 1 do s = s .. " " end
return s .. "}"
else
return tostring(table)
end
end
function debugPrint(message)
if Config.IsDebug then
local info = debug.getinfo(2, "Sl")
if info then
print(string.format("^6[%s:%d]^3 %s^0", info.short_src,
info.currentline, message))
else
print("Debug info not available: " .. message)
end
end
end