adding updating to mods
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -4,7 +4,7 @@ lua54 'yes'
|
|||||||
|
|
||||||
description 'Biker - Grapeseed'
|
description 'Biker - Grapeseed'
|
||||||
author 'G&Ns Studio'
|
author 'G&Ns Studio'
|
||||||
version '4.1.0'
|
version '4.1.1'
|
||||||
|
|
||||||
this_is_a_map 'yes'
|
this_is_a_map 'yes'
|
||||||
|
|
||||||
|
|||||||
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
resources/[EGRP-Map-Addons]/[gnstudio]/cfx_gn_biker_grapeseed/stream/ydr/gn_biker_barn_r01_proxy.ydr
LFS
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
resources/[EGRP-Map-Addons]/[gnstudio]/cfx_gn_biker_grapeseed/stream/ydr/gn_biker_barn_r02_proxy.ydr
LFS
BIN
Binary file not shown.
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
BIN
Binary file not shown.
resources/[EGRP-Map-Addons]/[gnstudio]/cfx_gn_biker_grapeseed/stream/ydr/gn_biker_r01_lightproxy.ydr
LFS
BIN
Binary file not shown.
resources/[EGRP-Map-Addons]/[gnstudio]/cfx_gn_biker_grapeseed/stream/ydr/gn_biker_r01_windowsday.ydr
LFS
BIN
Binary file not shown.
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
BIN
Binary file not shown.
resources/[EGRP-Map-Addons]/[gnstudio]/cfx_gn_biker_grapeseed/stream/ydr/gn_biker_r02_lightproxy.ydr
LFS
BIN
Binary file not shown.
resources/[EGRP-Map-Addons]/[gnstudio]/cfx_gn_biker_grapeseed/stream/ydr/gn_biker_r02_windowsday.ydr
LFS
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
resources/[EGRP-Map-Addons]/[gnstudio]/cfx_gn_biker_grapeseed/stream/ydr/gn_biker_r03_windowsday.ydr
LFS
BIN
Binary file not shown.
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
Binary file not shown.
@@ -3,12 +3,9 @@ lua54 'yes'
|
|||||||
game "gta5"
|
game "gta5"
|
||||||
|
|
||||||
author 'brofx'
|
author 'brofx'
|
||||||
description 'brofx_farmhouse_02'
|
description 'brofx_farmhouse02'
|
||||||
version '1.0.0'
|
version '1.1.0'
|
||||||
|
|
||||||
data_file "INTERIOR_PROXY_ORDER_FILE" "interiorproxies.meta"
|
|
||||||
|
|
||||||
files { "stream/interiorproxies.meta" }
|
|
||||||
|
|
||||||
this_is_a_map "yes"
|
this_is_a_map "yes"
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -6,40 +6,15 @@
|
|||||||
<colors>
|
<colors>
|
||||||
<Item>
|
<Item>
|
||||||
<indices content="char_array">
|
<indices content="char_array">
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
0
|
0
|
||||||
134
|
13
|
||||||
0
|
16
|
||||||
64
|
|
||||||
64
|
|
||||||
64
|
|
||||||
64
|
|
||||||
</indices>
|
</indices>
|
||||||
<liveries>
|
<liveries>
|
||||||
<Item value="false"/>
|
<Item value="false"/>
|
||||||
<Item value="false"/>
|
|
||||||
<Item value="false"/>
|
|
||||||
<Item value="false"/>
|
|
||||||
<Item value="false"/>
|
|
||||||
<Item value="false"/>
|
|
||||||
<Item value="false"/>
|
|
||||||
<Item value="false"/>
|
|
||||||
<Item value="false"/>
|
|
||||||
<Item value="false"/>
|
|
||||||
<Item value="false"/>
|
|
||||||
<Item value="false"/>
|
|
||||||
<Item value="false"/>
|
|
||||||
<Item value="false"/>
|
|
||||||
<Item value="false"/>
|
|
||||||
<Item value="false"/>
|
|
||||||
<Item value="false"/>
|
|
||||||
<Item value="false"/>
|
|
||||||
<Item value="false"/>
|
|
||||||
<Item value="false"/>
|
|
||||||
<Item value="false"/>
|
|
||||||
<Item value="false"/>
|
|
||||||
<Item value="false"/>
|
|
||||||
<Item value="false"/>
|
|
||||||
<Item value="false"/>
|
|
||||||
</liveries>
|
</liveries>
|
||||||
</Item>
|
</Item>
|
||||||
</colors>
|
</colors>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -8,7 +8,9 @@ end
|
|||||||
|
|
||||||
local ox_inventory = hasResource('ox_inventory') and exports.ox_inventory
|
local ox_inventory = hasResource('ox_inventory') and exports.ox_inventory
|
||||||
local qb_inventory = hasResource('qb-inventory') and exports['qb-inventory']
|
local qb_inventory = hasResource('qb-inventory') and exports['qb-inventory']
|
||||||
|
local ps_inventory = hasResource('ps-inventory') and exports['ps-inventory']
|
||||||
local qs_inventory = hasResource('qs-inventory') and exports['qs-inventory']
|
local qs_inventory = hasResource('qs-inventory') and exports['qs-inventory']
|
||||||
|
local codem_inventory = hasResource('codem-inventory') and exports['codem-inventory']
|
||||||
local QBCore, ESX = hasResource('qb-core'), hasResource('es_extended')
|
local QBCore, ESX = hasResource('qb-core'), hasResource('es_extended')
|
||||||
|
|
||||||
if IsDuplicityVersion() then
|
if IsDuplicityVersion() then
|
||||||
@@ -29,7 +31,7 @@ if IsDuplicityVersion() then
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if Scully.UseItem and (qb_inventory or qs_inventory) then
|
if Scully.UseItem and (qb_inventory or ps_inventory or qs_inventory or codem_inventory) then
|
||||||
fw.Functions.CreateUseableItem('radio', function(source, item)
|
fw.Functions.CreateUseableItem('radio', function(source, item)
|
||||||
TriggerClientEvent('scully_radio:openRadio', source, Scully.RadioColour)
|
TriggerClientEvent('scully_radio:openRadio', source, Scully.RadioColour)
|
||||||
end)
|
end)
|
||||||
@@ -51,16 +53,19 @@ if IsDuplicityVersion() then
|
|||||||
|
|
||||||
function Scully.Functions.GetPlayerName(source)
|
function Scully.Functions.GetPlayerName(source)
|
||||||
local player = fw.GetPlayerFromId(source)
|
local player = fw.GetPlayerFromId(source)
|
||||||
local firstname = player.get('firstName')
|
|
||||||
|
|
||||||
if firstname then
|
if player then
|
||||||
return '', string.sub(firstname, 1, 1) .. '. ' .. player.get('lastName')
|
local firstname = player.get('firstName')
|
||||||
else
|
|
||||||
return '', GetPlayerName(source)
|
if firstname then
|
||||||
|
return '', string.sub(firstname, 1, 1) .. '. ' .. player.get('lastName')
|
||||||
|
else
|
||||||
|
return '', GetPlayerName(source)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if Scully.UseItem and qs_inventory then
|
if Scully.UseItem and (qs_inventory or codem_inventory) then
|
||||||
fw.RegisterUsableItem('radio', function(source)
|
fw.RegisterUsableItem('radio', function(source)
|
||||||
TriggerClientEvent('scully_radio:openRadio', source, Scully.RadioColour)
|
TriggerClientEvent('scully_radio:openRadio', source, Scully.RadioColour)
|
||||||
end)
|
end)
|
||||||
@@ -100,6 +105,7 @@ if IsDuplicityVersion() then
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
local playerState = LocalPlayer.state
|
||||||
local playerData = {}
|
local playerData = {}
|
||||||
|
|
||||||
if QBCore then
|
if QBCore then
|
||||||
@@ -109,6 +115,17 @@ else
|
|||||||
|
|
||||||
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
|
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
|
||||||
playerData = fw.Functions.GetPlayerData()
|
playerData = fw.Functions.GetPlayerData()
|
||||||
|
|
||||||
|
local callsign = GetResourceKvpString(playerData.citizenid .. ':callsign:' .. Scully.KVPHandle)
|
||||||
|
local radioName = GetResourceKvpString(playerData.citizenid .. ':name:' .. Scully.KVPHandle)
|
||||||
|
|
||||||
|
if callsign then
|
||||||
|
TriggerServerEvent('scully_radio:updateRadioInfo', 'callsign', callsign)
|
||||||
|
end
|
||||||
|
|
||||||
|
if radioName then
|
||||||
|
TriggerServerEvent('scully_radio:updateRadioInfo', 'name', radioName)
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterNetEvent('QBCore:Client:OnPlayerUnload', function()
|
RegisterNetEvent('QBCore:Client:OnPlayerUnload', function()
|
||||||
@@ -121,32 +138,50 @@ else
|
|||||||
playerData.job = job
|
playerData.job = job
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterNetEvent('qb-inventory:client:updateInventory', function()
|
CreateThread(function()
|
||||||
Scully.Functions.HasItem(function(hasItem)
|
while true do
|
||||||
if not hasItem then
|
if playerState.radioChannel and (playerState.radioChannel > 0) then
|
||||||
TriggerEvent('scully_radio:leaveChannel', true)
|
Scully.Functions.HasItem(function(hasItem)
|
||||||
|
if not hasItem then
|
||||||
|
TriggerEvent('scully_radio:leaveChannel', true)
|
||||||
|
end
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
end)
|
|
||||||
end)
|
|
||||||
|
|
||||||
RegisterNetEvent('inventory:client:UpdatePlayerInventory', function()
|
Wait(2500)
|
||||||
Scully.Functions.HasItem(function(hasItem)
|
end
|
||||||
if not hasItem then
|
|
||||||
TriggerEvent('scully_radio:leaveChannel', true)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
Scully.Functions.ShowNotification = fw.Functions.Notify
|
Scully.Functions.ShowNotification = fw.Functions.Notify
|
||||||
|
|
||||||
|
function Scully.Functions.UpdateInfo(data)
|
||||||
|
Scully.Radio[data.type] = data.value
|
||||||
|
|
||||||
|
SetResourceKvp(playerData.citizenid .. ':' .. data.type .. ':' .. Scully.KVPHandle, data.value)
|
||||||
|
TriggerServerEvent('scully_radio:updateRadioInfo', data.type, data.value)
|
||||||
|
Scully.Functions.ShowNotification(Scully.Language.UpdatedYour .. ' ' .. data.type .. ' ' .. Scully.Language.To .. ' ' .. data.value .. '!')
|
||||||
|
end
|
||||||
elseif ESX then
|
elseif ESX then
|
||||||
local playerState = LocalPlayer.state
|
|
||||||
local fw = exports.es_extended:getSharedObject()
|
local fw = exports.es_extended:getSharedObject()
|
||||||
|
|
||||||
playerData = fw.GetPlayerData()
|
playerData = fw.GetPlayerData()
|
||||||
|
|
||||||
RegisterNetEvent('esx:playerLoaded', function(data)
|
RegisterNetEvent('esx:playerLoaded', function(data)
|
||||||
|
Wait(1000)
|
||||||
|
|
||||||
playerState.isLoggedIn = true
|
playerState.isLoggedIn = true
|
||||||
playerData = data
|
playerData = data
|
||||||
|
|
||||||
|
local callsign = GetResourceKvpString(playerData.identifier .. ':callsign:' .. Scully.KVPHandle)
|
||||||
|
local radioName = GetResourceKvpString(playerData.identifier .. ':name:' .. Scully.KVPHandle)
|
||||||
|
|
||||||
|
if callsign then
|
||||||
|
TriggerServerEvent('scully_radio:updateRadioInfo', 'callsign', callsign)
|
||||||
|
end
|
||||||
|
|
||||||
|
if radioName then
|
||||||
|
TriggerServerEvent('scully_radio:updateRadioInfo', 'name', radioName)
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterNetEvent('esx:onPlayerLogout', function()
|
RegisterNetEvent('esx:onPlayerLogout', function()
|
||||||
@@ -161,6 +196,14 @@ else
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
Scully.Functions.ShowNotification = fw.ShowNotification
|
Scully.Functions.ShowNotification = fw.ShowNotification
|
||||||
|
|
||||||
|
function Scully.Functions.UpdateInfo(data)
|
||||||
|
Scully.Radio[data.type] = data.value
|
||||||
|
|
||||||
|
SetResourceKvp(playerData.identifier .. ':' .. data.type .. ':' .. Scully.KVPHandle, data.value)
|
||||||
|
TriggerServerEvent('scully_radio:updateRadioInfo', data.type, data.value)
|
||||||
|
Scully.Functions.ShowNotification(Scully.Language.UpdatedYour .. ' ' .. data.type .. ' ' .. Scully.Language.To .. ' ' .. data.value .. '!')
|
||||||
|
end
|
||||||
else
|
else
|
||||||
CreateThread(function()
|
CreateThread(function()
|
||||||
Wait(500)
|
Wait(500)
|
||||||
@@ -172,7 +215,18 @@ else
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterNetEvent('playerSpawned', function()
|
RegisterNetEvent('playerSpawned', function()
|
||||||
LocalPlayer.state:set('isLoggedIn', true, false)
|
playerState:set('isLoggedIn', true, false)
|
||||||
|
|
||||||
|
local callsign = GetResourceKvpString('radio:callsign:' .. Scully.KVPHandle)
|
||||||
|
local radioName = GetResourceKvpString('radio:name:' .. Scully.KVPHandle)
|
||||||
|
|
||||||
|
if callsign then
|
||||||
|
TriggerServerEvent('scully_radio:updateRadioInfo', 'callsign', callsign)
|
||||||
|
end
|
||||||
|
|
||||||
|
if radioName then
|
||||||
|
TriggerServerEvent('scully_radio:updateRadioInfo', 'name', radioName)
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
function Scully.Functions.ShowNotification(text)
|
function Scully.Functions.ShowNotification(text)
|
||||||
@@ -180,6 +234,14 @@ else
|
|||||||
AddTextComponentSubstringPlayerName(text)
|
AddTextComponentSubstringPlayerName(text)
|
||||||
EndTextCommandThefeedPostTicker(true, true)
|
EndTextCommandThefeedPostTicker(true, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Scully.Functions.UpdateInfo(data)
|
||||||
|
Scully.Radio[data.type] = data.value
|
||||||
|
|
||||||
|
SetResourceKvp('radio:' .. data.type .. ':' .. Scully.KVPHandle, data.value)
|
||||||
|
TriggerServerEvent('scully_radio:updateRadioInfo', data.type, data.value)
|
||||||
|
Scully.Functions.ShowNotification(Scully.Language.UpdatedYour .. ' ' .. data.type .. ' ' .. Scully.Language.To .. ' ' .. data.value .. '!')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Scully.Functions.HasAccess(channel)
|
function Scully.Functions.HasAccess(channel)
|
||||||
@@ -229,7 +291,32 @@ else
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif qb_inventory then
|
elseif qb_inventory then
|
||||||
hasRadioItem = qb_inventory:HasItem(checkItems)
|
for i = 1, #checkItems do
|
||||||
|
local hasItem = qb_inventory:HasItem(checkItems[i], 1)
|
||||||
|
|
||||||
|
if hasItem then
|
||||||
|
hasRadioItem = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elseif ps_inventory then
|
||||||
|
for i = 1, #checkItems do
|
||||||
|
local hasItem = ps_inventory:HasItem(checkItems[i], 1)
|
||||||
|
|
||||||
|
if hasItem then
|
||||||
|
hasRadioItem = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elseif codem_inventory then
|
||||||
|
for i = 1, #checkItems do
|
||||||
|
local hasItem = codem_inventory:HasItem(checkItems[i], 1)
|
||||||
|
|
||||||
|
if hasItem then
|
||||||
|
hasRadioItem = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if not Scully.UseItem then hasRadioItem = true end
|
if not Scully.UseItem then hasRadioItem = true end
|
||||||
|
|||||||
@@ -31,7 +31,8 @@ escrow_ignore {
|
|||||||
'config.lua',
|
'config.lua',
|
||||||
'functions/*.lua',
|
'functions/*.lua',
|
||||||
'ox_inventory_items.lua',
|
'ox_inventory_items.lua',
|
||||||
'qb-inventory_items.lua'
|
'qb-inventory_items.lua',
|
||||||
|
'talkover_protection.lua'
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_page 'ui/index.html'
|
ui_page 'ui/index.html'
|
||||||
|
|||||||
Binary file not shown.
@@ -0,0 +1,238 @@
|
|||||||
|
local radioChannel = 0
|
||||||
|
local radioNames = {}
|
||||||
|
local disableRadioAnim = false
|
||||||
|
local talkingPlayers = {}
|
||||||
|
local playerState = LocalPlayer.state
|
||||||
|
|
||||||
|
--- event syncRadioData
|
||||||
|
--- syncs the current players on the radio to the client
|
||||||
|
---@param radioTable table the table of the current players on the radio
|
||||||
|
---@param localPlyRadioName string the local players name
|
||||||
|
function syncRadioData(radioTable, localPlyRadioName)
|
||||||
|
radioData = radioTable
|
||||||
|
logger.info('[radio] Syncing radio table.')
|
||||||
|
if GetConvarInt('voice_debugMode', 0) >= 4 then
|
||||||
|
print('-------- RADIO TABLE --------')
|
||||||
|
tPrint(radioData)
|
||||||
|
print('-----------------------------')
|
||||||
|
end
|
||||||
|
for tgt, enabled in pairs(radioTable) do
|
||||||
|
if tgt ~= playerServerId then
|
||||||
|
toggleVoice(tgt, enabled, 'radio')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
sendUIMessage({
|
||||||
|
radioChannel = radioChannel,
|
||||||
|
radioEnabled = radioEnabled
|
||||||
|
})
|
||||||
|
if GetConvarInt("voice_syncPlayerNames", 0) == 1 then
|
||||||
|
radioNames[playerServerId] = localPlyRadioName
|
||||||
|
end
|
||||||
|
end
|
||||||
|
RegisterNetEvent('pma-voice:syncRadioData', syncRadioData)
|
||||||
|
|
||||||
|
--- event setTalkingOnRadio
|
||||||
|
--- sets the players talking status, triggered when a player starts/stops talking.
|
||||||
|
---@param plySource number the players server id.
|
||||||
|
---@param enabled boolean whether the player is talking or not.
|
||||||
|
function setTalkingOnRadio(plySource, enabled)
|
||||||
|
toggleVoice(plySource, enabled, 'radio')
|
||||||
|
radioData[plySource] = enabled
|
||||||
|
playMicClicks(enabled)
|
||||||
|
end
|
||||||
|
RegisterNetEvent('pma-voice:setTalkingOnRadio', setTalkingOnRadio)
|
||||||
|
|
||||||
|
--- event addPlayerToRadio
|
||||||
|
--- adds a player onto the radio.
|
||||||
|
---@param plySource number the players server id to add to the radio.
|
||||||
|
function addPlayerToRadio(plySource, plyRadioName)
|
||||||
|
radioData[plySource] = false
|
||||||
|
if GetConvarInt("voice_syncPlayerNames", 0) == 1 then
|
||||||
|
radioNames[plySource] = plyRadioName
|
||||||
|
end
|
||||||
|
if radioPressed then
|
||||||
|
logger.info('[radio] %s joined radio %s while we were talking, adding them to targets', plySource, radioChannel)
|
||||||
|
playerTargets(radioData, MumbleIsPlayerTalking(PlayerId()) and callData or {})
|
||||||
|
else
|
||||||
|
logger.info('[radio] %s joined radio %s', plySource, radioChannel)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
RegisterNetEvent('pma-voice:addPlayerToRadio', addPlayerToRadio)
|
||||||
|
|
||||||
|
--- event removePlayerFromRadio
|
||||||
|
--- removes the player (or self) from the radio
|
||||||
|
---@param plySource number the players server id to remove from the radio.
|
||||||
|
function removePlayerFromRadio(plySource)
|
||||||
|
if plySource == playerServerId then
|
||||||
|
logger.info('[radio] Left radio %s, cleaning up.', radioChannel)
|
||||||
|
for tgt, _ in pairs(radioData) do
|
||||||
|
if tgt ~= playerServerId then
|
||||||
|
toggleVoice(tgt, false, 'radio')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
sendUIMessage({
|
||||||
|
radioChannel = 0,
|
||||||
|
radioEnabled = radioEnabled
|
||||||
|
})
|
||||||
|
radioNames = {}
|
||||||
|
radioData = {}
|
||||||
|
playerTargets(MumbleIsPlayerTalking(PlayerId()) and callData or {})
|
||||||
|
else
|
||||||
|
toggleVoice(plySource, false)
|
||||||
|
if radioPressed then
|
||||||
|
logger.info('[radio] %s left radio %s while we were talking, updating targets.', plySource, radioChannel)
|
||||||
|
playerTargets(radioData, MumbleIsPlayerTalking(PlayerId()) and callData or {})
|
||||||
|
else
|
||||||
|
logger.info('[radio] %s has left radio %s', plySource, radioChannel)
|
||||||
|
end
|
||||||
|
radioData[plySource] = nil
|
||||||
|
if GetConvarInt("voice_syncPlayerNames", 0) == 1 then
|
||||||
|
radioNames[plySource] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
RegisterNetEvent('pma-voice:removePlayerFromRadio', removePlayerFromRadio)
|
||||||
|
|
||||||
|
--- function setRadioChannel
|
||||||
|
--- sets the local players current radio channel and updates the server
|
||||||
|
---@param channel number the channel to set the player to, or 0 to remove them.
|
||||||
|
function setRadioChannel(channel)
|
||||||
|
if GetConvarInt('voice_enableRadios', 1) ~= 1 then return end
|
||||||
|
type_check({channel, "number"})
|
||||||
|
TriggerServerEvent('pma-voice:setPlayerRadio', channel)
|
||||||
|
radioChannel = channel
|
||||||
|
end
|
||||||
|
|
||||||
|
--- exports setRadioChannel
|
||||||
|
--- sets the local players current radio channel and updates the server
|
||||||
|
---@param channel number the channel to set the player to, or 0 to remove them.
|
||||||
|
exports('setRadioChannel', setRadioChannel)
|
||||||
|
-- mumble-voip compatability
|
||||||
|
exports('SetRadioChannel', setRadioChannel)
|
||||||
|
|
||||||
|
--- exports removePlayerFromRadio
|
||||||
|
--- sets the local players current radio channel and updates the server
|
||||||
|
exports('removePlayerFromRadio', function()
|
||||||
|
setRadioChannel(0)
|
||||||
|
end)
|
||||||
|
|
||||||
|
--- exports addPlayerToRadio
|
||||||
|
--- sets the local players current radio channel and updates the server
|
||||||
|
---@param _radio number the channel to set the player to, or 0 to remove them.
|
||||||
|
exports('addPlayerToRadio', function(_radio)
|
||||||
|
local radio = tonumber(_radio)
|
||||||
|
if radio then
|
||||||
|
setRadioChannel(radio)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
--- exports toggleRadioAnim
|
||||||
|
--- toggles whether the client should play radio anim or not, if the animation should be played or notvaliddance
|
||||||
|
exports('toggleRadioAnim', function()
|
||||||
|
disableRadioAnim = not disableRadioAnim
|
||||||
|
TriggerEvent('pma-voice:toggleRadioAnim', disableRadioAnim)
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- exports disableRadioAnim
|
||||||
|
--- returns whether the client is undercover or not
|
||||||
|
exports('getRadioAnimState', function()
|
||||||
|
return toggleRadioAnim
|
||||||
|
end)
|
||||||
|
|
||||||
|
--- check if the player is dead
|
||||||
|
--- seperating this so if people use different methods they can customize
|
||||||
|
--- it to their need as this will likely never be changed
|
||||||
|
--- but you can integrate the below state bag to your death resources.
|
||||||
|
--- LocalPlayer.state:set('isDead', true or false, false)
|
||||||
|
function isDead()
|
||||||
|
if playerState.isDead then
|
||||||
|
return true
|
||||||
|
elseif IsPlayerDead(PlayerId()) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
RegisterCommand('+radiotalk', function()
|
||||||
|
if GetConvarInt('voice_enableRadios', 1) ~= 1 then return end
|
||||||
|
if isDead() then return end
|
||||||
|
|
||||||
|
local talkingProtection = false
|
||||||
|
|
||||||
|
for player, talking in pairs(talkingPlayers) do
|
||||||
|
if talking then
|
||||||
|
local currentChannel = Player(player).state.radioChannel
|
||||||
|
|
||||||
|
if currentChannel ~= radioChannel then
|
||||||
|
talkingPlayers[player] = false
|
||||||
|
else
|
||||||
|
talkingProtection = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if talkingProtection then return end
|
||||||
|
|
||||||
|
if not radioPressed and radioEnabled then
|
||||||
|
if radioChannel > 0 then
|
||||||
|
logger.info('[radio] Start broadcasting, update targets and notify server.')
|
||||||
|
playerTargets(radioData, MumbleIsPlayerTalking(PlayerId()) and callData or {})
|
||||||
|
TriggerServerEvent('pma-voice:setTalkingOnRadio', true)
|
||||||
|
radioPressed = true
|
||||||
|
playMicClicks(true)
|
||||||
|
if GetConvarInt('voice_enableRadioAnim', 0) == 1 and not (GetConvarInt('voice_disableVehicleRadioAnim', 0) == 1 and IsPedInAnyVehicle(PlayerPedId(), false)) then
|
||||||
|
if not disableRadioAnim then
|
||||||
|
RequestAnimDict('random@arrests')
|
||||||
|
while not HasAnimDictLoaded('random@arrests') do
|
||||||
|
Citizen.Wait(10)
|
||||||
|
end
|
||||||
|
TaskPlayAnim(PlayerPedId(), "random@arrests", "generic_radio_enter", 8.0, 2.0, -1, 50, 2.0, 0, 0, 0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
Citizen.CreateThread(function()
|
||||||
|
TriggerEvent("pma-voice:radioActive", true)
|
||||||
|
while radioPressed do
|
||||||
|
Wait(0)
|
||||||
|
SetControlNormal(0, 249, 1.0)
|
||||||
|
SetControlNormal(1, 249, 1.0)
|
||||||
|
SetControlNormal(2, 249, 1.0)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end, false)
|
||||||
|
|
||||||
|
RegisterCommand('-radiotalk', function()
|
||||||
|
if radioChannel > 0 or radioEnabled and radioPressed then
|
||||||
|
radioPressed = false
|
||||||
|
MumbleClearVoiceTargetPlayers(voiceTarget)
|
||||||
|
playerTargets(MumbleIsPlayerTalking(PlayerId()) and callData or {})
|
||||||
|
TriggerEvent("pma-voice:radioActive", false)
|
||||||
|
playMicClicks(false)
|
||||||
|
if GetConvarInt('voice_enableRadioAnim', 0) == 1 then
|
||||||
|
StopAnimTask(PlayerPedId(), "random@arrests", "generic_radio_enter", -4.0)
|
||||||
|
end
|
||||||
|
TriggerServerEvent('pma-voice:setTalkingOnRadio', false)
|
||||||
|
end
|
||||||
|
end, false)
|
||||||
|
if gameVersion == 'fivem' then
|
||||||
|
RegisterKeyMapping('+radiotalk', 'Talk over Radio', 'keyboard', GetConvar('voice_defaultRadio', 'LMENU'))
|
||||||
|
end
|
||||||
|
|
||||||
|
--- event syncRadio
|
||||||
|
--- syncs the players radio, only happens if the radio was set server side.
|
||||||
|
---@param _radioChannel number the radio channel to set the player to.
|
||||||
|
function syncRadio(_radioChannel)
|
||||||
|
if GetConvarInt('voice_enableRadios', 1) ~= 1 then return end
|
||||||
|
logger.info('[radio] radio set serverside update to radio %s', radioChannel)
|
||||||
|
radioChannel = _radioChannel
|
||||||
|
end
|
||||||
|
RegisterNetEvent('pma-voice:clSetPlayerRadio', syncRadio)
|
||||||
|
|
||||||
|
RegisterNetEvent('scully_radio:setTalkingOnRadio', function(player, talking)
|
||||||
|
local currentChannel = Player(player).state.radioChannel
|
||||||
|
|
||||||
|
if currentChannel == radioChannel then
|
||||||
|
talkingPlayers[player] = talking
|
||||||
|
end
|
||||||
|
end)
|
||||||
+4
-4
@@ -69,7 +69,7 @@ ensure vMenu
|
|||||||
ensure Delete-Vehicle
|
ensure Delete-Vehicle
|
||||||
ensure delped
|
ensure delped
|
||||||
ensure disable_interior
|
ensure disable_interior
|
||||||
ensure Cruise-Control
|
//ensure Cruise-Control
|
||||||
ensure guidehud
|
ensure guidehud
|
||||||
ensure EGRP-LoadingScreen
|
ensure EGRP-LoadingScreen
|
||||||
ensure NeverWanted
|
ensure NeverWanted
|
||||||
@@ -87,7 +87,7 @@ ensure Tackle
|
|||||||
ensure WeazelNewsCam
|
ensure WeazelNewsCam
|
||||||
ensure Crouch
|
ensure Crouch
|
||||||
ensure CalmAI
|
ensure CalmAI
|
||||||
ensure Engine-Toggle
|
//ensure Engine-Toggle
|
||||||
ensure PiggyBack
|
ensure PiggyBack
|
||||||
ensure Weaponry
|
ensure Weaponry
|
||||||
ensure rpemotesreborn1.6.0
|
ensure rpemotesreborn1.6.0
|
||||||
@@ -122,7 +122,7 @@ ensure Smart-Clamp
|
|||||||
ensure Frame-Monitor
|
ensure Frame-Monitor
|
||||||
ensure Chair-Bed-System
|
ensure Chair-Bed-System
|
||||||
ensure Nearest-Postal
|
ensure Nearest-Postal
|
||||||
ensure Sandy-Streetlights
|
///ensure Sandy-Streetlights
|
||||||
ensure LifeInvader-MLO-Script
|
ensure LifeInvader-MLO-Script
|
||||||
ensure Safe-Zones
|
ensure Safe-Zones
|
||||||
ensure Server-Queue
|
ensure Server-Queue
|
||||||
@@ -148,7 +148,7 @@ ensure DeathCam
|
|||||||
//ensure Doorlock
|
//ensure Doorlock
|
||||||
ensure wk_wars2x
|
ensure wk_wars2x
|
||||||
ensure Firework-Box
|
ensure Firework-Box
|
||||||
ensure Fighterjet-HUD
|
///ensure Fighterjet-HUD
|
||||||
ensure speedcams
|
ensure speedcams
|
||||||
//ensure dopeNotify
|
//ensure dopeNotify
|
||||||
//ensure okokNotify
|
//ensure okokNotify
|
||||||
|
|||||||
Reference in New Issue
Block a user