Armor script [esx] [free]

I’ve just made an armor script for a friend and decided to release it to the public. This script has two sets of armor, a 50% that adds 50% of armor when used, The other is a 100% armor and will give you full armor on use, at the moment this script is an esx script I plan on making it compatable with most other frameworks like QB VRP ect. Please let me know if you find any bugs or anything that I can add to make my script any better. I DO NOT CARE IF YOU SHARE THIS SCRIPT WITH FRIENDS BUT DO NOT CLAIM OWNERSHIP OR TRY TO SELL MY SCRIPT!

1.0.1 ChangeLogs
Fixed where it wasn’t showing notification on use.
Took out “setpedarmor” and changed it to “addarmortoped”.

3 Likes

Doesn’t this already exist?

1 Like

I couldn’t find anything else on armor being the reason I made it, but if there is do let me know.

1 Like

Like this one?

Or this one?

Or this one?

Or this one?

Your entire “script” can be done like this;

server.lua

ESX = nil

TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)

ESX.RegisterUsableItem('bulletproof', function(source)
	local xPlayer = ESX.GetPlayerFromId(source)
	xPlayer.removeInventoryItem('bulletproof', 1)
	TriggerClientEvent('armor:addArmor', source, 100)
end)

ESX.RegisterUsableItem('bulletproof50', function(source)
	local xPlayer = ESX.GetPlayerFromId(source)
	xPlayer.removeInventoryItem('bulletproof50', 1)
	TriggerClientEvent('armor:addArmor', source, 50)
end)

client.lua

RegisterNetEvent('armor:addArmor')
AddEventHandler('armor:addArmor', function(amount)
	AddArmourToPed(GetPlayerPed(-1), amount)
end)

You have a config file for an English locale and a locale file for translations of using the armour, but you didn’t even include a notification that calls the translations. So there’s no point to those. Plus you added different events for different armour amounts when the amount can be passed as a parameter instead. AND you had it add armour to the ped, then set the ped armour. No point in doing both…

Not only has your “script” been done many times before, it’s been done far better every time. I suggest you send your friend a better version than the one you made, full of redundancies.

1 Like

Ok thanks for finding them and I even just looked them up the names of those files and they wouldnt show up I’ve ran into this issue with not being able to find something unless someone sends me the link thank you for that and I will let him know about these!

good idea

PlayerPedId() better than GetPlayerPed(-1)

:joy: i am just jokingg

1 Like

So there is a way to do this but there is one downfall with it when you die the armor stays on your players body and cant be removed but I will look into it

And the only way from what I know about applying armor with a keybind is depending on your inventory hud.

Update 1.0.1 is out Fixed Notification issue.

1 Like

Thank you very much

1 Like

No Problem just let me know what I can fix or add.

um sorry but i used your “correct” code and it doesnt work to make armor as an item…