π«Weapon Cleaning Animation
β‘ Getting Started
Be sure to read the README file for full setup instructions!
β Cleaning a Weapon
You can clean a weapon with any of these methods:
With an Inventory Item
Use the item "gunoil"
or any other defined in your inventory system.
Client-side Event
TriggerEvent("Botiv:cleanWeapon")
Command (if enabled)
Type in chat:
/cleanwp
Server-side Event
TriggerClientEvent("Botiv:cleanWeapon", source)
Inventory Integration Examples
VORP Example
-- For older VORP Inventory:
local VorpInv = exports.vorp_inventory:vorp_inventoryApi()
VorpInv.RegisterUsableItem("gunoil", function(data)
TriggerClientEvent("Botiv:cleanWeapon", data.source)
end)
RegisterServerEvent("botiv-wpClean:itemUsed")
AddEventHandler("botiv-wpClean:itemUsed", function(used)
if used then
VorpInv.subItem(source, "gunoil", 1)
end
end)
-- For newer VORP Inventory (using the export functions):
exports.vorp_inventory:registerUsableItem("gunoil", function(data)
TriggerClientEvent("Botiv:cleanWeapon", data.source)
end, GetCurrentResourceName())
RegisterServerEvent("botiv-wpClean:itemUsed")
AddEventHandler("botiv-wpClean:itemUsed", function(used)
if used then
exports.vorp_inventory:subItem(source, "gunoil", 1)
end
end)
RedEM Example
RegisterServerEvent("RegisterUsableItem:gunoil")
AddEventHandler("RegisterUsableItem:gunoil", function(source)
TriggerClientEvent("Botiv:cleanWeapon", source)
end)
local data = {}
TriggerEvent("redemrp_inventory:getData", function(call)
data = call
end)
RegisterServerEvent("botiv-wpClean:itemUsed")
AddEventHandler("botiv-wpClean:itemUsed", function(used)
if used then
local ItemData = data.getItem(source, 'gunoil')
ItemData.RemoveItem(1)
end
end)
βοΈ Configuration Example (config.lua
)
config.lua
)Config = {
-- Enable the /cleanwp command
enable_command = true,
botiv_clean_cmd = "cleanwp", -- Command name
enable_client_side = true, -- Enable client-side event call
bt_c_function = 'Botiv:cleanWeapon' -- Client event to trigger
}
Note: If you want to trigger cleaning with your own system, remove lines 14-28 from
client.lua
to disable the default triggers.
π Notes
Flexible Cleaning: Weapons can be cleaned via inventory item, command, client/server events, or direct integration.
Configurable: Change the command name, event, or disable automatic triggers easily in
config.lua
.Supports VORP & RedEM: Examples for both major RedM inventory frameworks.
No restart needed: Any change to
config.lua
is applied instantly on resource restart.Multilingual: Interface and prompts can be adapted to your language.
Last updated