# No\_Escrow

```lua
-- # Get Framework ------------------------------------------------------------------------------------

Sv_Framework = nil

if Config.Settings['Framework'] == "esx" then
    ESX = exports["es_extended"]:getSharedObject()
    Sv_Framework = "esx"
elseif Config.Settings['Framework'] == "oldesx" then
    ESX = nil
    TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
    Sv_Framework = "esx"
elseif Config.Settings['Framework'] == "qb" then
    QBCore = exports['qb-core']:GetCoreObject()
    Sv_Framework = "qb"
elseif Config.Settings['Framework'] == "oldqb" then
    QBCore = nil
    Sv_Framework = "qb"
    Citizen.CreateThread(function()
        while QBCore == nil do
            TriggerEvent('QBCore:GetObject', function(obj) QBCore = obj end)
            Citizen.Wait(200)
        end
    end)
elseif Config.Settings['Framework'] == "qbx" then
    if GetResourceState("qbx_core") == "started" then
        QBCore = exports['qbx-core']:GetCoreObject()
        Sv_Framework = "qbx"
    elseif GetResourceState("qbx-core") == "started" then
        QBCore = exports['qbx_core']:GetCoreObject()
        Sv_Framework = "qbx"
    end
end

-- # Functions ------------------------------------------------------------------------------------

Framework_Functions = {
    ["esx"] = {
        ["giveMoney"] = function(src, amount)
            local xPlayer = ESX.GetPlayerFromId(src)
            if xPlayer then
                xPlayer.addMoney(amount)
            end
        end,
        ["giveItem"] = function(src, item, amount)
            local xPlayer = ESX.GetPlayerFromId(src)
            if xPlayer then
                xPlayer.addInventoryItem(item, amount)
            end
        end,
        ["giveVehicle"] = function(src, vehicle)
            local xPlayer = ESX.GetPlayerFromId(src)
            if xPlayer then
                local plate = "ESX"..math.random(1000, 9999)
                if (Config.Settings['Database_Driver'] == "mysql-async") then
                    MySQL.Async.execute('INSERT INTO owned_vehicles (owner, vehicle, plate) VALUES (@owner, @vehicle, @plate)', {
                        ['@owner'] = xPlayer.identifier,
                        ['@vehicle'] = json.encode({model = vehicle, plate = plate}),
                        ['@plate'] = plate
                    }, function(rowsChanged) end)
                elseif (Config.Settings['Database_Driver'] == "ghmattimysql") then
                    exports.ghmattimysql:execute('INSERT INTO owned_vehicles (owner, vehicle, plate) VALUES (@owner, @vehicle, @plate)', {
                        ['@owner'] = xPlayer.identifier,
                        ['@vehicle'] = json.encode({model = vehicle, plate = plate}),
                        ['@plate'] = plate
                    }, function(result) end)
                elseif (Config.Settings['Database_Driver'] == "oxmysql") then
                    exports.oxmysql:execute('INSERT INTO owned_vehicles (owner, vehicle, plate) VALUES (?, ?, ?)', {
                        xPlayer.identifier,
                        json.encode({model = vehicle, plate = plate}),
                        plate
                    }, function(result) end)
                end
            end
        end
    },
    ["qb"] = {
        ["giveMoney"] = function(src, amount)
            local Player = QBCore.Functions.GetPlayer(src)
            if Player then
                Player.Functions.AddMoney('cash', amount)
            end
        end,
        ["giveItem"] = function(src, item, amount)
            local Player = QBCore.Functions.GetPlayer(src)
            if Player then
                Player.Functions.AddItem(item, amount)
                TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[item], 'add')
            end
        end,
        ["giveVehicle"] = function(src, vehicle)
            local Player = QBCore.Functions.GetPlayer(src)
            if Player then
                local plate = "QB"..math.random(1000, 9999)
                if (Config.Settings['Database_Driver'] == "ghmattimysql") then
                    exports.ghmattimysql:execute('INSERT INTO player_vehicles (license, citizenid, vehicle, hash, mods, plate) VALUES (@license, @citizenid, @vehicle, @hash, @mods, @plate)', {
                        ['@license'] = Player.PlayerData.license,
                        ['@citizenid'] = Player.PlayerData.citizenid,
                        ['@vehicle'] = vehicle,
                        ['@hash'] = GetHashKey(vehicle),
                        ['@mods'] = '{}',
                        ['@plate'] = plate
                    }, function(result) end)
                elseif (Config.Settings['Database_Driver'] == "mysql-async") then
                    MySQL.Async.execute('INSERT INTO player_vehicles (license, citizenid, vehicle, hash, mods, plate) VALUES (@license, @citizenid, @vehicle, @hash, @mods, @plate)', {
                        ['@license'] = Player.PlayerData.license,
                        ['@citizenid'] = Player.PlayerData.citizenid,
                        ['@vehicle'] = vehicle,
                        ['@hash'] = GetHashKey(vehicle),
                        ['@mods'] = '{}',
                        ['@plate'] = plate
                    }, function(rowsChanged) end)
                elseif (Config.Settings['Database_Driver'] == "oxmysql") then
                    exports.oxmysql:execute('INSERT INTO player_vehicles (license, citizenid, vehicle, hash, mods, plate) VALUES (?, ?, ?, ?, ?, ?)', {
                        Player.PlayerData.license,
                        Player.PlayerData.citizenid,
                        vehicle,
                        GetHashKey(vehicle),
                        '{}',
                        plate
                    }, function(affectedRows) end)
                end
            end
        end
    },
    ["qbx"] = {
        ["giveMoney"] = function(src, amount)
            local Player = QBCore.Functions.GetPlayer(src)
            if Player then
                Player.Functions.AddMoney('cash', amount)
            end
        end,
        ["giveItem"] = function(src, item, amount)
            local Player = QBCore.Functions.GetPlayer(src)
            if Player then
                Player.Functions.AddItem(item, amount)
                TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[item], 'add')
            end
        end,
        ["giveVehicle"] = function(src, vehicle)
            local Player = QBCore.Functions.GetPlayer(src)
            if Player then
                local plate = "QB"..math.random(1000, 9999)
                if (Config.Settings['Database_Driver'] == "ghmattimysql") then
                    exports.ghmattimysql:execute('INSERT INTO player_vehicles (license, citizenid, vehicle, hash, mods, plate) VALUES (@license, @citizenid, @vehicle, @hash, @mods, @plate)', {
                        ['@license'] = Player.PlayerData.license,
                        ['@citizenid'] = Player.PlayerData.citizenid,
                        ['@vehicle'] = vehicle,
                        ['@hash'] = GetHashKey(vehicle),
                        ['@mods'] = '{}',
                        ['@plate'] = plate
                    }, function(result) end)
                elseif (Config.Settings['Database_Driver'] == "mysql-async") then
                    MySQL.Async.execute('INSERT INTO player_vehicles (license, citizenid, vehicle, hash, mods, plate) VALUES (@license, @citizenid, @vehicle, @hash, @mods, @plate)', {
                        ['@license'] = Player.PlayerData.license,
                        ['@citizenid'] = Player.PlayerData.citizenid,
                        ['@vehicle'] = vehicle,
                        ['@hash'] = GetHashKey(vehicle),
                        ['@mods'] = '{}',
                        ['@plate'] = plate
                    }, function(rowsChanged) end)
                elseif (Config.Settings['Database_Driver'] == "oxmysql") then
                    exports.oxmysql:execute('INSERT INTO player_vehicles (license, citizenid, vehicle, hash, mods, plate) VALUES (?, ?, ?, ?, ?, ?)', {
                        Player.PlayerData.license,
                        Player.PlayerData.citizenid,
                        vehicle,
                        GetHashKey(vehicle),
                        '{}',
                        plate
                    }, function(affectedRows) end)
                end
            end
        end
    }
}
```
