Files
red-valley/cache/files/codem-radio/resource.rpf

255 lines
14 KiB
Plaintext
Raw Normal View History

2026-03-29 21:41:17 +03:00
RPF2<00><00><00><00>
<00>
<00>0<00>/Settings.luaclient.luafxmanifest.luaSettings = {
Framework = "QBCore", -- Esx or NewESX and QBCore or OldQBCore
Voice = "pma-voice", -- pma-voice & saltychat & mumble-voip
MaxFrequency = 500,
ResetCommad = "radioreset",
Language = {
["group"] = "GRUP",
["enter_frequency"] = "INTRODU FRECVENTA",
["volume_settings"] = "SETARI VOLUM",
["radio_connet_number"] = "NUMAR RADIO CONECTAT",
["settings"] = "Setari",
["join"] = "Conecteaza",
["encrypted"] = "Aceasta frecventa este criptata",
["move"] = "Muta"
},
OnlyJob = {
[1] = {
RadioCode = 1,
Jobs = {"police", "sheriff", "ambulance"},
},
[2] = {
RadioCode = 2,
Jobs = {"police", "sheriff", "ambulance"},
},
[3] = {
RadioCode = 3,
Jobs = {"ambulance"},
},
[4] = {
RadioCode = 4,
Jobs = {"police"},
},
[5] = {
RadioCode = 5,
Jobs = {"sheriff"},
},
},
}
GetFramework = function()
local Get = nil
if Settings.Framework == "ESX" then
while Get == nil do
TriggerEvent('esx:getSharedObject', function(Set) Get = Set end)
Citizen.Wait(0)
end
end
if Settings.Framework == "NewESX" then
Get = exports['es_extended']:getSharedObject()
end
if Settings.Framework == "QBCore" then
Get = exports["qb-core"]:GetCoreObject()
end
if Settings.Framework == "OldQBCore" then
while Get == nil do
TriggerEvent('QBCore:GetObject', function(Set) Get = Set end)
Citizen.Wait(200)
end
end
return Get
end
SendMessage = function(message, isError, part, source)
if part == nil then part = "client" end
if part == "client" then
if Settings.Framework == "QBCore" or Settings.Framework == "OldQBCore" then
local p = nil
if isError then p = "error" else p = "success" end
TriggerEvent("QBCore:Notify",message, p)
else
TriggerEvent("esx:showNotification", message)
end
elseif part == "server" then
if Settings.Framework == "QBCore" or Settings.Framework == "OldQBCore" then
local p = nil
if isError then p = "error" else p = "success" end
TriggerClientEvent('QBCore:Notify', source, message, p)
else
TriggerClientEvent("esx:showNotification",source, message)
end
end
end
ConnectRadio = function(data)
TriggerServerEvent("setRadioChannel", data)
if Settings.Voice == "pma-voice" then
exports["pma-voice"]:setRadioChannel(0)
exports["pma-voice"]:setRadioChannel(data)
elseif Settings.Voice == "saltychat" then
exports["saltychat"]:SetRadioChannel(0, true)
exports["saltychat"]:SetRadioChannel(data, true)
elseif Settings.Voice == "mumble-voip" then
exports["mumble-voip"]:SetRadioChannel(0)
exports["mumble-voip"]:SetRadioChannel(data)
end
end
LoadAnimDic = function(dict)
if not HasAnimDictLoaded(dict) then
RequestAnimDict(dict)
while not HasAnimDictLoaded(dict) do
Wait(0)
end
end
end
toggleRadioAnimation = function(pState)
LoadAnimDic("cellphone@")
if pState then
TaskPlayAnim(PlayerPedId(), "cellphone@", "cellphone_text_read_base", 2.0, 3.0, -1, 49, 0, 0, 0, 0)
radioProp = CreateObject(`prop_cs_hand_radio`, 1.0, 1.0, 1.0, 1, 1, 0)
AttachEntityToEntity(radioProp, PlayerPedId(), GetPedBoneIndex(PlayerPedId(), 57005), 0.14, 0.01, -0.02, 110.0, 120.0, -15.0, 1, 0, 0, 0, 2, 1)
else
StopAnimTask(PlayerPedId(), "cellphone@", "cellphone_text_read_base", 1.0)
ClearPedTasks(PlayerPedId())
if radioProp ~= 0 then
DeleteObject(radioProp)
radioProp = 0
end
end
endlocal Framework, PlayerPed, MenuOpen = nil, nil, nil
Framework = GetFramework()
CreateThread(function()
while Framework == nil do Citizen.Wait(750) end
Citizen.Wait(2500)
end)
-- Functions
SendReactMessage = function(action, data)
SendNUIMessage({
action = action,
data = data
})
end
function OpenClose(data)
MenuOpen = data
SetNuiFocus(data, data)
toggleRadioAnimation(data)
SendReactMessage('setOpen', {
OpenClose = data,
PlayerID = GetPlayerServerId(PlayerId()),
Language = Settings.Language,
})
end
-- Event
RegisterNetEvent("codem-radio:opencloseui", function(data)
OpenClose(data)
end)
RegisterNetEvent("GetRadioPlayer", function(data)
SendReactMessage('setPlayerID', data)
end)
-- Command
RegisterCommand(Settings.ResetCommad, function()
SendReactMessage('setRadioReset')
end)
-- NuiCallback
RegisterNuiCallback("Close", function()
OpenClose(false)
end)
RegisterNuiCallback("RadioLeave", function()
TriggerServerEvent("setRadioChannel", 0)
if Settings.Voice == "pma-voice" then
exports['pma-voice']:removePlayerFromRadio()
elseif Settings.Voice == "saltychat" then
exports["saltychat"]:RemovePlayerRadioChannel()
elseif Settings.Voice == "mumble-voip" then
exports["mumble-voip"]:removePlayerFromRadio()
end
end)
RegisterNuiCallback("setVolume", function(data)
if Settings.Voice == "pma-voice" then
exports['pma-voice']:setRadioVolume(tonumber(data))
elseif Settings.Voice == "saltychat" then
exports["saltychat"]:SetRadioVolume(tonumber(data))
end
end)
RegisterNUICallback('setRadio', function(data)
local RadioCode = data
local isJob = false
local JobControl = false
local PlayerData = (Settings.Framework == "ESX" or Settings.Framework == "NewESX") and Framework.GetPlayerData() or Framework.Functions.GetPlayerData()
if RadioCode ~= nil then
if Settings.MaxFrequency > RadioCode then
if Settings.OnlyJob[RadioCode] and Settings.OnlyJob[RadioCode].RadioCode then
JobControl = true
local radioJobs = Settings.OnlyJob[RadioCode].Jobs
for _, job in pairs(radioJobs) do
if job == PlayerData.job.name then
isJob = true
break
end
end
else
ConnectRadio(RadioCode)
end
end
end
if JobControl then
if isJob then
ConnectRadio(RadioCode)
else
SendMessage(Settings.Language.encrypted, "error", "client")
end
end
end)
fx_version "cerulean"
description "CodeM Store"
author "canrow#8946"
version "1.0.0"
lua54 "yes"
game "gta5"
ui_page "resources/build/index.html"
shared_script "Settings.lua"
client_script "client.lua"
server_script "server.lua"
files {
"resources/build/index.html",
"resources/build/**/*"
}
escrow_ignore {
"Settings.lua",
"server.lua",
"client.lua"
}
dependency '/assetpacks'