I’m creating a script and I was able to define when the player wears the armor item, run a progress bar along with animation and after the vest appears, everything works perfect. But I would like to add one more function when the armor goes back to 0 the vest disappears, I am using the native SetPedComponentVariation
This is the function that adds the vest to the player, it works as I said before. I’m new to fivem so I don’t know if it’s the best way to do that
And this is the function that should remove the vest, but it doesn’t work, or it removes the vest when I put it on
Before anything always try print(“test”) when you’re testing something if it works. As I see in your screenshot you have loop for checking if ped has armor. This might be causing some troubles. Im not perfect in LUA too but you should also try this:
Citizen.CreateThread(function()
while true do
local ped = GetPlayerPed(-1)
local armor = GetPedArmour(ped)
Citizen.Wait(3000)
if armor >= 10 then
TriggerEvent('removevest') -- RegisterNetEvent first
else
return
end
end
end)
Im Not sure it this won’t cause any troubles with native 0x2F7A49E6 but you can try. Also I see you have 6 parameters in Thread instead of 5 so Maybe this is also causing troubles.
And I will add that my solution might not work, but hey! I tried
Thanks for the answer, but getting it to work, and it was easier than I thought, hahahaha
1 Like
One parameter and script is not working same with ==. I love and hate LUA at the same time. Happy to see you got this working fine.
Cheers!
After playing with vests I decided to go for clothes, my uniforms are now items hahahaha
2 Likes
hey, by any means do you know the name of the animation?
nice do you relase this ?