- Katılım
- 4 yıl 6 ay 9 gün
- Mesajlar
- 57
- Discord
- Supramex Fi#9812
qb-inventoryv2 kulalnıyorum arkadaşlar silahın durabilitysi çok yavaş azalıyor bunu nasıl hızlandırırım bilen varmı durability ait bulduğum kod bu rakamları değiştim bişey etki etmedi
RegisterNetEvent("inventory:client:UseWeapon")
AddEventHandler("inventory:client:UseWeapon", function(weaponData, time)
local playerPed = PlayerPedId()
local durubality = 1
if weaponData.info.durubality then
local date = weaponData.info.durubality + 604800
local durubality_frist = (date - time) / (60 * 60 * 24)
durubality = 100 - ((7 - durubality_frist)*20)
end
if durubality > 0 then
local weaponName = tostring(weaponData.name)
local hash = GetHashKey(weaponName)
if hash ~= -1569615261 then
local _,wep = GetCurrentPedWeapon(playerPed)
if wep == hash then
RemoveAllPedWeapons(playerPed, true)
SetCurrentPedWeapon(PlayerPedId(), `WEAPON_UNARMED`, true)
RemoveAllPedWeapons(PlayerPedId(), true)
TriggerEvent('weapons:client:SetCurrentWeapon', nil)
currentWeapon = nil
elseif weaponName == "weapon_stickybomb" then
QBCore.Functions.Notify("Atalarımız sağ olsun artık bunu elimize alamıyoruz", "error", 15000)
elseif weaponName == "weapon_molotov" or weaponName == "weapon_flare" then
RemoveAllPedWeapons(playerPed, true)
GiveWeaponToPed(PlayerPedId(), hash, ammo, false, false)
SetPedAmmo(PlayerPedId(), hash, 1)
SetCurrentPedWeapon(PlayerPedId(), hash, true)
TriggerEvent('weapons:client:SetCurrentWeapon', weaponData)
TriggerServerEvent('QBCore:Server:RemoveItem', weaponName, 1)
currentWeapon = weaponName
elseif weaponName == "weapon_snowball" then
RemoveAllPedWeapons(playerPed, true)
GiveWeaponToPed(PlayerPedId(), hash, ammo, false, false)
SetPedAmmo(PlayerPedId(), hash, 10)
SetCurrentPedWeapon(PlayerPedId(), hash, true)
TriggerServerEvent('QBCore:Server:RemoveItem', weaponName, 1)
TriggerEvent('weapons:client:SetCurrentWeapon', weaponData)
currentWeapon = weaponName
else
TriggerEvent("weapon:server:GetWeaponAmmo", function(result)
local ammo = tonumber(result)
if weaponName == "weapon_petrolcan" or weaponName == "weapon_fireextinguisher" then ammo = 4000 end
RemoveAllPedWeapons(playerPed, true)
GiveWeaponToPed(PlayerPedId(), hash, ammo, false, false)
SetPedAmmo(PlayerPedId(), hash, ammo)
SetCurrentPedWeapon(PlayerPedId(), hash, true)
if weaponData.info.attachments ~= nil then
for _, attachment in pairs(weaponData.info.attachments) do
GiveWeaponComponentToPed(PlayerPedId(), hash, GetHashKey(attachment.component))
end
end
TriggerEvent('weapons:client:SetCurrentWeapon', weaponData)
currentWeapon = weaponName
end, QBCore.Shared.Items[weaponName]["ammotype"])
end
elseif weaponName == "weapon_stickybomb" then
QBCore.Functions.Notify("Atalarımız sağ olsun artık bunu elimize alamıyoruz", "error", 15000)
elseif weaponName == "weapon_molotov" or weaponName == "weapon_flare" then
RemoveAllPedWeapons(playerPed, true)
GiveWeaponToPed(PlayerPedId(), hash, ammo, false, false)
SetPedAmmo(PlayerPedId(), hash, 1)
SetCurrentPedWeapon(PlayerPedId(), hash, true)
TriggerEvent('weapons:client:SetCurrentWeapon', weaponData)
TriggerServerEvent('QBCore:Server:RemoveItem', weaponName, 1)
currentWeapon = weaponName
else
TriggerEvent("weapon:server:GetWeaponAmmo", function(result)
local ammo = tonumber(result)
if weaponName == "weapon_petrolcan" or weaponName == "weapon_fireextinguisher" then ammo = 4000 end
RemoveAllPedWeapons(playerPed, true)
GiveWeaponToPed(PlayerPedId(), hash, ammo, false, false)
SetPedAmmo(PlayerPedId(), hash, ammo)
SetCurrentPedWeapon(PlayerPedId(), hash, true)
if weaponData.info.attachments ~= nil then
for _, attachment in pairs(weaponData.info.attachments) do
GiveWeaponComponentToPed(PlayerPedId(), hash, GetHashKey(attachment.component))
end
end
currentWeapon = weaponName
TriggerEvent('weapons:client:SetCurrentWeapon', weaponData)
end, QBCore.Shared.Items[weaponName]["ammotype"])
end
else
QBCore.Functions.Notify("Bu Silah Kullanılamayacak Kadar Kötü Durumda", "error")
end
end)
RegisterNetEvent("inventory:client:UseWeapon")
AddEventHandler("inventory:client:UseWeapon", function(weaponData, time)
local playerPed = PlayerPedId()
local durubality = 1
if weaponData.info.durubality then
local date = weaponData.info.durubality + 604800
local durubality_frist = (date - time) / (60 * 60 * 24)
durubality = 100 - ((7 - durubality_frist)*20)
end
if durubality > 0 then
local weaponName = tostring(weaponData.name)
local hash = GetHashKey(weaponName)
if hash ~= -1569615261 then
local _,wep = GetCurrentPedWeapon(playerPed)
if wep == hash then
RemoveAllPedWeapons(playerPed, true)
SetCurrentPedWeapon(PlayerPedId(), `WEAPON_UNARMED`, true)
RemoveAllPedWeapons(PlayerPedId(), true)
TriggerEvent('weapons:client:SetCurrentWeapon', nil)
currentWeapon = nil
elseif weaponName == "weapon_stickybomb" then
QBCore.Functions.Notify("Atalarımız sağ olsun artık bunu elimize alamıyoruz", "error", 15000)
elseif weaponName == "weapon_molotov" or weaponName == "weapon_flare" then
RemoveAllPedWeapons(playerPed, true)
GiveWeaponToPed(PlayerPedId(), hash, ammo, false, false)
SetPedAmmo(PlayerPedId(), hash, 1)
SetCurrentPedWeapon(PlayerPedId(), hash, true)
TriggerEvent('weapons:client:SetCurrentWeapon', weaponData)
TriggerServerEvent('QBCore:Server:RemoveItem', weaponName, 1)
currentWeapon = weaponName
elseif weaponName == "weapon_snowball" then
RemoveAllPedWeapons(playerPed, true)
GiveWeaponToPed(PlayerPedId(), hash, ammo, false, false)
SetPedAmmo(PlayerPedId(), hash, 10)
SetCurrentPedWeapon(PlayerPedId(), hash, true)
TriggerServerEvent('QBCore:Server:RemoveItem', weaponName, 1)
TriggerEvent('weapons:client:SetCurrentWeapon', weaponData)
currentWeapon = weaponName
else
TriggerEvent("weapon:server:GetWeaponAmmo", function(result)
local ammo = tonumber(result)
if weaponName == "weapon_petrolcan" or weaponName == "weapon_fireextinguisher" then ammo = 4000 end
RemoveAllPedWeapons(playerPed, true)
GiveWeaponToPed(PlayerPedId(), hash, ammo, false, false)
SetPedAmmo(PlayerPedId(), hash, ammo)
SetCurrentPedWeapon(PlayerPedId(), hash, true)
if weaponData.info.attachments ~= nil then
for _, attachment in pairs(weaponData.info.attachments) do
GiveWeaponComponentToPed(PlayerPedId(), hash, GetHashKey(attachment.component))
end
end
TriggerEvent('weapons:client:SetCurrentWeapon', weaponData)
currentWeapon = weaponName
end, QBCore.Shared.Items[weaponName]["ammotype"])
end
elseif weaponName == "weapon_stickybomb" then
QBCore.Functions.Notify("Atalarımız sağ olsun artık bunu elimize alamıyoruz", "error", 15000)
elseif weaponName == "weapon_molotov" or weaponName == "weapon_flare" then
RemoveAllPedWeapons(playerPed, true)
GiveWeaponToPed(PlayerPedId(), hash, ammo, false, false)
SetPedAmmo(PlayerPedId(), hash, 1)
SetCurrentPedWeapon(PlayerPedId(), hash, true)
TriggerEvent('weapons:client:SetCurrentWeapon', weaponData)
TriggerServerEvent('QBCore:Server:RemoveItem', weaponName, 1)
currentWeapon = weaponName
else
TriggerEvent("weapon:server:GetWeaponAmmo", function(result)
local ammo = tonumber(result)
if weaponName == "weapon_petrolcan" or weaponName == "weapon_fireextinguisher" then ammo = 4000 end
RemoveAllPedWeapons(playerPed, true)
GiveWeaponToPed(PlayerPedId(), hash, ammo, false, false)
SetPedAmmo(PlayerPedId(), hash, ammo)
SetCurrentPedWeapon(PlayerPedId(), hash, true)
if weaponData.info.attachments ~= nil then
for _, attachment in pairs(weaponData.info.attachments) do
GiveWeaponComponentToPed(PlayerPedId(), hash, GetHashKey(attachment.component))
end
end
currentWeapon = weaponName
TriggerEvent('weapons:client:SetCurrentWeapon', weaponData)
end, QBCore.Shared.Items[weaponName]["ammotype"])
end
else
QBCore.Functions.Notify("Bu Silah Kullanılamayacak Kadar Kötü Durumda", "error")
end
end)