Armor Vest Script for ESX
This script adds support for using various armor vests in your ESX-based FiveM server. Players can equip different types of armor vests, which provide armor benefits and can be customized through a configuration file. The script allows for easy integration and management of these vests within the ESX framework.
Features
- Multiple Armor Vests: Define and manage multiple types of armor vests with different properties.
- Customizable Configuration: Easily adjust the appearance, armor value, and other parameters of each vest through the configuration file.
- Animation Support: Play a custom animation when equipping a vest.
- Dynamic Armor Application: Automatically update the player’s armor value based on the vest equipped.
- Threshold-Based Item Removal: Automatically remove the vest from inventory if the player’s armor value reaches a specified threshold.
Download
You can download the script here: ThePistonCraft/ec_proof (github.com)
Installation
-
Download the Script:
Download the script files and place them in a new folder within your FiveM resources directory. -
Add to Server Configuration:
Add the following line to yourserver.cfg
to ensure the script is loaded:ensure your_script_folder_name
-
Configuration:
Edit the config.lua file to add or customize vests as per your requirements.
Example Configuration (config.lua)
Config = {}
Config.Anim = 'try_tie_positive_a' -- Animation to play when putting on the vest
Config.Vests = {
{
itemName = 'pd_vest', -- Item name to be used in the inventory
armourValue = 100, -- Amount of armour the vest provides
bproof_1 = 50, -- Appearance parameter 1 for the vest
bproof_2 = 0 -- Appearance parameter 2 for the vest
},
{
itemName = 'kevlar_vest',
armourValue = 100,
bproof_1 = 4,
bproof_2 = 0
}
}
Config.RemoveItemThreshold = 75 -- Percentage threshold of armour remaining to remove the item from inventory
-- ESX Export
Config.ESXExport = function()
ESX = exports["es_extended"]:getSharedObject()
end
Adding a New Vest
To add a new vest to the script, follow these steps:
-
Open config.lua:
Open the config.lua file in a text editor. -
Add a New Vest Entry:
Add a new table entry within the Config.Vests table with the desired parameters. For example:{ itemName = 'new_vest', -- Unique item name armourValue = 80, -- Amount of armour provided bproof_1 = 10, -- Appearance parameter 1 bproof_2 = 5 -- Appearance parameter 2 }
Example
Here is a complete example of adding a new vest:
Config.Vests = {
{
itemName = 'pd_vest',
armourValue = 100,
bproof_1 = 50,
bproof_2 = 0
},
{
itemName = 'kevlar_vest',
armourValue = 100,
bproof_1 = 4,
bproof_2 = 0
},
{
itemName = 'new_vest',
armourValue = 80,
bproof_1 = 10,
bproof_2 = 5
}
}
Usage
- Give Item to Player:
Use the ESX command to give the vest item to a player. For example:/giveitem [playerID] new_vest 1
- Using the Vest:
The player can use the vest item from their inventory. Upon use, the vest will apply the configured armor and appearance changes.
Important Notes
- Item Integration: Ensure that the vest items (e.g., pd_vest, kevlar_vest, etc.) are either added to your database or are configured in the respective inventory system used by your server.
- Restrictions on Redistribution: Redistribution or modification of this script is not allowed. This includes, but is not limited to, distributing modified versions of the script or including it in other scripts without permission.
License
This script is provided under the MIT License. Unauthorized redistribution or modification is prohibited.
This updated README includes:
- Important Notes about integrating the item into the database or inventory.
- Restrictions on Redistribution to clarify that modifications and distribution are not permitted.