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 merhaba toptancida böyle hata aliyorum

Kod:
local eAktif = true

QBCore = nil
local coreLoaded = false
Citizen.CreateThread(function()
    while QBCore == nil do
        TriggerEvent('QBCore:GetObject', function(obj) QBCore = obj end)
        Citizen.Wait(200)
    end
    coreLoaded = true
end)

local NPC = {
     --Npc 1
    {
        ["aktif"] = true,
        ["kordinat"] = vector3(-44.4844, -480.978, 33.302),
        ["npc"] = {
            ["yazi"] = "Kara Mahir",
            ["h"] = 45.59,
            ["npc-hash"] = 0x2930C1AB,
            ["blip"] = false
        },
        ["malzemeler"] = {
            ["Mavi Kart"] = {
                ["istenilen"] = {
                    {"lowgrademaleseed", 50, "Erkek Tohum"}
                },
                ["verilen"] = {
                    {"lowgradefemaleseed", 1}
                },
            },
            ["Kırmızı Kart"] = {
                ["istenilen"] = {
                    {"madde_x", 100, "Madde X"}
                },
                ["verilen"] = {
                    {"kirmizi_kart", 1}
                },
            },
            ["MP5X-K"] = {
                ["istenilen"] = {
                    {"madde_x", 75, "Madde X"}
                },
                ["verilen"] = {
                    {"weapon_smg_mk2", 1}
                },
            },
        }
    },

    -- --Npc 2
    -- {
    --     ["aktif"] = true,
    --     ["kordinat"] = vector3(320.5, -211.31, 53.09),
    --     ["npc"] = {
    --         ["yazi"] = "TGIANN GOD v2",
    --         ["h"] = 244.0,
    --         ["npc-hash"] = 0x26C3D079,
    --         ["blip"] = {
    --             ["sprite"] = 84,
    --             ["scale"] = 0.5,
    --             ["colour"] = 46,
    --             ["yazi"] = "TGIANN NPC MAP NAME 2 No",
    --         },
    --     },
    --     ["malzemeler"] = {
    --         ["1 Tane Paralı Kola ve Para"] = {
    --             ["istenilen"] = {
    --                 {30, "money"},
    --                 {"cola", 10, "Kola"},
    --             },
    --             ["verilen"] = {
    --                 {25, "money"},
    --                 {"cola", 10},
    --             },
    --         },
    --         ["1 Tane Osmanlı Kola"] = {
    --             ["istenilen"] = {
    --                 {"phone", 1, "Telefon"},
    --                 {"cola", 1, "Kola"},
    --             },
    --             ["verilen"] =  {
    --                 {"green_phone", 1}
    --             }
    --         },
    --     },
    -- },

    -- --Npc 3
    -- {
    --     ["aktif"] = true,
    --     ["kordinat"] = vector3(323.6, -207.24, 53.09),
    --     ["npc"] = {
    --         ["yazi"] = "TGIANN GOD Market",
    --         ["h"] = 145.0,
    --         ["npc-hash"] = 0x8B7D3766,
    --         ["blip"] = false,
    --     },
    --     ["malzemeler"] = {
    --         ["1 Tane Telefon"] = {
    --             ["istenilen"] = {
    --                 {30, "money"},
    --             },
    --             ["verilen"] = {
    --                 {"white_phone", 1},
    --             }
    --         },
    --         ["1 Tane Kola"] = {
    --             ["istenilen"] = {
    --                 {10, "money"},
    --             },
    --             ["verilen"] = {
    --                 {"cola", 1},
    --             },
    --         },
    --     },
    -- },
}

Citizen.CreateThread(function()
    for i=1, #NPC do
        if NPC[i]["aktif"] then
            if NPC[i]["npc"]["blip"] then -- Blip 
                local dataBlip = NPC[i]["npc"]["blip"]
                local blip = AddBlipForCoord(NPC[i]["kordinat"])
                SetBlipSprite(blip, dataBlip["sprite"])
                SetBlipScale(blip, dataBlip["scale"])
                SetBlipColour(blip, dataBlip["colour"])
                SetBlipAsShortRange(blip, true)

                BeginTextCommandSetBlipName('STRING')
                AddTextComponentSubstringPlayerName(dataBlip["yazi"])
                EndTextCommandSetBlipName(blip)
            end   

            if NPC[i]["aktif"] then  -- NPC
                exports["tgiann-base"]:pedcreate("tgianpcsatis-"..i, NPC[i]["npc"]["npc-hash"], NPC[i]["kordinat"].x, NPC[i]["kordinat"].y, NPC[i]["kordinat"].z,  NPC[i]["npc"].h)
                TriggerEvent("tgiann-polisbildirim:mapBlip", x, 434, sucAdi)
            end

        end
    end
end)

Citizen.CreateThread(function ()
    while true do
        Citizen.Wait(1)
        local playerPed = PlayerPedId()
        local playerCoords = GetEntityCoords(playerPed)
        for _, npc in pairs(NPC) do
            if npc["aktif"] and coreLoaded then
                local mesafe = #(playerCoords - npc["kordinat"])
                if mesafe < 5 then
                    if mesafe < 2 then
                        QBCore.Functions.DrawText3D(npc["kordinat"]["x"], npc["kordinat"]["y"], npc["kordinat"]["z"]+ 2.0, "[E] " ..npc["npc"]["yazi"], 0.40)
                        if IsControlJustReleased(0, 38) then
                            menuAc(npc)
                        end
                    else
                        QBCore.Functions.DrawText3D(npc["kordinat"]["x"], npc["kordinat"]["y"], npc["kordinat"]["z"]+ 2.0, npc["npc"]["yazi"], 0.40)
                    end
                  
                end
                
            end
        end
    end
end)

function menuAc(npc)
    local elements = {}
    for verilecekitem, item in pairs(npc["malzemeler"]) do
        local verilecekEsyaAdi = ""
        for vItem=1, #item["istenilen"] do
            if type(item["istenilen"][vItem][1]) == "number" then
                verilecekEsyaAdi = verilecekEsyaAdi .. " " .. item["istenilen"][vItem][1] .."$"
            else
                if #item["istenilen"] ~= vItem then
                    verilecekEsyaAdi = verilecekEsyaAdi .. " " .. " ".. item["istenilen"][vItem][2].. " " ..item["istenilen"][vItem][3] ..","
                else
                    verilecekEsyaAdi = verilecekEsyaAdi .. " " .. " ".. item["istenilen"][vItem][2].. " " ..item["istenilen"][vItem][3]
                end
            end
        end
        if verilecekEsyaAdi then
            table.insert(elements, {label = verilecekitem .. " Al / " .. verilecekEsyaAdi.. "", value = item})
        else
            table.insert(elements, {label = verilecekitem , value = item})
        end
    end
    
    QBCore.UI.Menu.Open('default', GetCurrentResourceName(), 'my_npc', {
        title    = npc["npc"]["yazi"],
        align    = 'left',
        elements = elements
    },function(data, menu)
        if data.current.value then
            if eAktif then
                eAktif = false
                QBCore.Functions.TriggerCallback('walk-npcsatis:item-kontrol', function(durum)
                    eAktif = durum
                end, data.current.value["istenilen"], data.current.value["verilen"])
            else
                QBCore.Functions.Notify("Lütfen Biraz Bekle", "error")
            end
        end
    end, function(data, menu)
        menu.close()     
    end)   
end
konu tarafımca doğru kategoriye alınmıştır
Server:
Client
Kod:
QBCore = nil
TriggerEvent('QBCore:GetObject', function(obj) QBCore = obj end)

QBCore.Functions.CreateCallback('walk-npcsatis:item-kontrol', function(source, cb, item, verilecekItem)
    local src = source
    local xPlayer = QBCore.Functions.GetPlayer(src)
    if xPlayer then
        local itemVar = 0
        for i=1, #item do
            if type(item[i][1]) == "number" then

                if xPlayer.PlayerData.money.cash >= item[i][1] then
                    itemVar = itemVar + 1
                else
                    if item[i][2] == "money" then
                        TriggerClientEvent("QBCore:Notify", xPlayer.PlayerData.source, "Üzerinde ".. item[i][2] .. "$ Yok")
                    else
                        TriggerClientEvent("QBCore:Notify", xPlayer.PlayerData.source, "Bankanda ".. item[i][2] .. "$ Yok")
                    end
                end
            else
                if xPlayer.getInventoryItem(item[i][1]).count >= item[i][2] then
                    itemVar = itemVar + 1
                else
                    TriggerClientEvent("QBCore:Notify", xPlayer.PlayerData.source, "Üzerinde ".. item[i][2] .. " Tane " .. xPlayer.getInventoryItem(item[i][1]).label .. " Yok")
                end
                
            end
        end

        if #item == itemVar then
            for i=1, #item do
                if type(item[i][1]) == "number" then
                    xPlayer.Functions.RemoveMoney('cash', item[i][1])
                else
                    xPlayer.Functions.RemoveItem(item[i][1], item[i][2])
                end
                Citizen.Wait(350)     
            end

            for i=1, #verilecekItem do
                if type(verilecekItem[i][1]) == "number" then
                    xPlayer.Functions.AddMoney('cash', verilecekItem[i][1])
                else
                    xPlayer.Functions.AddItem(verilecekItem[i][1], verilecekItem[i][2])
                    TriggerClientEvent("QBCore:Notify", xPlayer.PlayerData.source, verilecekItem[i][2] .. " Tane " .. xPlayer.getInventoryItem(verilecekItem[i][1]).label .. " Aldın")
                end
                Citizen.Wait(350)
            end
        end
    end
    Citizen.Wait(2000)
    cb(true)
end)
 
üstekki server alttaki client
 

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!