[ESX] Usable Armour as items (With Tiers, Sound effects and Animation)

Simple armour script for ESX that comes with the following as usable items:

  • Light Armour (25/100)
  • Medium Armour (50/100)
  • Heavy Armour (75/100)
  • Military Armour (100/100)

It plays a sound and animation when armour is applied to your character and if they die it will remove the armour. I am working on the script recognising female/male peds so the vest varients are the same. It still works for now though.

This is my first release so please let me know if I can improve the script in anyway or if I could optimise it.

GITHUB Download: HERE

Video Preview: HERE

Update - Edited the client.lua to sync vests between male/female peds you can fiddle with the colours by editing this:

SetPedComponentVariation(player, 9, 1, X, 2)

Change the ā€œXā€ to a number between 0-5 to mess with the colours

2 Likes

Video Private…

Good work, Doyle!
I’ll test and get back to you on any improvements.

1 Like

Updated

why, when i use item vest… at body no have vest show

It’s because of vests have different numbers on female peds. Can you change your ped to male and just double check its installed correctly.

I am currently working on a fix for female peds atm.

Here is an updated client.lua that syncs the vests for Male and Female Peds!

client.lua (3.0 KB)

ok i try back

1 Like

Let me know of any issues :slight_smile:

is work … ped male and ped female

1 Like

Great!

Glad it works - Enjoy mate.

1 Like

Nice Release :smiling_face_with_three_hearts:

I think you should add a few more features.

  • Save player data (health & armor) when they exit the game
  • Save player data (health & armor) every 10 minutes.
  • Retrieve the player data (health & armor) when they re-enter the server.

Thanks :smiley:

2 Likes

My inital thought was to take a look at the esx_ambulancejob as it has a ā€œanti-combatlogā€ feature that checks if a player should be dead upon re-entering the server

BUT

I saw this on the forums which I think will do the same job (here)

Using that script you can probably do something on the lines of this for a player joined (probably will not work as ive not tested but you get the idea of it). Obviously credits go out to the original creator of that script.

RegisterNetEvent(ā€˜LRP-Armour:Client:SetPlayerHealthArmour’)
AddEventHandler(ā€˜LRP-Armour:Client:SetPlayerHealthArmour’, function(health, armour)
ESX.SetTimeout(5000, function()
SetEntityHealth(PlayerPedId(), tonumber(health))
SetPedArmour(PlayerPedId(), tonumber(armour))
citizensave = true

  if tonumber(armour) <= 25 then
  TriggerClientEvent('D2D-Armor:Light', source)
  
  elseif tonumber(armour) > 25 or <= 50 then
  TriggerClientEvent('D2D-Armor:Medium', source)
  
  elseif tonumber(armour) > 50 or <= 75 then
  TriggerClientEvent('D2D-Armor:Heavy', source)
  
  elseif tonumber(armour) > 75 or <= 100 then
  TriggerClientEvent('D2D-Armor:Military', source)
end)

end)

1 Like

this want put where sir ? client.lua or server.lua ?

1 Like

I will test it all works first and then get back to you :melting_face:

ok thank you u sir

Send you a pull request and maybe u can delete the loop :smiley:

1 Like

Yeah just saw it!

Didn’t think of doing it that way and just updating it now, thanks for your help!

1 Like

hi now if u use the item its turning your bodyvest on can u maybe add a option that if u click again its turns the body vest off when you finished with your scenarion should be really nice ! or u have the code for it