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

Cevaplandı toptanti yardım

  • Konbuyu başlatan jeffbaba
  • Başlangıç tarihi
  • Cevaplar 13
  • Görüntüleme 479

jeffbaba

Üye
FT Kullanıcı
Katılım
3 yıl 6 ay 19 gün
Mesajlar
110
arkadaşlar toptanci scripti kurdum paketlenmis methi falan hallettim ama meth üstümde olduğu halde satamıyorum ama olmadığı zaman bile sınırsız şekilde satabiliyorum yardım edermisiniz?
 
DF
Aldığınız herhangi bir hata var mı?
 
DF
Editlediğin kısımları atarmısın bakalım doğru mu yapmışsın ona göre yardımcı olayım sana.
 
DF
sorun çözüldü gibi ama en az 5 tane olunca satabiliyorum ustumdekileri onu 1 yapabilirmiyiz
 
DF
Editlediğin kısımları atarmısın bakalım doğru mu yapmışsın ona göre yardımcı olayım sana.
atayım

config.lua
Kod:
Config = {}
-- Pawn Shop Positions:
Config.PawnZones = {
    Pawnshop1s = {
        Pos = {
            {x = 412.31,  y = 314.11, z = 103.02},
        }
    }
}
-- Pawn Shop Blip Settings:
Config.EnablePawnshop1Blip = true
Config.BlipSprite = 59
Config.BlipDisplay = 4
Config.BlipScale = 0.65
Config.BlipColour = 5
Config.BlipName = "Pawn Shop"
-- Pawn Shop Marker Settings:
Config.KeyToOpenShop = 38                                                       -- default 38 is E
Config.ShopMarker = 27                                                          -- marker type
Config.ShopMarkerColor = { r = 255, g = 255, b = 0, a = 100 }                   -- rgba color of the marker
Config.ShopMarkerScale = { x = 1.0, y = 1.0, z = 1.0 }                          -- the scale for the marker on the x, y and z axis
Config.ShopDraw3DText = "Erismek Için [E] Bas"                  -- set your desired text here
-- Pawn Shop Item List:
Config.ItemsInPawnshop1 = {
    { itemName = 'meth_paketlenmis', label = 'Paketlenmiş Meth', BuyInPawnshop1 = false, BuyPrice = 40, SellInPawnshop1 = true, SellPrice = 3000 },
    --{ itemName = 'bagofdope', label = 'Uyuşturucu Çantası', BuyInPawnshop1 = false, BuyPrice = 5000, SellInPawnshop1 = true, SellPrice = 230 },
    --{ itemName = 'kesikot', label = 'Kırpılmış Ot', BuyInPawnshop1 = false, BuyPrice = 5000, SellInPawnshop1 = true, SellPrice = 75 },       
}

client.lua
Kod:
ESX = nil
local insideMarker = false
Citizen.CreateThread(function()
    while ESX == nil do
        TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
        Citizen.Wait(0)
    end
    while ESX.GetPlayerData().job == nil do
        Citizen.Wait(10)
    end
    PlayerData = ESX.GetPlayerData()
end)
-- Core Thread Function:
Citizen.CreateThread(function()
    while true do
        Citizen.Wait(5)
        local coords = GetEntityCoords(PlayerPedId())
        for k,v in pairs(Config.PawnZones) do
            for i = 1, #v.Pos, 1 do
                local distance = Vdist(coords, v.Pos[i].x, v.Pos[i].y, v.Pos[i].z)
                if (distance < 7.0) and insideMarker == false then
                    DrawMarker(Config.ShopMarker, v.Pos[i].x, v.Pos[i].y, v.Pos[i].z-0.975, 0.0, 0.0, 0.0, 0.0, 0, 0.0, Config.ShopMarkerScale.x, Config.ShopMarkerScale.y, Config.ShopMarkerScale.z, Config.ShopMarkerColor.r,Config.ShopMarkerColor.g,Config.ShopMarkerColor.b,Config.ShopMarkerColor.a, false, true, 2, true, false, false, false)                       
                end
                if (distance < 1.0) and insideMarker == false then
                    DrawText3Ds(v.Pos[i].x, v.Pos[i].y, v.Pos[i].z, Config.ShopDraw3DText)
                    if IsControlJustPressed(0, Config.KeyToOpenShop) then
                        Pawnshop1Menu()
                        insideMarker = true
                        Citizen.Wait(500)
                    end
                end
            end
        end
    end
end)
-- Function for Pawn Shop Main Menu:
Pawnshop1Menu = function()
    local player = PlayerPedId()
    FreezeEntityPosition(player,true)
    
    local elements = {
        { label = "Al", action = "Pawnshop1_Buy_Menu" },
        { label = "Sat", action = "Pawnshop1_Sell_Menu" },
    }
        
    ESX.UI.Menu.Open('default', GetCurrentResourceName(), "esx_Pawnshop1_main_menu",
        {
            title    = "PawnShop",
            align    = "top-left",
            elements = elements
        },
    function(data, menu)
        local action = data.current.action
        if action == "Pawnshop1_Buy_Menu" then
            Pawnshop1BuyMenu()
        elseif action == "Pawnshop1_Sell_Menu" then
            Pawnshop1SellMenu()
        end 
    end, function(data, menu)
        menu.close()
        insideMarker = false
        FreezeEntityPosition(player,false)
    end, function(data, menu)
    end)
end
-- Function for Pawn Shop Buy Menu:
function Pawnshop1BuyMenu()
    local player = PlayerPedId()
    FreezeEntityPosition(player,true)
    local elements = {}
            
    for k,v in pairs(Config.ItemsInPawnshop1) do
        if v.BuyInPawnshop1 == true then
            table.insert(elements,{label = v.label .. " | "..('<span style="color:green;">%s</span>'):format("$"..v.BuyPrice..""), itemName = v.itemName, BuyInPawnshop1 = v.BuyInPawnshop1, BuyPrice = v.BuyPrice})
        end
    end
        
    ESX.UI.Menu.Open('default', GetCurrentResourceName(), "esx_Pawnshop1_buy_menu",
        {
            title    = "Ne Almak İstiyorsun?",
            align    = "top-left",
            elements = elements
        },
    function(data, menu)
            if data.current.itemName == data.current.itemName then
                OpenBuyDialogMenu(data.current.itemName,data.current.BuyPrice)
            end 
    end, function(data, menu)
        menu.close()
        insideMarker = false
        FreezeEntityPosition(player,false)
    end, function(data, menu)
    end)
end
-- Function for Pawn Shop Buy Dialog
function OpenBuyDialogMenu(itemName, BuyPrice)
    ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'esx_Pawnshop1_amount_to_buy_dialog', {
        title = "Ne Kadar Almak İstiyorsun?"
    }, function(data, menu)
        menu.close()
        amountToBuy = tonumber(data.value)
        totalBuyPrice = (BuyPrice * amountToBuy)
        TriggerServerEvent("esx_Pawnshop1:BuyItem",amountToBuy,totalBuyPrice,itemName)
    end,
    function(data, menu)
        menu.close()    
    end)
end
-- Function for Pawn Shop Sell Menu:
function Pawnshop1SellMenu()
    local player = PlayerPedId()
    FreezeEntityPosition(player,true)
    local elements = {}
            
    for k,v in pairs(Config.ItemsInPawnshop1) do
        if v.SellInPawnshop1 == true then
            table.insert(elements,{label = v.label .. " | "..('<span style="color:green;">%s</span>'):format("$"..v.SellPrice..""), itemName = v.itemName, SellInPawnshop1 = v.SellInPawnshop1, SellPrice = v.SellPrice})
        end
    end
        
    ESX.UI.Menu.Open('default', GetCurrentResourceName(), "esx_Pawnshop1_sell_menu",
        {
            title    = "Ne Satmak İstiyorsun?",
            align    = "top-left",
            elements = elements
        },
    function(data, menu)
            if data.current.itemName == data.current.itemName then
                OpenSellDialogMenu(data.current.itemName,data.current.SellPrice)
            end 
    end, function(data, menu)
        menu.close()
        insideMarker = false
        FreezeEntityPosition(player,false)
    end, function(data, menu)
    end)
end
-- Function for Pawn Shop Sell Dialog
function OpenSellDialogMenu(itemName, SellPrice)
    ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'esx_Pawnshop1_amount_to_sell_dialog', {
        title = "Ne Kadar Satmak İstiyorsun?"
    }, function(data, menu)
        menu.close()
        amountToSell = tonumber(data.value)
        totalSellPrice = (SellPrice * amountToSell)
        TriggerServerEvent("esx_Pawnshop1:SellItem",amountToSell,totalSellPrice,itemName)
    end,
    function(data, menu)
        menu.close()    
    end)
end
-- Blip on Map for Pawn Shops:
Citizen.CreateThread(function()
    if Config.EnablePawnshop1Blip == true then  
        for k,v in pairs(Config.PawnZones) do
            for i = 1, #v.Pos, 1 do
                local blip = AddBlipForCoord(v.Pos[i].x, v.Pos[i].y, v.Pos[i].z)
                SetBlipSprite(blip, Config.BlipSprite)
                SetBlipDisplay(blip, Config.BlipDisplay)
                SetBlipScale  (blip, Config.BlipScale)
                SetBlipColour (blip, Config.BlipColour)
                SetBlipAsShortRange(blip, true)
                BeginTextCommandSetBlipName("STRING")
                AddTextComponentString(Config.BlipName)
                EndTextCommandSetBlipName(blip)
            end
        end
    end 
end)
-- Function for 3D text:
function DrawText3Ds(x,y,z, text)
    local onScreen,_x,_y=World3dToScreen2d(x,y,z)
    local px,py,pz=table.unpack(GetGameplayCamCoords())
    SetTextScale(0.32, 0.32)
    SetTextFont(4)
    SetTextProportional(1)
    SetTextColour(255, 255, 255, 255)
    SetTextEntry("STRING")
    SetTextCentre(1)
    AddTextComponentString(text)
    DrawText(_x,_y)
    local factor = (string.len(text)) / 500
    DrawRect(_x,_y+0.0125, 0.015+ factor, 0.03, 0, 0, 0, 80)
end

server.lua
Kod:
local ESX = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
-- Server Event for Buying:
RegisterServerEvent("esx_Pawnshop1:BuyItem")
AddEventHandler("esx_Pawnshop1:BuyItem", function(amountToBuy,totalBuyPrice,itemName)
    local xPlayer = ESX.GetPlayerFromId(source)
    local itemLabel = ESX.GetItemLabel(itemName)
    if xPlayer.getMoney() >= totalBuyPrice then
        xPlayer.removeMoney(totalBuyPrice)
        xPlayer.addInventoryItem(itemName, amountToBuy)
        TriggerClientEvent("esx:showNotification",source,"You paid ~g~$"..totalBuyPrice.."~s~ for "..amountToBuy.."x ~y~"..itemLabel.."~s~")
    else
        TriggerClientEvent("esx:showNotification",source,"Not enough money")
    end
end)
-- Server Event for Selling:
RegisterServerEvent("esx_Pawnshop1:SellItem")
AddEventHandler("esx_Pawnshop1:SellItem", function(amountToSell,totalSellPrice,itemName)
    local xPlayer = ESX.GetPlayerFromId(source)
    local itemLabel = ESX.GetItemLabel(itemName)
    if xPlayer.getInventoryItem(itemName).count >= amountToSell then
        xPlayer.addMoney(totalSellPrice)
        xPlayer.removeInventoryItem(itemName, amountToSell)
        TriggerClientEvent("esx:showNotification",source,"You sold "..amountToSell.."x ~y~"..itemLabel.."~s~ for ~g~$"..totalSellPrice.."~s~")
    else
        TriggerClientEvent("esx:showNotification",source,"Not enough items")
    end
end)
 
DF
server.luada attığım ss teki yerde 1 yazan yeri kaç tane satınca para vermesini istiyorsan ayarlayabilirsin.

49113

--------------------------------------------------------------------------------

49114
 
DF
Sorununuz çözüme ulaştı mı?
 
DF
Konu ön eki tarafımca cevaplandı olarak değiştirilmiştir.
 
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!