Neler yeni

Foruma hoş geldin, Ziyaretçi

Forum içeriğine ve tüm hizmetlerimize erişim sağlamak için foruma kayıt olmalı ya da giriş yapmalısınız. Foruma üye olmak tamamen ücretsizdir.

Türkiye'nin İlk ve tek FiveM forum adresi

Forum adresimize hoş geldin FiveMTürk olarak amacımız siz değerli kullanıcılarımıza en aktif fikir ve paylaşım platformu sunmak bir yana en güvenilir şekilde alışveriş yapabileceğiniz bir platform sunmaktır.
DF DF
DF DF
DF DF

Soru qb-inventoryv2 silahın durabilty'sini hızlı düşürme

SupramexFi

Üye
FT Kullanıcı
Katılım
3 yıl 11 ay 6 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)
 
DF
.
 
DF
Son düzenleme:
kodun tamamını bilmiyorum da attığına göre en üstteki matematiksel işlemlerin bir çoğuna göre hızlandırabilirsin

örnek olarak;
72429
durubality değişkenindeki *20 değerini arttırırsan daha hızlı azalır.
javascript tarafında da aynı değişikliği yapmayı unutma görüntü bug'ı olmasın
 
DF
??????????#9812 Arkadaş eklerseniz yayın açabilirim tam bilgim yok farklı scriptlede alakalı olabilir
 
DF

Forumdan daha fazla yararlanmak için giriş yapın yada üye olun!

Forumdan daha fazla yararlanmak için giriş yapın veya kayıt olun!

Kayıt ol

Forumda bir hesap oluşturmak tamamen ücretsizdir.

Şimdi kayıt ol
Giriş yap

Eğer bir hesabınız var ise lütfen giriş yapın

Giriş yap

Bu konuyu görüntüleyen kullanıcılar

Tema düzenleyici

Tema özelletirmeleri

Granit arka planlar

Lütfen Javascript'i etkinleştirin!Javascript'i etkinleştirin!