noisiv 1
noisiv
Manwe Work 1
Manwe Work
Vahsi Uzman 1
Vahsi Uzman
Bvural41 1
Bvural41
Hikaye Ekle
Kaynak ikonu

Fivem Disc Uyumlu Yeni Silah Eklentileri Script

Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...

HERAKLES Otomatik Avlı kalıcı sunucu. 19 Haziran'da açılıyor. Atius & Wizard güvencesiyle hemen kayıt ol, ön kayıt ödülleri aktif. HEMEN TIKLA!

Selamlar. Bildiğiniz üzere disc-inventoryde eklenti takılı silahınızı belinize koyup tekrar aldığınızda bile tüm silah eklentileri tamamen sıfırlanıyor. Bu konumda kendi yazdığım eklenti scriptini paylaşacağım.

Script Hakkında:
- Bu script sayesinde siz oyun severler eklenti takılı olan silahını moteline, bagajına vs. koysa bile veyahut sunucuya restart atılsa bile oyuncuların silahına takmış bulunduğu tüm eklentiler kaybolmaz.
- Takılan tüm eklentiler "/eklenticikart" komutuyla çıkarılır ve çıkarılan eklentilerin eşyaları geri iade edilmez. Yani eklentiler tek kullanımlık olmaktadırlar. İstersenizde kendiniz düzenleyebilirsiniz.






Kod:
supp1 = {-2084633992, -1357824103, 2132975508, -494615257}[/B][/CENTER]
[B][CENTER]supp2 = {-1716589765, 324215364, -270015777, -1074790547, -1063057011, -1654528753, 984333226}
supp3 = {1593441988, -771403250, 584646201, 137902532, 736523883}
supp4 = {487013001}
flash1 = {453432689, 1593441988, 584646201, -1716589765, -771403250, 324215364}
flash2 = {736523883, -270015777, 171789620, -1074790547, -2084633992, -1357824103, -1063057011, 2132975508, 487013001, -494615257, -1654528753, 984333226}
grip1 = {171789620, -1074790547, -2084633992, -1063057011, 2132975508, 2144741730, -494615257, -1654528753, 984333226}
scope1 = {-2084633992}

function GiveWeapon(weapon)
    local checkh = Config.Throwables
    local playerPed = GetPlayerPed(-1)
    local hash = GetHashKey(weapon)
    ESX.TriggerServerCallback('disc-inventoryhud:getAmmoCount', function(ammoCount, susturucu, fener, tutamac, kaplama, durbun)
        GiveWeaponToPed(playerPed, hash, 1, false, true)

        if susturucu == 1 then
            if hash == GetHashKey("WEAPON_PISTOL") then
                GiveWeaponComponentToPed(GetPlayerPed(-1), GetHashKey("WEAPON_PISTOL"), GetHashKey("component_at_pi_supp_02"))
            elseif table.includes(supp1, hash) then
                GiveWeaponComponentToPed(GetPlayerPed(-1), hash, 0x837445AA)
            elseif table.includes(supp2, hash) then
                GiveWeaponComponentToPed(GetPlayerPed(-1), hash, 0xA73D4664)
            elseif table.includes(supp3, hash) then
                GiveWeaponComponentToPed(GetPlayerPed(-1), hash, 0xC304849A)
            elseif table.includes(supp4, hash) then
                GiveWeaponComponentToPed(GetPlayerPed(-1), hash, 0xE608B35E)
            end
        end

        if fener == 1 then
            if table.includes(flash1, hash) then
                GiveWeaponComponentToPed(GetPlayerPed(-1), hash, 0x359B7AAE)
            elseif table.includes(flash2, hash) then
                GiveWeaponComponentToPed(GetPlayerPed(-1), hash, 0x7BC4CDDC)
            end
        end

        if tutamac ==  1 then
            if table.includes(grip1, hash) then
                GiveWeaponComponentToPed(GetPlayerPed(-1), hash, 0xC164F53)
            end
        end

        if kaplama == 1 then
            if hash == GetHashKey("WEAPON_PISTOL") then
                GiveWeaponComponentToPed(GetPlayerPed(-1), GetHashKey("WEAPON_PISTOL"), GetHashKey("COMPONENT_PISTOL_VARMOD_LUXE"))
            elseif hash == GetHashKey("WEAPON_PISTOL50") then
                GiveWeaponComponentToPed(GetPlayerPed(-1), GetHashKey("WEAPON_PISTOL50"), GetHashKey("COMPONENT_PISTOL50_VARMOD_LUXE"))
            elseif hash == GetHashKey("WEAPON_APPISTOL") then
                GiveWeaponComponentToPed(GetPlayerPed(-1), GetHashKey("WEAPON_APPISTOL"), GetHashKey("COMPONENT_APPISTOL_VARMOD_LUXE"))

            elseif hash == GetHashKey("WEAPON_HEAVYPISTOL") then
                GiveWeaponComponentToPed(GetPlayerPed(-1), GetHashKey("WEAPON_HEAVYPISTOL"), GetHashKey("COMPONENT_HEAVYPISTOL_VARMOD_LUXE"))

            elseif hash == GetHashKey("WEAPON_SMG") then
                GiveWeaponComponentToPed(GetPlayerPed(-1), GetHashKey("WEAPON_SMG"), GetHashKey("COMPONENT_SMG_VARMOD_LUXE"))

            elseif hash == GetHashKey("WEAPON_MICROSMG") then
                GiveWeaponComponentToPed(GetPlayerPed(-1), GetHashKey("WEAPON_MICROSMG"), GetHashKey("COMPONENT_MICROSMG_VARMOD_LUXE"))

            elseif hash == GetHashKey("WEAPON_ASSAULTRIFLE") then
                GiveWeaponComponentToPed(GetPlayerPed(-1), GetHashKey("WEAPON_ASSAULTRIFLE"), GetHashKey("COMPONENT_ASSAULTRIFLE_VARMOD_LUXE"))

            elseif hash == GetHashKey("WEAPON_CARBINERIFLE") then
                GiveWeaponComponentToPed(GetPlayerPed(-1), GetHashKey("WEAPON_CARBINERIFLE"), GetHashKey("COMPONENT_CARBINERIFLE_VARMOD_LUXE"))

            elseif hash == GetHashKey("WEAPON_ADVANCEDRIFLE") then
                GiveWeaponComponentToPed(GetPlayerPed(-1), GetHashKey("WEAPON_ADVANCEDRIFLE"), GetHashKey("COMPONENT_ADVANCEDRIFLE_VARMOD_LUXE"))
            end
        end

        if durbun ==  1 then
            if table.includes(scope1, hash) then
                GiveWeaponComponentToPed(GetPlayerPed(-1), hash, 0xA0D89C42)
            end
        end

        if checkh[weapon] == hash then     
            SetPedAmmo(playerPed, hash, 1)
        elseif Config.FuelCan == hash and ammoCount == nil then
            SetPedAmmo(playerPed, hash, 1000)
        else
            SetPedAmmo(playerPed, hash, ammoCount or 0)
        end
    end, hash)
end



Sonrasında disc-inventoryhud\server\weapons.lua içerisinde "disc-inventoryhud:getAmmoCount" isimli ServerCallback'i aşağıdaki kodla değiştirilecektir

Kod:
ESX.RegisterServerCallback('disc-inventoryhud:getAmmoCount', function(source, cb, hash)[/B][/CENTER]
[B][CENTER]    local _source = source
    local player = ESX.GetPlayerFromId(_source)
    MySQL.Async.fetchAll('SELECT * FROM disc_ammo WHERE owner = @owner and hash = @hash', {
        ['@owner'] = player.identifier,
        ['@hash'] = hash
    }, function(results)
        if #results == 0 then
            cb(nil)
        else
            cb(results[1].count, results[1].susturucu, results[1].fener, results[1].tutamac, results[1].kaplama, results[1].durbun, ammoCount, susturucu, fener, tutamac, kaplama, durbun)
        end
    end)
end)


Bunları Yaptıktan Sonra Star Verin Ve Kurulum İşlemi Tamamlanmıştır iyi Forum'lar :)
 
Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...

Şu an konuyu görüntüleyenler (Toplam : 0, Üye: 0, Misafir: 0)

Geri
Üst