Documentation
  • Discord Server
  • About Us
  • Free Resources
    • Death Screen
      • PS-Dispatch Integration
    • Battlepass
      • Guides
      • Commands
        • Player Commands
        • Admin Commands
      • API
        • Server
    • Garages
      • Guides
        • Creating Interior
        • Creating Garage
        • How to find entity sets (customizations) for interior
  • Paid Resources
    • Elevator Creator V2
      • Installation
      • Accessible code
    • Radar System V2
      • Installation
      • Accessible code
    • Hotels Creator
      • Accessible code
    • Vehicle Shop Creator
      • Accessible code
    • Stocks Market
      • Accessible code
      • [DEV] - Usable Functions
    • Discord Voice Attendance
      • Installation
    • Deathmatch System
      • Installation
        • esx_ambulancejob
        • qb-ambulancejob
        • wasabi_ambulance
        • qbx_medical
        • codem-inventory
        • core_inventory
      • Accessible code
    • Object Creator
      • Dependencies
      • Accessible code
    • Cocaine Labs
      • Dependencies
      • Accessible code
    • Ownable Crafting Tables
      • Dependencies
      • Accessible code
      • Common Problems
    • Evidence System
      • Dependencies
      • Accessible code
      • Installation
      • API
    • Marketplace V2
      • Accessible code
      • Installation
      • Migration from V1
    • EMS Dispatch
      • Sending Dispatch
      • Accessing the Menu
      • Config File
    • Weed Planting
      • Accessible code
      • How to add new strain?
      • How to install
    • Advanced DarkNet System
      • Config
    • Advanced Taxi Job
      • Accessible code
      • Changelog
    • Advanced Gang Creator
      • Accessible code
      • Installation
        • QB Core
        • QBOX Core
      • API
      • FAQ
    • Advanced Private Cameras
      • ESX
        • Items
      • QBCore
        • Items
      • Accessible code
    • Advanced Elevator Creator
      • Accessible code
    • Advanced Ownable Rent Creator
      • SQL
      • ESX
      • QBCore
      • Config File
    • Advanced Job Creator
      • Installation
        • QB CORE
      • Accessible code
    • Advanced Ownable Shops
      • Installation
      • Accessible code
      • SQL
    • Advanced Ped Creator
      • SQL
      • Config File
    • Advanced Promocode Creator
      • Accessible code
      • SQL File
      • Common problems
    • Advanced Safe Zone Creator
      • Config File
    • Turf Wars
      • Ox Inventory
      • Accessible code
      • API
    • Advanced Gas Station Creator
      • Accessible code
    • Advanced Advertisements System
      • SQL File
      • Accessible code
    • Player Manager
      • Installation
      • Accessible code
    • Mechanic Job
      • Installation
      • Accessible code
      • SQL
    • Advanced Radar System
      • Accessible code
      • SQL
    • Crypto Mining
      • Installation
      • Accessible code
      • Items
      • SQL
    • Racing System
      • Accessible code
    • Car Theft
      • Accessible code
    • Advanced Solar Panels
      • Accessible Code
      • SQL
      • ESX
        • Items
      • QBCore
        • Items
    • Pilot Job
      • Accessible Code
      • ESX
        • SQL
      • QBCore
        • Metadata
        • qb-smallresources
      • QBOX
        • Metadata
    • Advanced Ownable Banks
      • Accessible Code
    • Post Office
      • Accessible Code
      • ESX
        • SQL
      • QBCore
        • SQL
      • Exports
    • Weather Sync
      • API
    • Billing System
      • Accessible code
      • SQL
      • Common problems
Powered by GitBook
On this page
  1. Paid Resources
  2. Marketplace V2

Accessible code

-- here you can put your notifications that you have on server

-- msg: message that will be shown 
-- type: success and error

RegisterNetEvent('uniq_vmp:notify', function(msg, type)
    lib.notify({
        description = msg,
        type = type
    })
end)


-- https://overextended.dev/ox_lib/Modules/Interface/Client/skillcheck
if Config.VehicleStealing then
    function StartHack()
        local success = lib.skillCheck({'hard'}, {'w', 'a', 's', 'd'})

        return success
    end
end

function OpenManageEmployeesMenu()
    if IsESX() then
        TriggerEvent('esx_society:openBossMenu', GetJob(), function(data, menu)

		end, { wash = false }) -- disable washing money
    elseif IsQBCore() then
        TriggerEvent('qb-bossmenu:client:OpenMenu')
    end
end


local qs = GetResourceState('qs-vehiclekeys'):find('start')
local qb = GetResourceState('qb-vehiclekeys'):find('start')

function GiveKeys(vehicle, plate)
    if qs then
        exports['qs-vehiclekeys']:GiveKeys(plate, vehicle, false)
    elseif qb then
        TriggerServerEvent('qb-vehiclekeys:server:AcquireVehicleKeys', plate)
    end
end
Config = {}
Locales = {}
Config.Locale = 'en'

Config.UseTarget = true

Config.TextUIPositin = 'top-center' -- 'right-center' or 'left-center'

Config.Inventory = 'ox_inventory' -- or 'qs-inventory' or 'qb-inventory' or 'ps-inventory'

-- only for esx, some people love to change boss grade name to something else
Config.BossGradeName = 'boss'


Config.DebugZone = false -- to see lines of zones turn this on

-- jobs that cant steal vehicle from store
Config.JobsThatCantStealVeh = {
    ['police'] = true
}


/*
	name of command for reloading vehicles at marketplace
    if it says you dont have permission to use it add next to server cfg
    add_ace identifier.steam:hex command.rmarketplace allow

    identifier can be .steam, .discord, .license


    you can also do in live server, in console write next
    add_ace player.YOUR_ID command.rmarketplace allow
*/

Config.ReloadMarketPlaceCommand = 'rmarketplace'


Config.VehicleStealing = true
Config.VehicleAlarm = math.random(15000, 30000) -- between 15 and 30 sec / for how long alarm will be turned on

Config.HoursType = 'ingame'    -- or 'realtime' / if 'ingame' it will take hours from game, if 'realtime' it will take system time
-- MUST BE 24H FORMAT
Config.StealingHous = {21, 6}   -- between which hours it could be stolen, if you dont want strict hours, put Config.StealingHous = false 


Config.Ped = `a_m_m_business_01`

Config.Zones = {
    ['Marketplace A'] = {
        name = 'Marketplace A',
        pedPos = vec4(-2030.404, -465.107, 10.604, 144.599), -- only apperas if shop is owned by player or job, PED MUST BE INSIDE ZONE
        poly = {
            thickness = 7, -- how hight it goes from ground
            points = { -- Z always must be same in all points
                vec(-2068.306, -453.769, 10),
                vec(-2031.050, -484.583, 10),
                vec(-2019.984, -471.033, 10),
                vec(-2057.774, -439.734, 10)
            },
        },

        -- could be
        /*
            owner = false               -- standalone store, everyone can put their vehicles at store
            owner = 'identifier'        -- single owner, only one person can run store
            owner = {['police'] = 1}    -- ownerd by job (example job police grade 0 and above can access store)
        */
        owner = {['police'] = 1},

        blip = {
            enable = 4, -- 0 to disable, 4 to enable, read more here https://docs.fivem.net/natives/?_0x9029B2F3DA924928
            coords = vec3(-2030.404, -465.107, 10.604), -- coords of blip
            sprite = 227, -- sprite of blip  https://docs.fivem.net/docs/game-references/blips/
            color = 1, -- colour of blip https://docs.fivem.net/docs/game-references/blips/
            scale = 0.8,
        }

    },
}


-- preacit iz inv export za davanje novca u core funckiju
-- provjerit kako radi points opcija na esx qb 
-- docs pisat
-- tutorial kako napravit zonu

Config.VehicleColors = {
    [0] = '#0d1116',
    [1] = '#1c1d21',
    [2] = '#32383d',
    [3] = '#454b4f',
    [4] = '#999da0',
    [5] = '#c2c4c6',
    [6] = '#979a97',
    [7] = '#637380',
    [8] = '#63625c',
    [9] = '#3c3f47',
    [10] = '#444e54',
    [11] = '#1d2129',
    [12] = '#13181f',
    [13] = '#26282a',
    [14] = '#515554',
    [15] = '#151921',
    [16] = '#1e2429',
    [17] = '#333a3c',
    [18] = '#8c9095',
    [19] = '#39434d',
    [20] = '#506272',
    [21] = '#1e232f',
    [22] = '#363a3f',
    [23] = '#a0a199',
    [24] = '#d3d3d3',
    [25] = '#b7bfca',
    [26] = '#778794',
    [27] = '#c00e1a',
    [28] = '#da1918',
    [29] = '#b6111b',
    [30] = '#a51e23',
    [31] = '#7b1a22',
    [32] = '#8e1b1f',
    [33] = '#6f1818',
    [34] = '#49111d',
    [35] = '#b60f25',
    [36] = '#d44a17',
    [37] = '#c2944f',
    [38] = '#f78616',
    [39] = '#cf1f21',
    [40] = '#732021',
    [41] = '#f27d20',
    [42] = '#ffc91f',
    [43] = '#9c1016',
    [44] = '#de0f18',
    [45] = '#8f1e17',
    [46] = '#a94744',
    [47] = '#b16c51',
    [48] = '#371c25',
    [49] = '#132428',
    [50] = '#122e2b',
    [51] = '#12383c',
    [52] = '#31423f',
    [53] = '#155c2d',
    [54] = '#1b6770',
    [55] = '#66b81f',
    [56] = '#22383e',
    [57] = '#1d5a3f',
    [58] = '#2d423f',
    [59] = '#45594b',
    [60] = '#65867f',
    [61] = '#222e46',
    [62] = '#233155',
    [63] = '#304c7e',
    [64] = '#47578f',
    [65] = '#637ba7',
    [66] = '#394762',
    [67] = '#d6e7f1',
    [68] = '#76afbe',
    [69] = '#345e72',
    [70] = '#0b9cf1',
    [71] = '#2f2d52',
    [72] = '#282c4d',
    [73] = '#2354a1',
    [74] = '#6ea3c6',
    [75] = '#112552',
    [76] = '#1b203e',
    [77] = '#275190',
    [78] = '#608592',
    [79] = '#2446a8',
    [80] = '#4271e1',
    [81] = '#3b39e0',
    [82] = '#1f2852',
    [83] = '#253aa7',
    [84] = '#1c3551',
    [85] = '#4c5f81',
    [86] = '#58688e',
    [87] = '#74b5d8',
    [88] = '#ffcf20',
    [89] = '#fbe212',
    [90] = '#916532',
    [91] = '#e0e13d',
    [92] = '#98d223',
    [93] = '#9b8c78',
    [94] = '#503218',
    [95] = '#473f2b',
    [96] = '#221b19',
    [97] = '#653f23',
    [98] = '#775c3e',
    [99] = '#ac9975',
    [100] = '#6c6b4b',
    [101] = '#402e2b',
    [102] = '#a4965f',
    [103] = '#46231a',
    [104] = '#752b19',
    [105] = '#bfae7b',
    [106] = '#dfd5b2',
    [107] = '#f7edd5',
    [108] = '#3a2a1b',
    [109] = '#785f33',
    [110] = '#b5a079',
    [111] = '#fffff6',
    [112] = '#eaeaea',
    [113] = '#b0ab94',
    [114] = '#453831',
    [115] = '#2a282b',
    [116] = '#726c57',
    [117] = '#6a747c',
    [118] = '#354158',
    [119] = '#9ba0a8',
    [120] = '#5870a1',
    [121] = '#eae6de',
    [122] = '#dfddd0',
    [123] = '#f2ad2e',
    [124] = '#f9a458',
    [125] = '#83c566',
    [126] = '#f1cc40',
    [127] = '#4cc3da',
    [128] = '#4e6443',
    [129] = '#bcac8f',
    [130] = '#f8b658',
    [131] = '#fcf9f1',
    [132] = '#fffffb',
    [133] = '#81844c',
    [134] = '#ffffff',
    [135] = '#f21f99',
    [136] = '#fdd6cd',
    [137] = '#df5891',
    [138] = '#f6ae20',
    [139] = '#b0ee6e',
    [140] = '#08e9fa',
    [141] = '#0a0c17',
    [142] = '#0c0d18',
    [143] = '#0e0d14',
    [144] = '#9f9e8a',
    [145] = '#621276',
    [146] = '#0b1421',
    [147] = '#11141a',
    [148] = '#6b1f7b',
    [149] = '#1e1d22',
    [150] = '#bc1917',
    [151] = '#2d362a',
    [152] = '#696748',
    [153] = '#7a6c55',
    [154] = '#c3b492',
    [155] = '#5a6352',
    [156] = '#81827f',
    [157] = '#afd6e4',
    [158] = '#7a6440',
    [159] = '#7f6a48',

}


Config.XenonColors = {
    ['-1'] = '#4c7193',
    ['0'] = '#FFFFFF',
    ['1'] = '#042259',
    ['2'] = '#2288b9',
    ['3'] = '#04d8bf',
    ['4'] = '#86bc04',
    ['5'] = '#cbd404',
    ['6'] = '#d4bb1c',
    ['7'] = '#be5904',
    ['8'] = '#800404',
    ['9'] = '#FFC0CB',
    ['10'] = '#ff6cb4',
    ['11'] = '#55165e',
    ['12'] = '#5c0cec',
}

-- qb
-- nd
Discord = {

    url = '',  -- url here

    title = 'Server Name',

    /*
        https://www.spycolor.com/

        ['default'] = 14423100,
        ['blue'] = 255,
        ['red'] = 16711680,
        ['green'] = 65280,
        ['white'] = 16777215,
        ['black'] = 0,
        ['orange'] = 16744192,
        ['yellow'] = 16776960,
        ['pink'] = 16761035,
        ['lightgreen'] = 65309,
    */

    color = 65309, -- green

    imageUrl = 'https://cdn.discordapp.com/attachments/1126197898439295066/1129791542379434004/discord_banner_uniq.png', -- optional, if you dont want it put ''
}

function GiveCarKeys(src, plate)
    TriggerClientEvent('vehiclekeys:client:SetOwner', src, plate) -- qb core
end
-- for buying veh / deposit
function canAfford(source, price)
    if IsESX() then
        -- prebacit u funkciju iz cora za skidanje para
        if Config.Inventory == 'ox_inventory' then
            if exports.ox_inventory:GetItemCount(source, 'money') >= price then
                exports.ox_inventory:RemoveItem(source, 'money', price)
                return true
            end
        elseif Config.Inventory == 'qs-inventory' then
            if exports['qs-inventory']:GetItemTotalAmount(source, 'money') >= price then
                exports['qs-inventory']:RemoveItem(source, 'money', price)
                return true
            end
        elseif Config.Inventory == 'qb-inventory' or Config.Inventory == 'ps-inventory'  then
            local Player = QBCore.Functions.GetPlayer(source)
            local money = Player.Functions.GetMoney('cash')
            
            if money >= price then
                if Player.Functions.RemoveMoney('cash', price) then
                    return true
                end
            end
        else
            -- some other inventory that you use
        end
    elseif IsQBCore() then
        local Player = QBCore.Functions.GetPlayer(source)
        local money = Player.Functions.GetMoney('cash')

        if money >= price then
            if Player.Functions.RemoveMoney('cash', price) then
                return true
            end
        end
    end


    return false
end


-- for withdraw from store, boss
function GiveMoney(source, count)
    if IsESX() then
        if Config.Inventory == 'ox_inventory' then
            exports.ox_inventory:AddItem(source, 'money', count)
        elseif Config.Inventory == 'qs-inventory' then
            exports['qs-inventory']:AddItem(source, 'money', count)
        end
    elseif IsQBCore() then
        local Player = QBCore.Functions.GetPlayer(source)
        Player.Functions.AddMoney('cash', count)
    end
end


function UpdateOwned(owner, plate)
    if IsESX() then
        if owner and plate then
            MySQL.update('UPDATE `owned_vehicles` SET `owner` = ? WHERE `plate` = ?', {owner, plate})
        end
    elseif IsQBCore() then
        if owner and plate then
            MySQL.update('UPDATE `player_vehicles` SET `citizenid` = ? WHERE `plate` = ?', {owner, plate})
        end
    end
end


lib.callback.register('uniq-vmp:CheckOwnership', function(source, plate)
    if IsESX() then
        local result = MySQL.Sync.fetchAll('SELECT `owner`, `plate`, `vehicle` FROM `owned_vehicles` WHERE `plate` = ?', {plate})

        if result[1] then
            if tostring(result[1].owner) == tostring(GetIdentifer(source)) and string.strtrim(result[1].plate) == string.strtrim(plate) then
                return true, json.decode(result[1].vehicle)
            end
        end
    elseif IsQBCore() then
        local result = MySQL.Sync.fetchAll('SELECT `citizenid`, `plate`, `mods` FROM `player_vehicles` WHERE `plate` = ?', {plate})

        if result[1] then
            if tostring(result[1].citizenid) == tostring(GetIdentifer(source)) and string.strtrim(result[1].plate) == string.strtrim(plate) then
                return true, json.decode(result[1].vehicle)
            end
        end
    end
    
    return false
end)


function StealVehicle(plate, identifier)
    if IsESX() then
        MySQL.update('UPDATE `owned_vehicles` SET `owner` = ? WHERE `plate` = ?', {identifier, plate})
    elseif IsQBCore() then
        MySQL.update('UPDATE `player_vehicles` SET `citizenid` = ? WHERE `plate` = ?', {identifier, plate})
    end
    MySQL.query('DELETE FROM `reseller_vehicle` WHERE `plate` = ?', {plate})
end



-- when store is standalone we need way to give player money
function SoldVehicle(lastOwner, price)
    if IsESX() then
        local xPlayer = GetPlayerByIdentifier(lastOwner)

        if xPlayer then
            if Config.Inventory == 'ox_inventory' then
                exports.ox_inventory:AddItem(xPlayer.source, 'money', price)
            elseif Config.Inventory == 'qs-inventory' then
                exports['qs-inventory']:AddItem(xPlayer.source, 'money', price)
            end
            
            TriggerClientEvent('uniq_vmp:notify', xPlayer.source, ('You have sold vehicle at marketplace and got $%s'):format(price), 'success')
        else
            -- if offline player
            local balance = MySQL.query.await('SELECT `accounts` FROM `users` WHERE `identifier` = ?', {lastOwner})

            if balance[1] then
                local data = json.decode(balance[1].accounts)
                data.bank += price
                MySQL.update('UPDATE `users` SET `accounts` = ? WHERE `identifier` = ?', {json.encode(data), lastOwner})
            end
        end
    elseif IsQBCore() then
        local Player = GetPlayerByIdentifier(lastOwner)

        if Player then
            Player.Functions.AddMoney('cash', price, 'paycheck')
            
            TriggerClientEvent('uniq_vmp:notify', Player.PlayerData.source, ('You have sold vehicle at marketplace and got $%s'):format(price), 'success')
        else
            -- if offline player
            local balance = MySQL.query.await('SELECT `money` FROM `players` WHERE `citizenid` = ?', {lastOwner})

            if balance[1] then
                local data = json.decode(balance[1].money)
                data.bank += price
                MySQL.update('UPDATE `players` SET `money` = ? WHERE `citizenid` = ?', {json.encode(data), lastOwner})
            end
        end
    end
end
Locales['en'] = {
    ['title'] = 'Vehicle Marketplace',
    -- vehicle properties
    ['armor'] = 'Armor',
    ['brakes'] = 'Brakes',
    ['engine'] = 'Engine',
    ['suspension'] = 'Suspension',
    ['transmission'] = 'Transmission',
    ['turbo'] = 'Turbo',
    ['wcolor'] = 'Wheel Color',
    ['perlcolor'] = 'Pearlescent Color',
    ['neoncolor'] = 'Neons Color',
    ['xenoncolor'] = 'Xenon Color',
    ['primcolor'] = 'Primary Color',
    ['seccolor'] = 'Primary Color',
    ['level'] = 'Level %s',
    ['veh_props'] = 'Vehicle Properties',

    -- for xenonColor
    ['no.color'] = 'No color set',

    -- notify

    ['buy_veh_message'] = "Would you like to buy this vehicle for %s $ ?",
    ['cannot_afford'] = "You can't afford this vehicle",
    ['sucessfully_sold_vehicle'] = "You succesfully sold %s for %s $",
    ['not_enough_money_withdraw'] = "Your firm doesn't have that amount of money",
    ['otuside_zone'] = "You are outside zone",
    ['not.auth'] = 'You are not autohired to remove vehicle from store',
    ['no.data'] = 'We cant find data for this vehicle, contact server owner or developer',
    ['more.luck'] = 'More luck next time',
    ['hour.limit'] = 'You can only steal vehicles between %sh and %sh',
    ['no.options'] = 'No Options',
    ['migrate.no.point'] = 'You must be inside store zone to perform this',
    ['migrate.diff.veh'] = 'This vehicle is from different store than last one so move to new store',
    ['migrate.restart.script'] = 'Please restart script now',

    -- contex menu
    ['veh_price_dialog'] = "Price",
    ['sell_for_how_much'] = "Price?",
    ['money_balance'] = "Balance %s",
    ['withdraw_money_title'] = "Withdraw",
    ['deposit_money_title'] = "Deposit",
    ['purchase_history_title'] = "Sales History",
    ['how_much_withdraw'] = "Amount?",
    ['amount'] = 'Amount',
    ['how_much_deposit'] = "Amount ?",
    ['not_enough_money_deposit'] = "You dont have that ammount",
    ['sold_list_title'] = "ALL-TIME SOLD VEHICLES",
    ['sold_list_player'] = "%s, %s has bought %s for $%s", -- on date, name bought vehicle plate for price
    ['sort_by_date_title'] = "Sort by date",
    ['sort_by_price_title'] = "Sort by price",

    -- qtarget

    ['sell_vehicle_icon'] = "far fa-money-bill-alt",
    ['sell_vehicle'] = "Sell Vehicle",
    ['veh_not_owned'] = "You are not owner of vehicle",
    ['get_veh_info'] = "Vehicle Info",
    ['get_veh_info_icon'] = "fas fa-car",
    ['buy_veh'] = "Buy",
    ['buy_veh_icon'] = "fas fa-car",
    ['enter_firm'] = "Marketplace Actions",
    ['enter_firm_icon'] = "fa-solid fa-business-time",
    ['turn.engineon'] = 'Turn Engine On',
    ['turn.engineoff'] = 'Turn Engine Off',
    ['steal.vehicle'] = 'Steal Vehicle',
    ['remove_from_store'] = 'Remove from store',


    -- point (draw text)
    ['nearby.veh.ui'] = '[E] - Handle Vehicle',
    ['nearby.ped.ui'] = '[E] - Marketplace Actions',
    ['migrate.ui'] = '[E] - to save coords and heading for vehicle',

    -- selling veh
    ['sell.veh.ui'] = {
        ('------ Marketplace Vehicle Handler ------  \n'),
        ('By moving your mouse you are moving vehicle  \n'),
        ('[←] - Rotate vehicle left  \n'),
        ('[→] - Rotate vehicle right  \n'),
        ('[E] - Finish \n'),
    },

    
    -- boss
    ['not_auth_with'] = 'Only boss can do this',
    ['setJob_title'] = 'Employee Managment',

    -- dicsord logs

    ['sell.veh.title'] = 'New Vehicle at Marketplace',
    ['sell.veh.description'] = "`%s` has put the `%s` for sale for `$%s`, store `%s`",
    ['vehicle.bought.title'] = 'Bought Vehicle',
    ['vehicle.bought.description'] = "`%s` has bought `%s` for `$%s`, store `%s`",
    ['money.deposit.title'] = 'Money Deposit',
    ['money.deposit.description'] = "`%s` has deposited `$%s` into `%s`",
    ['money.withdraw.title'] = 'Money Withdraw',
    ['money.withdraw.description'] = "`%s` has withdrawn `$%s` from `%s`",
    ['steal.veh.title'] = 'Vehicle Stolen',
    ['steal.veh.description'] = '`%s` has stolen `%s` from `%s`',
    ['remove.veh.title'] = 'Removing Vehicle',
    ['remove.veh.description'] = '`%s` has removed `%s` from `%s`',
}
PreviousMarketplace V2NextInstallation

Last updated 11 months ago