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ı id-vehicleshop parayı banka yerine envanter üzerinden çekme

mumili82323

Üye
FT Kullanıcı
Katılım
4 yıl 5 ay 19 gün
Mesajlar
68
Arkadaşlar id-vehicleshop galeri sistemi var bunu item olarak çekmesini nasıl sağlarım?
73154
 
DF
Dilersen ücretli olarak yardımcı olabilirim. SAMİ#4099
 
DF
TriggerClientEvent('vehicleshop.receiveInfo'), src, xPlayer.getQuantity('cash'), firstname)

TriggerClientEvent('vehicleshop.receiveInfo'), src, xPlayer.getInventoryItem('cash'), firstname)

denermisin
 
DF
TriggerClientEvent('vehicleshop.receiveInfo'), src, xPlayer.getQuantity('cash'), firstname)

TriggerClientEvent('vehicleshop.receiveInfo'), src, xPlayer.getInventoryItem('cash'), firstname)

denermisin
farklı yerlerde var isterseniz server.lua yı atayım size?
 
DF
Kod:
ESX              = nil

TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)

RegisterServerEvent('vehicleshop.requestInfo')
AddEventHandler('vehicleshop.requestInfo', function()
    local src = source
    local rows   

    local xPlayer = ESX.GetPlayerFromId(src)
    local identifier = GetPlayerIdentifiers(src)[1]

    local result = MySQL.Sync.fetchAll("SELECT * FROM users WHERE identifier = @identifier", {
        ['@identifier'] = identifier
    })

    local firstname = result[1].firstname

    local resultVehicles = MySQL.Sync.fetchAll('SELECT * FROM vehicles')

    TriggerClientEvent('vehicleshop.receiveInfo', src, xPlayer.getAccount ('bank').money, firstname)   

    TriggerClientEvent("vehicleshop.vehiclesInfos", src , resultVehicles)

    TriggerClientEvent("vehicleshop.notify", src, 'error', _U('rotate_keys'))
end)



ESX.RegisterServerCallback('vehicleshop.isPlateTaken', function (source, cb, plate)
    MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE plate = @plate', {
        ['@plate'] = plate
    }, function (result)
        cb(result[1] ~= nil)
    end)
end)

RegisterServerEvent('vehicleshop.CheckMoneyForVeh')
AddEventHandler('vehicleshop.CheckMoneyForVeh', function(veh, price, name, vehicleProps)
    local source = source

    local xPlayer = ESX.GetPlayerFromId(source)

    if xPlayer == nil then
        return
    end

    MySQL.Async.fetchAll('SELECT * FROM vehicles WHERE model = @model LIMIT 1', {
        ['@model'] = veh
    }, function (result)
        if #result > 0 then
            local veiculo = result[1]
            local vehicleModel = veh
            local vehiclePrice = price
            local stockQtd = result[1].stock       
            if stockQtd > 0 then           
                if xPlayer.getAccount('bank').money >= tonumber(vehiclePrice) then
                    xPlayer.removeAccountMoney('bank', tonumber(vehiclePrice))
                    stockQtd = stockQtd - 1                       
                    local vehiclePropsjson = json.encode(vehicleProps)
                    
                    local stateVehicle = 0

                    if Config.SpawnVehicle then
                        stateVehicle = 0
                    else
                        stateVehicle = 1
                    end
                    
                    MySQL.Async.execute('INSERT INTO owned_vehicles (owner, plate, vehicle, state) VALUES (@owner, @plate, @vehicle, @state)',
                    {
                        ['@owner']   = xPlayer.identifier,
                        ['@plate']   = vehicleProps.plate,
                        ['@vehicle'] = vehiclePropsjson,
                        ['@model'] = vehicleModel,
                        ['@state'] = stateVehicle,
                    },
                    
                    function (rowsChanged)                     
                        MySQL.Sync.execute('UPDATE vehicles SET stock = @stock WHERE model = @model',
                        {
                            ['@stock'] = stockQtd,
                            ['@model'] = vehicleModel
                        })
                        info = {
                            plaka = vehicleProps.plate,
                            model = vehicleModel
                        }

                        TriggerClientEvent("vehicleshop.sussessbuy", source, name, vehicleProps.plate, vehiclePrice)
                        TriggerClientEvent('vehicleshop.receiveInfo', source, xPlayer.getAccount('bank').money)   
                        TriggerClientEvent('vehicleshop.spawnVehicle', source, vehicleModel, vehicleProps.plate)       
                        xPlayer.addInventoryItem("vehiclekey", 1, false, info)                     
                    end)
                else
                    TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'inform', text = 'Paranız Yetersiz', length = 2500})

                end
            else
                TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'inform', text = 'Bu araca sahip değilsiniz.', length = 2500})
            end 
        end
    end)
end)

RegisterNetEvent('esx_vehicleshop:setJobVehicleState')
AddEventHandler('esx_vehicleshop:setJobVehicleState', function(plate, state)
    local xPlayer = ESX.GetPlayerFromId(source)

    MySQL.Async.execute('UPDATE owned_vehicles SET `stored` = @stored WHERE plate = @plate AND job = @job', {
        ['@stored'] = state,
        ['@plate'] = plate,
        ['@job'] = xPlayer.job.name
    }, function(rowsChanged)
        if rowsChanged == 0 then
            print(('[esx_vehicleshop] [^3WARNING^7] %s exploited the garage!'):format(xPlayer.identifier))
        end
    end)
end)


ESX.RegisterServerCallback('esx_vehicleshop:retrieveJobVehicles', function(source, cb, type)
    local xPlayer = ESX.GetPlayerFromId(source)

    MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @owner AND type = @type AND job = @job', {
        ['@owner'] = xPlayer.identifier,
        ['@type'] = type,
        ['@job'] = xPlayer.job.name
    }, function(result)
        cb(result)
    end)
end)
 
DF
ÇALIŞMASSA BİLDİR, DENERİM TEKRAR..
Kod:
ESX              = nil

TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)

RegisterServerEvent('vehicleshop.requestInfo')
AddEventHandler('vehicleshop.requestInfo', function()
    local src = source
    local rows  

    local xPlayer = ESX.GetPlayerFromId(src)
    local identifier = GetPlayerIdentifiers(src)[1]

    local result = MySQL.Sync.fetchAll("SELECT * FROM users WHERE identifier = @identifier", {
        ['@identifier'] = identifier
    })

    local firstname = result[1].firstname

    local resultVehicles = MySQL.Sync.fetchAll('SELECT * FROM vehicles')

    TriggerClientEvent('vehicleshop.receiveInfo'), src, xPlayer.getInventoryItem('cash').money, firstname)  

    TriggerClientEvent("vehicleshop.vehiclesInfos", src , resultVehicles)

    TriggerClientEvent("vehicleshop.notify", src, 'error', _U('rotate_keys'))
end)



ESX.RegisterServerCallback('vehicleshop.isPlateTaken', function (source, cb, plate)
    MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE plate = @plate', {
        ['@plate'] = plate
    }, function (result)
        cb(result[1] ~= nil)
    end)
end)

RegisterServerEvent('vehicleshop.CheckMoneyForVeh')
AddEventHandler('vehicleshop.CheckMoneyForVeh', function(veh, price, name, vehicleProps)
    local source = source

    local xPlayer = ESX.GetPlayerFromId(source)

    if xPlayer == nil then
        return
    end

    MySQL.Async.fetchAll('SELECT * FROM vehicles WHERE model = @model LIMIT 1', {
        ['@model'] = veh
    }, function (result)
        if #result > 0 then
            local veiculo = result[1]
            local vehicleModel = veh
            local vehiclePrice = price
            local stockQtd = result[1].stock      
            if stockQtd > 0 then          
                if xPlayer.getInventoryItem('cash'), >= tonumber(vehiclePrice) then
                    xPlayer.removeInventoryItem('cash', tonumber(vehiclePrice))
                    stockQtd = stockQtd - 1                      
                    local vehiclePropsjson = json.encode(vehicleProps)
                   
                    local stateVehicle = 0

                    if Config.SpawnVehicle then
                        stateVehicle = 0
                    else
                        stateVehicle = 1
                    end
                   
                    MySQL.Async.execute('INSERT INTO owned_vehicles (owner, plate, vehicle, state) VALUES (@owner, @plate, @vehicle, @state)',
                    {
                        ['@owner']   = xPlayer.identifier,
                        ['@plate']   = vehicleProps.plate,
                        ['@vehicle'] = vehiclePropsjson,
                        ['@state'] = stateVehicle,
                    },
                   
                    function (rowsChanged)                    
                        MySQL.Sync.execute('UPDATE vehicles SET stock = @stock WHERE model = @model',
                        {
                            ['@stock'] = stockQtd,
                            ['@model'] = vehicleModel
                        })

                        TriggerClientEvent("vehicleshop.sussessbuy", source, name, vehicleProps.plate, vehiclePrice)
                        TriggerClientEvent('vehicleshop.receiveInfo'), src, xPlayer.getInventoryItem('cash').money)    
                        TriggerClientEvent('vehicleshop.spawnVehicle', source, vehicleModel, vehicleProps.plate)                      
                    end)
                else
                    TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'inform', text = 'Paranız Yetersiz', length = 2500})

                end
            else
                TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'inform', text = 'Bu araca sahip değilsiniz.', length = 2500})
            end
        end
    end)
end)

RegisterNetEvent('esx_vehicleshop:setJobVehicleState')
AddEventHandler('esx_vehicleshop:setJobVehicleState', function(plate, state)
    local xPlayer = ESX.GetPlayerFromId(source)

    MySQL.Async.execute('UPDATE owned_vehicles SET `stored` = @stored WHERE plate = @plate AND job = @job', {
        ['@stored'] = state,
        ['@plate'] = plate,
        ['@job'] = xPlayer.job.name
    }, function(rowsChanged)
        if rowsChanged == 0 then
            print(('[esx_vehicleshop] [^3WARNING^7] %s exploited the garage!'):format(xPlayer.identifier))
        end
    end)
end)


ESX.RegisterServerCallback('esx_vehicleshop:retrieveJobVehicles', function(source, cb, type)
    local xPlayer = ESX.GetPlayerFromId(source)

    MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @owner AND type = @type AND job = @job', {
        ['@owner'] = xPlayer.identifier,
        ['@type'] = type,
        ['@job'] = xPlayer.job.name
    }, function(result)
        cb(result)
    end)
end)
 
DF
getAccountMoney("bank", amount)
yerine, eğer ki parayı item olarak kullanıyorsan getInventoryItem("cash", amount) olarak yapacaksın eğer ki money olarak kullanıyorsan da
getMoney("cash", amount olarak değiştireceksin. Yapamazsan imzamdaki discordumdan yazabilirsin.


TriggerClientEvent('vehicleshop.receiveInfo', src, xPlayer.getInventoryItem("cash).money, firstname)

veya

TriggerClientEvent('vehicleshop.receiveInfo', src, xPlayer.getMoney("cash").money, firstname)
 
DF
getAccountMoney("bank", amount)
yerine, eğer ki parayı item olarak kullanıyorsan getInventoryItem("cash", amount) olarak yapacaksın eğer ki money olarak kullanıyorsan da
getMoney("cash", amount olarak değiştireceksin. Yapamazsan imzamdaki discordumdan yazabilirsin.


TriggerClientEvent('vehicleshop.receiveInfo', src, xPlayer.getInventoryItem("cash).money, firstname)

veya

TriggerClientEvent('vehicleshop.receiveInfo', src, xPlayer.getMoney("cash").money, firstname)
scripti at yapıp atayım
ÇALIŞMASSA BİLDİR, DENERİM TEKRAR..
Kod:
ESX              = nil

TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)

RegisterServerEvent('vehicleshop.requestInfo')
AddEventHandler('vehicleshop.requestInfo', function()
    local src = source
    local rows 

    local xPlayer = ESX.GetPlayerFromId(src)
    local identifier = GetPlayerIdentifiers(src)[1]

    local result = MySQL.Sync.fetchAll("SELECT * FROM users WHERE identifier = @identifier", {
        ['@identifier'] = identifier
    })

    local firstname = result[1].firstname

    local resultVehicles = MySQL.Sync.fetchAll('SELECT * FROM vehicles')

    TriggerClientEvent('vehicleshop.receiveInfo'), src, xPlayer.getInventoryItem('cash').money, firstname) 

    TriggerClientEvent("vehicleshop.vehiclesInfos", src , resultVehicles)

    TriggerClientEvent("vehicleshop.notify", src, 'error', _U('rotate_keys'))
end)



ESX.RegisterServerCallback('vehicleshop.isPlateTaken', function (source, cb, plate)
    MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE plate = @plate', {
        ['@plate'] = plate
    }, function (result)
        cb(result[1] ~= nil)
    end)
end)

RegisterServerEvent('vehicleshop.CheckMoneyForVeh')
AddEventHandler('vehicleshop.CheckMoneyForVeh', function(veh, price, name, vehicleProps)
    local source = source

    local xPlayer = ESX.GetPlayerFromId(source)

    if xPlayer == nil then
        return
    end

    MySQL.Async.fetchAll('SELECT * FROM vehicles WHERE model = @model LIMIT 1', {
        ['@model'] = veh
    }, function (result)
        if #result > 0 then
            local veiculo = result[1]
            local vehicleModel = veh
            local vehiclePrice = price
            local stockQtd = result[1].stock     
            if stockQtd > 0 then         
                if xPlayer.getInventoryItem('cash'), >= tonumber(vehiclePrice) then
                    xPlayer.removeInventoryItem('cash', tonumber(vehiclePrice))
                    stockQtd = stockQtd - 1                     
                    local vehiclePropsjson = json.encode(vehicleProps)
                  
                    local stateVehicle = 0

                    if Config.SpawnVehicle then
                        stateVehicle = 0
                    else
                        stateVehicle = 1
                    end
                  
                    MySQL.Async.execute('INSERT INTO owned_vehicles (owner, plate, vehicle, state) VALUES (@owner, @plate, @vehicle, @state)',
                    {
                        ['@owner']   = xPlayer.identifier,
                        ['@plate']   = vehicleProps.plate,
                        ['@vehicle'] = vehiclePropsjson,
                        ['@state'] = stateVehicle,
                    },
                  
                    function (rowsChanged)                   
                        MySQL.Sync.execute('UPDATE vehicles SET stock = @stock WHERE model = @model',
                        {
                            ['@stock'] = stockQtd,
                            ['@model'] = vehicleModel
                        })

                        TriggerClientEvent("vehicleshop.sussessbuy", source, name, vehicleProps.plate, vehiclePrice)
                        TriggerClientEvent('vehicleshop.receiveInfo'), src, xPlayer.getInventoryItem('cash').money)   
                        TriggerClientEvent('vehicleshop.spawnVehicle', source, vehicleModel, vehicleProps.plate)                     
                    end)
                else
                    TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'inform', text = 'Paranız Yetersiz', length = 2500})

                end
            else
                TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'inform', text = 'Bu araca sahip değilsiniz.', length = 2500})
            end
        end
    end)
end)

RegisterNetEvent('esx_vehicleshop:setJobVehicleState')
AddEventHandler('esx_vehicleshop:setJobVehicleState', function(plate, state)
    local xPlayer = ESX.GetPlayerFromId(source)

    MySQL.Async.execute('UPDATE owned_vehicles SET `stored` = @stored WHERE plate = @plate AND job = @job', {
        ['@stored'] = state,
        ['@plate'] = plate,
        ['@job'] = xPlayer.job.name
    }, function(rowsChanged)
        if rowsChanged == 0 then
            print(('[esx_vehicleshop] [^3WARNING^7] %s exploited the garage!'):format(xPlayer.identifier))
        end
    end)
end)


ESX.RegisterServerCallback('esx_vehicleshop:retrieveJobVehicles', function(source, cb, type)
    local xPlayer = ESX.GetPlayerFromId(source)

    MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @owner AND type = @type AND job = @job', {
        ['@owner'] = xPlayer.identifier,
        ['@type'] = type,
        ['@job'] = xPlayer.job.name
    }, function(result)
        cb(result)
    end)
end)
Valla yapamadım arkadaşlar yapabilen varsa script bu

 
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!
// Adblock Kod Start // // Adblock Kod End//