Skip to content

Commit

Permalink
Merge pull request #289 from NylanderrDK/patch-1
Browse files Browse the repository at this point in the history
feat(radio): add option for toggling animations
  • Loading branch information
AvarianKnight authored May 1, 2022
2 parents 3863673 + e82c458 commit 5b77d93
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions client/module/radio.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local radioChannel = 0
local radioNames = {}
local disableRadioAnim = false

--- event syncRadioData
--- syncs the current players on the radio to the client
Expand Down Expand Up @@ -123,6 +124,19 @@ exports('addPlayerToRadio', function(_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:toggleUndercover', 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
Expand All @@ -148,11 +162,13 @@ RegisterCommand('+radiotalk', function()
radioPressed = true
playMicClicks(true)
if GetConvarInt('voice_enableRadioAnim', 0) == 1 and not (GetConvarInt('voice_disableVehicleRadioAnim', 0) == 1 and IsPedInAnyVehicle(PlayerPedId(), false)) then
RequestAnimDict('random@arrests')
while not HasAnimDictLoaded('random@arrests') do
Citizen.Wait(10)
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
TaskPlayAnim(PlayerPedId(), "random@arrests", "generic_radio_enter", 8.0, 2.0, -1, 50, 2.0, 0, 0, 0)
end
Citizen.CreateThread(function()
TriggerEvent("pma-voice:radioActive", true)
Expand Down

0 comments on commit 5b77d93

Please sign in to comment.