Skip to content

Commit

Permalink
fix(client/radio): Update UI state when removed from radio
Browse files Browse the repository at this point in the history
  • Loading branch information
antond15 committed Apr 30, 2022
1 parent 4e73a11 commit 8988515
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion client/module/radio.lua
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,16 @@ function removePlayerFromRadio(plySource)
end
end
end
RegisterNetEvent('pma-voice:removePlayerFromRadio', removePlayerFromRadio)

RegisterNetEvent('pma-voice:removePlayerFromRadio', function(plySource, updateUi)
removePlayerFromRadio(plySource)
if updateUi and plySource == playerServerId then
sendUIMessage({
radioChannel = 0,
radioEnabled = radioEnabled
})
end
end)

--- function setRadioChannel
--- sets the local players current radio channel and updates the server
Expand Down
2 changes: 1 addition & 1 deletion server/module/radio.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ exports('overrideRadioNameGetter', overrideRadioNameGetter)
function addPlayerToRadio(source, radioChannel)
if not canJoinChannel(source, radioChannel) then
-- remove the player from the radio client side
return TriggerClientEvent('pma-voice:removePlayerFromRadio', source, source)
return TriggerClientEvent('pma-voice:removePlayerFromRadio', source, source, true)
end
logger.verbose('[radio] Added %s to radio %s', source, radioChannel)

Expand Down

0 comments on commit 8988515

Please sign in to comment.