Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added an export function to allow changing the default animation. #487

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions client/module/radio.lua
Original file line number Diff line number Diff line change
@@ -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()
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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
Swellington-Soares marked this conversation as resolved.
Show resolved Hide resolved
end

exports('setRadioTalkAnim', setRadioTalkAnim)

RegisterCommand('-radiotalk', function()
if radioChannel > 0 and radioPressed then
radioPressed = false
Expand Down