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

Paylaşım MBL - Metalı mermi, istediğiniz kadar mermi çıkarın!

mblater

Üye
FT Kullanıcı
Katılım
3 yıl 9 ay 4 gün
Mesajlar
212
Sadece pistol mermilerinde geçerlidir.

Kod:
MBL = {}

MBL.Pistol = {
    [GetHashKey("weapon_snspistol")] = {},
    [GetHashKey("weapon_vintagepistol")] = {},
    [GetHashKey("weapon_pistol")] = {},
    [GetHashKey("weapon_pistol_mk2")] = {},
    [GetHashKey("weapon_combatpistol")] = {},
    [GetHashKey("weapon_appistol")] = {},
    [GetHashKey("weapon_pistol50")] = {},
    [GetHashKey("weapon_heavypistol")] = {},
    [GetHashKey("weapon_marksmanpistol")] = {},
}


function yapabilir()
    local ped = PlayerPedId()
    local pedWeapon = GetSelectedPedWeapon(ped)

    for k, v in pairs(MBL.Pistol) do
        if pedWeapon == k then
            return true
        end
    end
    return false
end



RegisterCommand("mermiçıkar", function(source, args)
    local weapon = GetSelectedPedWeapon(PlayerPedId())
    local info = nil
    local ammo =  tonumber(GetAmmoInPedWeapon(PlayerPedId(), weapon))
    local item = "pistol_ammo"
    local task = tonumber(args[1])
    if task ~= nil then
        if RLCore.Shared.Weapons[weapon]["name"] ~= "weapon_unarmed" then
            if ammo > 0 then
                if yapabilir() then
                    if ammo >= task then
                        TriggerServerEvent('serversayd', task)
                        SetPedAmmo(PlayerPedId(), weapon, ammo-task)
                        TriggerServerEvent("weapons:server:AddWeaponAmmo", CurrentWeaponData, ammo-task)
                        RLCore.Functions.Notify("Mermilerini çıkardın, çıkarılan mermi sayısı: "..task)
                    else
                        RLCore.Functions.Notify("Elindeki silahta bu şuanda mümkün değil.")
                    end
                else
                    RLCore.Functions.Notify("Silahin mermisi 0'dan büyük olmalı.")
                end
            else
                RLCore.Functions.Notify("Elinde silah yok.")
            end
        else
            RLCore.Functions.Notify("Çıkarmak istediğin miktarı yaz.")
        end
    end
end)   




RegisterNetEvent('weapon:client:AddAmmo')
AddEventHandler('weapon:client:AddAmmo', function(type, amount, itemData, data)
    local ped = PlayerPedId()
    local weapon = GetSelectedPedWeapon(PlayerPedId())
    if CurrentWeaponData ~= nil then
        if RLCore.Shared.Weapons[weapon]["name"] ~= "weapon_unarmed" and RLCore.Shared.Weapons[weapon]["ammotype"] == type:upper() then
            local total = (GetAmmoInPedWeapon(PlayerPedId(), weapon))
            local f, max = GetMaxAmmo(ped, weapon)
            local clipmax = tonumber(GetMaxAmmoInClip(ped, weapon, 1))
            local newtotal = total + clipmax
            if newtotal < max then
                RLCore.Functions.Progressbar("taking_bullets", "", math.random(1000, 4000), false, true, {
                    disableMovement = false,
                    disableCarMovement = false,
                    disableMouse = false,
                    disableCombat = true,
                }, {}, {}, {}, function() -- Done
                    if RLCore.Shared.Weapons[weapon] ~= nil then
                        if yapabilir() then
                        TaskReloadWeapon(ped)
                        SetPedAmmo(ped, weapon, total+itemData.info.mermi)
                        TriggerServerEvent("weapons:server:AddWeaponAmmo", CurrentWeaponData, total+itemData.info.mermi)
                        TriggerServerEvent('RLCore:Server:RemoveItem', itemData.name, 1, itemData.slot)
                        TriggerEvent('inventory:client:ItemBox', RLCore.Shared.Items[itemData.name], "remove")
                        TriggerEvent('RLCore:Notify', itemData.info.mermi .." mermi dolduruldu!", "success")
                        TriggerEvent("debug", 'Weapons: Bullets Loaded', 'success')
                        else
                            if weapon ~= nil then
                                TaskReloadWeapon(ped)
                                SetPedAmmo(ped, weapon, newtotal)
                                TriggerServerEvent("weapons:server:AddWeaponAmmo", CurrentWeaponData, newtotal)
                                TriggerServerEvent('RLCore:Server:RemoveItem', itemData.name, 1, itemData.slot)
                                TriggerEvent('inventory:client:ItemBox', RLCore.Shared.Items[itemData.name], "remove")
                                TriggerEvent('RLCore:Notify', newtotal .." mermi dolduruldu!", "success")
                                TriggerEvent("debug", 'Weapons: Bullets Loaded', 'success')
                                end
                            end
                        end
              
                end, function()
                    RLCore.Functions.Notify("İptal edildi..", "error")
                    TriggerEvent("debug", 'Weapons: Canceled', 'error')
                end)
            else
                RLCore.Functions.Notify("Bu silahın mermileri dolu..", "error")
            end
        else   
            RLCore.Functions.Notify("Elinde silah yok..", "error")
        end
    else
        RLCore.Functions.Notify("Elinde silah yok..", "error")
    end
end)


Server Side


Kod:
RegisterServerEvent("serversayd")
AddEventHandler("serversayd", function (yarraminbashi)
    giveAmom(source, yarraminbashi)
end)



function giveAmom(source, yarrak)
    local src = source
    local Player = RLCore.Functions.GetPlayer(src)
    local info = {}
    info.mermi = yarrak
    Player.Functions.AddItem("pistol_ammo", 1, false, info)
end



RLCore.Functions.CreateUseableItem("pistol_ammo", function(source, item, info)
    local Player = RLCore.Functions.GetPlayer(source)
    if Player.Functions.GetItemBySlot(item.slot) ~= nil then
    TriggerClientEvent("weapon:client:AddAmmo", source, "AMMO_PISTOL", 30, item, info)
    else
        TriggerClientEvent("RLCore:Notify", 'nil attı kanka', "error")
    end
end)

Javascript;



        if (itemData.name == "pistol_ammo") {
            $(".item-info-title").html('<p>'+itemData.label+'</p>')
            $(".item-info-description").html('<p>Mermi: ' + itemData.info.mermi + '</p>');
}


Giveitem kodunun altına;

elseif itemData["name"] == "pistol_ammo" then
                    info.mermi = 5
                    print(info.mermi)
 
draw text sleeplenmiş durumda mı ?
 

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!