I took some code from esx_ambulancejob to fix this issue. This is just the event for small armor. Just copy+paste it three times over small, medium, and heavy. Then rename to small/medium/heavy where needed and change duration for the progress bar. Also change “Citizen.Wait(2500)” to your new duration, minus 2500.
(Not sure how to put the following between spoiler tags, so please pardon the wall of text)
RegisterNetEvent('nfw_wep:SmallArmor')
AddEventHandler('nfw_wep:SmallArmor', function()
local inventory = ESX.GetPlayerData().inventory
local lib, anim = 'rcmfanatic3', 'kneel_idle_a'
local ped = GetPlayerPed(-1)
local armor = GetPedArmour(ped)
local item = 'SmallArmor'
if(armor >= 100) or (armor+30 > 100) then
exports['mythic_notify']:SendAlert('inform', 'Your armor is already maxed!')
TriggerServerEvent('returnItem', item)
return
end
TriggerEvent('mythic_progbar:client:progress', {
name = 'smallb_armor',
duration = 5000,
label = 'Applying Light Body Armor...',
useWhileDead = false,
canCancel = false,
controlDisables = {
disableMovement = true,
disableCarMovement = true,
disableMouse = false,
disableCombat = true,
},
prop = {
model = "prop_bodyarmour_02",
}
}, function(status)
if not status then
SetPedComponentVariation(ped, 9, 10, 0, 0)
exports['mythic_notify']:SendAlert('inform', 'You have put on Light Body Armor.')
end
end)
ESX.Streaming.RequestAnimDict(lib, function()
TaskPlayAnim(ped, lib, anim, 2.0, -2.0, -1, 0, 0, false, false, false)
Citizen.Wait(2500)
TaskPlayAnim(ped, lib, anim, 2.0, -2.0, -1, 0, 0, false, false, false)
Citizen.Wait(500)
while IsEntityPlayingAnim(ped, lib, anim, 3) do
Citizen.Wait(0)
end
AddArmourToPed(ped, 30)
end)
end)