- Katılım
- 2 yıl 7 ay 22 gün
- Mesajlar
- 116
Kod:
server main.lua
QBCore = nil
TriggerEvent('QBCore:GetObject', function(obj) QBCore = obj end)
QBCore.Functions.CreateCallback('edrp-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 >= getQuantity(item[1])
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)