ScriptsM GunJamming
This simple script will add a gun jamming, weapon clean items to increase their durability and decrease jam chance.
Installation
Download a resource (opens in a new tab) from keymaster or buy it by buttons at the top
Install all resource dependencies
Set up the InteractSound (opens in a new tab)
To get sounds working, you need to install sound files from zip archive following this guide:
- Add weaponjam.ogg and cleanwep.ogg from zip archive to InteractSound/client/html/sounds
- Open __resource.lua and modify following portion:
files({
'client/html/index.html',
-- Begin Sound Files Here...
-- client/html/sounds/ ... .ogg
...
})
- Now you are done with sounds
Resource start order
It's important for your resources to start in a logical order to prevent errors from missing dependencies.
start ox_inventory
start InteractSound
start GunJamming
Add an weapon clean kit to ox_inventory
-
Put cleankit.png to ox_inventory/web/images
-
Go to data/items.lua and add this code:
['cleankit'] = {
label = 'Weapon clean kit',
description = 'A weapon clean kit',
weight = 300,
stack = true,
allowArmed = true,
client = {
cancel = true,
}
},
Config
There you can find an config of resource with description for all params
Config = {}
Config.ChanceMultiplier = 1 -- Jam chance multiplier
Config.AnimationRepairJam = { -- Animation of fixing jam
dict = 'nmt_3_rcm-10',
anim = 'cs_nigel_dual-10'
}
Config.AnimationCleanWep = { -- Animation of weapon cleaning
dict = 'nmt_3_rcm-10',
anim = 'cs_nigel_dual-10'
}
Config.RepairProgressBar = function() -- Progress bar export for fixing gun jam
exports.rprogress:Start("Fixing the jamming", 7500)
end
Config.CleanProgressBar = function() -- Progress bar export for weapon cleaning
exports.rprogress:Start("Cleaning weapon", 9500)
end
Config.RepairPersistNotify = function() -- Here you need to put your export for fix jam hotkey notification
exports['t-notify']:Persist({
id = 'wedgenotify',
step = 'start',
options = {
style = 'message',
title = 'The weapon is jammed',
message = "Repair [E]",
sound = true
}
})
end
Config.RepairPersistNotifyEnd = function() -- Here you need to put your export for event when player ending fixing jam and ending persistant hotkey help notification
exports['t-notify']:Persist({
id = 'wedgenotify',
step = 'end'
})
end
Config.WeaponIsRepairedMaximum = function() -- Here you need to put your export for event when player wanna fix 100% durability weapon
exports['t-notify']:Alert({
style = 'error',
message = 'Your weapon is already repaired',
duration = 5500
})
end
Config.NotHoldingWeapon = function() -- Here you need to put your export for event when player not holding weapon but wanna to clean it
exports['t-notify']:Alert({
style = 'error',
message = 'You are not holding any weapon in hands to clean',
duration = 5500
})
end