From 60f9d16fd856348de09801d5bef123db53934029 Mon Sep 17 00:00:00 2001 From: Swellington Soares <145943214+Swellington-Soares@users.noreply.github.com> Date: Wed, 11 Sep 2024 10:55:59 -0300 Subject: [PATCH 1/3] added export to change radio anim. Addition of an exports function to enable the use of custom animation directly in the script, thus eliminating external means of doing the same thing, taking advantage of what the script already offers. --- client/module/radio.lua | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/client/module/radio.lua b/client/module/radio.lua index 25f076c..5543d08 100644 --- a/client/module/radio.lua +++ b/client/module/radio.lua @@ -1,6 +1,7 @@ local radioChannel = 0 local radioNames = {} local disableRadioAnim = false +local radioAnim = { dict = 'random@arrests', name = 'generic_radio_enter' } ---@return boolean isEnabled if radioEnabled is true and LocalPlayer.state.disableRadio is 0 (no bits set) function isRadioEnabled() @@ -195,7 +196,7 @@ RegisterCommand('+radiotalk', function() local shouldPlayAnimation = isRadioAnimEnabled() playMicClicks(true) if shouldPlayAnimation then - RequestAnimDict('random@arrests') + RequestAnimDict(radioAnim.dict) end CreateThread(function() TriggerEvent("pma-voice:radioActive", true) @@ -206,9 +207,9 @@ RegisterCommand('+radiotalk', function() checkFailed = true break end - if shouldPlayAnimation and HasAnimDictLoaded("random@arrests") then - if not IsEntityPlayingAnim(PlayerPedId(), "random@arrests", "generic_radio_enter", 3) then - TaskPlayAnim(PlayerPedId(), "random@arrests", "generic_radio_enter", 8.0, 2.0, -1, 50, 2.0, false, + if shouldPlayAnimation and HasAnimDictLoaded(radioAnim.dict) then + if not IsEntityPlayingAnim(PlayerPedId(), radioAnim.dict, radioAnim.name, 3) then + TaskPlayAnim(PlayerPedId(), radioAnim.dict, radioAnim.name, 8.0, 2.0, -1, 50, 2.0, false, false, false) end @@ -234,6 +235,15 @@ RegisterCommand('+radiotalk', function() end end, false) +local function setRadioTalkAnim(dict, name) + if dict and name then + radioAnim.dict = dict + radioAnim.name = name + end +end + +exports('setRadioTalkAnim', setRadioTalkAnim) + RegisterCommand('-radiotalk', function() if radioChannel > 0 and radioPressed then radioPressed = false From d7150f32df45b4f645bbbb3d518b5995aa37f75e Mon Sep 17 00:00:00 2001 From: Swellington Soares <145943214+Swellington-Soares@users.noreply.github.com> Date: Thu, 3 Oct 2024 05:46:24 -0300 Subject: [PATCH 2/3] Update client/module/radio.lua Co-authored-by: Dillon Skaggs --- client/module/radio.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/client/module/radio.lua b/client/module/radio.lua index 5543d08..b84c4fb 100644 --- a/client/module/radio.lua +++ b/client/module/radio.lua @@ -236,10 +236,12 @@ RegisterCommand('+radiotalk', function() end, false) local function setRadioTalkAnim(dict, name) - if dict and name then - radioAnim.dict = dict - radioAnim.name = name - end + type_check({dict, "string"}, {name, "string"}) + if not DoesAnimDictExist(dict) then + return error(("Dict: %s did not exist"):format(dict)) + end + radioAnim.dict = dict + radioAnim.name = name end exports('setRadioTalkAnim', setRadioTalkAnim) From 79ace795d1de18274232fa51fbf47bd32f4885e6 Mon Sep 17 00:00:00 2001 From: Swellington Soares <145943214+Swellington-Soares@users.noreply.github.com> Date: Thu, 10 Oct 2024 14:52:33 -0300 Subject: [PATCH 3/3] Update radio.lua removed anim dict correctly --- client/module/radio.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/module/radio.lua b/client/module/radio.lua index b84c4fb..1eb5700 100644 --- a/client/module/radio.lua +++ b/client/module/radio.lua @@ -226,7 +226,7 @@ RegisterCommand('+radiotalk', function() ExecuteCommand("-radiotalk") end if shouldPlayAnimation then - RemoveAnimDict('random@arrests') + RemoveAnimDict(radioAnim.dict) end end) else