Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
8 changes: 8 additions & 0 deletions client/event.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ end)
AddEventHandler('onResourceStop', function(resource)
if GetCurrentResourceName() == resource then
Radio:toggleRadioAnimation(false)
Radio:toggleRadioAnimationTalk(false)
Radio:RemoveJammerZone()
if Radio.onRadio then
Radio:leaveradio()
Expand Down Expand Up @@ -213,6 +214,13 @@ RegisterNetEvent("pma-voice:radioActive", function(talkingState)
radioId = tostring(Radio.playerServerID),
radioTalking = talkingState
})

-- Show radio prop when talking (if not already using radio UI)
if talkingState and not Radio.usingRadio and Radio.onRadio then
Radio:toggleRadioAnimationTalk(true)
elseif not talkingState and not Radio.usingRadio then
Radio:toggleRadioAnimationTalk(false)
end
end)

RegisterNetEvent("pma-voice:setTalkingOnRadio", function(source, talkingState)
Expand Down
14 changes: 14 additions & 0 deletions client/function.lua
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,20 @@ function Radio:toggleRadioAnimation(pState)
end
end

function Radio:toggleRadioAnimationTalk(pState)
if pState then
-- Only attach radio prop for talking, no animation
self.radioTalkProp = CreateObject(`prop_cs_hand_radio`, 1.0, 1.0, 1.0, true, true, false)
AttachEntityToEntity(self.radioTalkProp, cache.ped, GetPedBoneIndex(cache.ped, 60309), 0.0750, 0.0230, -0.0230, -90.0000, 0.0, -59.9999, true, false, false, false, 2, true)
else
-- Remove radio prop when done talking
if self.radioTalkProp ~= 0 then
DeleteObject(self.radioTalkProp)
self.radioTalkProp = 0
end
end
end

function Radio:CalculateTimeToDisplay()
local hour = GetClockHours()
local minute = GetClockMinutes()
Expand Down
1 change: 1 addition & 0 deletions client/interface.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Radio = {
usingRadio = false,
RadioChannel = 0,
radioProp = 0,
radioTalkProp = 0,
Volume = 30,
favourite = {},
recomended = {},
Expand Down