Atenção: Esse código requer certo conhecimento de desenvolvimento, por não estar 100% completa a parte de configuração, sendo necessários pequenos ajustes, de acordo com o uso
-- Ambos os eventos devem ser executados no lado client
RegisterNetEvent(
"QBCore:Client:OnPlayerLoaded",
function()
for weapon, modifier in pairs(Config.WeaponDamage.Damages) do
SetWeaponDamageModifier(weapon, modifier)
end
end
)
AddEventHandler(
"gameEventTriggered",
function(name, args)
if name ~= "CEventNetworkEntityDamage" then
return
end -- If a player was not damaged, then return, we don't need it.
local victim, ped = args[1], PlayerPedId()
if ped == victim then
local boneHit, whatBone = GetPedLastDamageBone(ped)
if boneHit and whatBone == 31086 and Config.WeaponDamage.DisableHitKill then
SetPedSuffersCriticalHits(ped, false)
end
end
end
)
--Aqui é a configuração dos danos
WeaponDamage = {
Damages = {
-- [PISTOLAS]
-- ["WEAPON_PISTOL_MK2"] = 1.5, -- DPDC GLOCK 7'
-- ["WEAPON_COMBATPISTOL"] = 0.1, -- FIVE 9'
-- ["WEAPON_SNSPISTOL_MK2"] = 1.1, -- CIVIL 10'
-- [SUB METRALHADORAS]
-- ["WEAPON_SMG"] = 1.2, -- DPDC MP5 12'
-- ["WEAPON_MICROSMG"] = 1.0, -- MICRO UZI 14'
-- [COMPACTAS]
-- ["WEAPON_BULLPUPRIFLE"] = 1.2, -- DPDC AUG 9'
-- ["WEAPON_COMPACTRIFLE"] = 0.8, -- AKS 12'
-- --[FUZIS]
-- ["WEAPON_SPECIALCARBINE"] = 1.0, -- DPDC PARAFAL 10'
-- ["WEAPON_ASSAULTRIFLE_MK2"] = 0.7, -- AK47 12'
-- [ARMAS BRANCAS]
-- ["WEAPON_SWITCHBLADE"] = 0.3, -- CANIVETE
-- ["WEAPON_KNIFE"] = 0.3, -- FACA
-- ["WEAPON_HATCHET"] = 0.3, -- MACHADO
-- ["WEAPON_MACHETE"] = 0.3, -- MACHETE
-- ["WEAPON_HAMMER"] = 0.3, -- MARTELO
-- ["WEAPON_KNUCKLE"] = 0.2, -- SOCO INGLÊS
-- ["WEAPON_BAT"] = 0.4, -- TACO DE BASEBALL
-- ["WEAPON_GOLFCLUB"] = 0.4, -- TACO DE GOLF
-- ["WEAPON_POOLCUE"] = 0.2, -- TACO DE SINUCA (não muda dano)
["WEAPON_NIGHTSTICK"] = 0.0, -- CASSETETE (não muda dano)
["WEAPON_WRENCH"] = 0.0, -- GRIFO MECÂNICO
-- ["WEAPON_FLASHLIGHT"] = 0.2, -- LANTERNA
-- [SOCO]
["WEAPON_UNARMED"] = 0.5,
--[PAINTBALL]
-- ['weapon_paintball'] = 0.0
},
DisableHitKill = false,
},
Adaptem ao código de vocês. Esse tipo de coisa eu costumo criar um resource nomeado como tweaks ou smallresourcese adicionar nele, pra ficar fácil de achar e organizado.