Double animation for PMA-VOICE
Double animation for PMA-VOICE Code is accessible Yes Subscription-based No Support Yes Hello, I’ve been looking for a script to use a dual animation for pma-voice for a long time, and I decided to modify it myself. Here I’ll show you how to add a command to switch between...
forum.cfx.re
这里我将向您展示如何添加在动画之间切换的命令。
转到client/module/radio.lua并在代码开头添加此行:
lua:
local currentRadioAnim = 'default'
然后,在您想要的任何位置添加此命令:
lua:
RegisterCommand('changeradioanim', function()
if currentRadioAnim == 'default' then
currentRadioAnim = 'alternative'
else
currentRadioAnim = 'default'
end
end)
TriggerEvent('chat:addSuggestion', '/changeradioanim', 'Switch the radio animation with this command.')
现在,用这个其他命令替换+radiotalk命令:
lua:
RegisterCommand('+radiotalk', function()
if GetConvarInt('voice_enableRadios', 1) ~= 1 then return end
if isDead() then return end
if not radioPressed and radioEnabled then
if radioChannel > 0 then
logger.info('[radio] Start broadcasting, update targets and notify server.')
playerTargets(radioData, MumbleIsPlayerTalking(PlayerId()) and callData or {})
TriggerServerEvent('pma-voice:setTalkingOnRadio', true)
radioPressed = true
playMicClicks(true)
if GetConvarInt('voice_enableRadioAnim', 0) == 1 and not (GetConvarInt('voice_disableVehicleRadioAnim', 0) == 1 and IsPedInAnyVehicle(PlayerPedId(), false)) then
if not disableRadioAnim then
if currentRadioAnim == 'default' then
RequestAnimDict('random@arrests')
while not HasAnimDictLoaded('random@arrests') do
Citizen.Wait(10)
end
TaskPlayAnim(PlayerPedId(), "random@arrests", "generic_radio_chatter", 8.0, 2.0, -1, 50, 2.0, 0, 0, 0)
elseif currentRadioAnim == 'alternative' then
RequestAnimDict('cellphone@')
while not HasAnimDictLoaded('cellphone@') do
Citizen.Wait(10)
end
TaskPlayAnim(PlayerPedId(), "cellphone@", "cellphone_call_listen_base", 8.0, 2.0, -1, 50, 2.0, 0, 0, 0)
end
end
end
Citizen.CreateThread(function()
TriggerEvent("pma-voice:radioActive", true)
while radioPressed do
Wait(0)
SetControlNormal(0, 249, 1.0)
SetControlNormal(1, 249, 1.0)
SetControlNormal(2, 249, 1.0)
end
end)
end
end
end, false)
最后,将+radiotalk命令替换为:
lua:
RegisterCommand('-radiotalk', function()
if radioChannel > 0 or radioEnabled and radioPressed then
radioPressed = false
MumbleClearVoiceTargetPlayers(voiceTarget)
playerTargets(MumbleIsPlayerTalking(PlayerId()) and callData or {})
TriggerEvent("pma-voice:radioActive", false)
playMicClicks(false)
if GetConvarInt('voice_enableRadioAnim', 0) == 1 then
if currentRadioAnim == 'default' then
StopAnimTask(PlayerPedId(), "random@arrests", "generic_radio_chatter", -4.0)
elseif currentRadioAnim == 'alternative' then
StopAnimTask(PlayerPedId(), "cellphone@", "cellphone_call_listen_base", -4.0)
end
end
TriggerServerEvent('pma-voice:setTalkingOnRadio', false)
end
end, false)
现在,当你连接到收音机并使用/changeradio 命令时,动画将从手臂切换到手机,反之亦然。
Github:https://github.com/nebula0366
下载(Github):pma-voice
直接下载链接:
pma-voice.zip (383.2 KB)