[ESX] MSK Shopsystem - NativeUI & Database Feature

Tebex [4.20€]: https://www.msk-scripts.de/

Description

  • Set as many Shops as you want
  • You can also create Pawnshops
  • Set your own Notification [config.lua]
  • Set a Shopname for every Shop
  • Set the license that a player needs to buy an item or weapon
  • You can buy the corresponding license in this shop
  • Set Jobs and Grades who can access the Shop
  • Set a Pedmodel or Marker with 3dText
  • Set different Blips for every Shop and turn it on or off
  • Set as many locations for every Shop as you want
  • Set as many items or weapons that you want

Database Feature

  • You can set an max amount of every item in database. If the amount is 0 then you cant buy this item anymore.
  • If you sell an item then the amount will be added so you can buy the item again.

Config

Config = {}
----------------------------------------------------------------
Config.Locale = 'de' -- 'de', 'en'
Config.VersionChecker = true
Config.Debug = true
Config.getSharedObject = 'esx:getSharedObject'
----------------------------------------------------------------
Config.Hotkey = 38 -- default: 38 = E // Change the Key in translation.lua too
Config.npcVoice = true -- The NPC will say something to you
Config.textUI = {
    type = 'default', -- 'default', 'esx' or 'okok'
    color = 'darkblue', -- Only for okokTextUI
    position = 'left', -- Only for okokTextUI
    esx = 'info' -- Only for esx_textUI
}
Config.buyLicense = true -- Set false if you don't want that player can buy a license at the Shop
----------------------------------------------------------------
-- !!! If you set this to true make sure that you add ALL Items to your Database in 'msk_shops' Table !!!
-- You can set an max Amount of every item in database. If the amount is 0 then you cant buy this item anymore but still sell it.
-- Please add the database.sql to your Database
Config.useDatabase = false -- Set true if you want to use that Feature
----------------------------------------------------------------
-- If you want to use this Shop with your inventory Script add the trigger below

-- !!! For Chezza Inventory you have to set 'method' to 'money', 'bank', or 'black_money' !!!
-- example: {type = "item", name = "bread", method = 'money', price = 60, sellPrice = 120},
-- example: {type = "weapon", name = "WEAPON_PISTOL", method = 'money', ammo = 100, price = 60, sellPrice = 120},

-- Config.useDatabase won't work if Config.Inventory = true

Config.Inventory = false -- Set true if you want to use that feature
Config.openInventory = function(currentShop)
    TriggerEvent("inventory:openShop", currentShop.label, currentShop.items) -- Chezza Inventory
end
----------------------------------------------------------------
-- !!! This function is clientside AND serverside !!!
-- Look for type == 'client' and type == 'server'
Config.Notification = function(src, type, xPlayer, message) -- xPlayer = ESX.GetPlayerFromId(src)
    if type == 'client' then -- clientside
        ESX.ShowNotification(message) -- Replace this with your own notification
    elseif type == 'server' then -- serverside
        xPlayer.showNotification(message) -- Replace this with your own notification
    end
end
----------------------------------------------------------------
Config.Shops = {
    ['24/7'] = {
        label = '24/7 Shop',
        -- Set 'method' to true or 'black_money' // If 'black_money' the Players can buy or sell with black_money too
        -- Set 'type' to 'license' or 'item'
        license = {enable = false, type = 'license', label = 'Weaponlicense', name = 'weapon', method = true, price = 500},
        jobs = false, -- 'jobname' or false to disable
        grade = 0, -- default: 0 and all grades above
        pedmodel = 'mp_m_shopkeep_01', -- 'mp_m_shopkeep_01' or false to use a Marker instead
        text3d = {enable = true, label = '~g~Open Werkbank', size = 0.8},
        marker = {enable = true, type = 27, size = {a = 0.6, b = 0.6, c = 0.6}, color = {a = 255, b = 255, c = 255}},
        blip = {enable = true, id = 59, color = 2, scale = 0.8},
        locations = {
            {x = 1727.71, y = 6415.24, z = 35.04, h = 242.06},
            {x = 1697.65, y = 4923.14, z = 42.063, h = 352.85},
            {x = 1959.97, y = 3739.96, z = 32.34, h = 288.98},
            {x = 549.25, y = 2671.34, z = 42.156, h = 82.59},
            {x = 24.44, y = -1347.33, z = 29.5, h = 266.37},
            {x = -1070.54, y = -2836.5, z = 27.7, h = 283.93},
            {x = 372.48, y = 326.74, z = 103.57, h = 248.65},
            {x = 2556.94, y = 380.71, z = 108.62, h = 342.38},
            {x = -3039.04, y = 584.18, z = 7.91, h = 357.0},
            {x = -3242.54, y = 999.74, z = 12.830, h = 336.15},
            {x = 1134.12, y = -982.77, z = 46.42, h = 279.46},
            {x = -1222.16, y = -908.53, z = 12.33, h = 23.5},
            {x = -1486.21, y = -377.92, z = 40.163, h = 126.46},
            {x = -2966.28, y = 390.67, z = 15.043, h = 85.91},
            {x = -47.08, y = -1758.46, z = 29.421, h = 53.42},
            {x = 1164.883, y = -323.38, z = 69.21, h = 106.81},
            {x = -705.9601, y = -914.250, z = 19.215, h = 110.24},
            {x = -1819.8, y = 793.92, z = 138.09, h = 154.0},
            {x = 1392.69, y = 3606.548, z = 34.980, h = 186.81}, -- Sandy Shores
            {x = 1166.14, y = 2710.830, z = 38.157, h = 168.31}, -- Grand Senora
            {x = 2677.75, y = 3279.35, z = 55.22, h = 325.98}, -- East Highway
        },
        items = { 
            -- Set 'type' to 'item' or 'weapon' // If 'weapon' then add 'ammo = 100' // Write Weapons always in BIG LETTERS!! // example: "WEAPON_PISTOL"
            -- Set 'method' to true or 'black_money' // If 'black_money' the Players can buy or sell with black_money
            -- Set 'license' to true or false // If 'false' you dont need the license to buy this item. // If 'true' you need to buy the license first
            -- Set 'price' or 'sellPrice' to false to disable buy or sell function

            {type = "item", label = "Bread", name = "bread", method = true, license = false, price = 60, sellPrice = 30},
            {type = "item", label = "Hamburger", name = "hamburger", method = true, license = false, price = 80, sellPrice = 40},
            {type = "item", label = "Water", name = "water", method = true, license = false, price = 45, sellPrice = 20},
            {type = "item", label = "Icetea", name = "icetea", method = true, license = false, price = 55, sellPrice = 25},
            {type = "item", label = "Fruitjuice", name = "jusfruit", method = true, license = false, price = 50, sellPrice = 25},
            {type = "item", label = "Phone", name = "phone", method = true, license = false, price = 1200, sellPrice = 600},
            {type = "item", label = "Bandage", name = "bandage", method = true, license = false, price = 76, sellPrice = 40},
            {type = "item", label = "Beer", name = "beer", method = true, license = false, price = 85, sellPrice = 40},
            {type = "item", label = "Contract", name = "contract", method = true, license = false, price = 150, sellPrice = 80},
            {type = "item", label = "Backpack", name = "bag", method = true, license = false, price = 500, sellPrice = 300},
        }
    },
    ['weaponshop'] = {
        label = 'Weaponshop',
        -- Set 'method' to true or 'black_money' // If 'black_money' the Players can buy or sell with black_money too
        -- Set 'type' to 'license' or 'item'
        license = {enable = true, type = 'license', label = 'Weaponlicense', name = 'weapon', method = true, price = 1500},
        jobs = false, -- 'jobname' or false to disable
        grade = 0, -- default: 0 and all grades above
        pedmodel = 's_m_y_ammucity_01', -- 's_m_y_ammucity_01' or false to use a Marker instead
        text3d = {enable = true, label = '~g~Open Werkbank', size = 0.8},
        marker = {enable = true, type = 27, size = {a = 0.6, b = 0.6, c = 0.6}, color = {a = 255, b = 255, c = 255}},
        blip = {enable = true, id = 110, color = 81, scale = 0.8},
        locations = { -- You can set multiple locations
            {x = -661.767, y = -933.6132, z = 21.81, h = 153.07},   -- PLZ: 8140
            {x = 809.73, y = -2159.09, z = 29.61, h= 334.48},       -- PLZ: 9275
            {x = 1692.75, y = 3761.53, z = 34.68, h = 201.25},      -- PLZ: 3018
            {x = -331.18, y = 6085.64, z = 31.45, h = 192.75},      -- PLZ: 1034
            {x = 253.59, y = -51.44, z = 69.93, h = 51.02},         -- PLZ: 7121
            {x = 23.1, y = -1105.6, z = 29.8, h = 164.4},          -- PLZ: 8168
            {x = 253.72, y = -51.23, z = 69.93, z = 51.02},         -- PLZ: 7121
            {x = -1118.44, y = 2700.46, z = 18.54, h = 201.25},     -- PLZ: 5004
            {x = 841.49, y = -1035.32, z = 28.18, h = 342.99},      -- PLZ: 8194
        },
        items = { 
            -- Set 'type' to 'item' or 'weapon' // If 'weapon' then add 'ammo = 100' // Write Weapons always in BIG LETTERS!! // example: "WEAPON_PISTOL"
            -- Set 'method' to true or 'black_money' // If 'black_money' the Players can buy or sell with black_money
            -- Set 'license' to true or false // If 'false' you dont need the license to buy this item. // If 'true' you need to buy the license first
            -- Set 'price' or 'sellPrice' to false to disable buy or sell function

            {type = "weapon", label = "Flashlight", name = "WEAPON_FLASHLIGHT", method = true, ammo = 1, license = false, price = 100, sellPrice = 50},
            {type = "weapon", label = "Knife", name = "WEAPON_KNIFE", method = true, ammo = 1, license = false, price = 100, sellPrice = 50},
            {type = "weapon", label = "Bat", name = "WEAPON_BAT", method = true, ammo = 1, license = false, price = 100, sellPrice = 50},
            {type = "weapon", label = "Switchblade", name = "WEAPON_SWITCHBLADE", method = true, ammo = 1, license = true, price = 200, sellPrice = 100},
            {type = "weapon", label = "Pistol", name = "WEAPON_PISTOL", method = true, ammo = 100, license = true, price = 350, sellPrice = 2000},
            {type = "weapon", label = "SMG", name = "WEAPON_SMG", method = 'black_money', ammo = 100, license = true, price = 5000, sellPrice = 3000},
        }
    },
    ['baumarkt'] = {
        label = 'Baumarkt',
        -- Set 'method' to true or 'black_money' // If 'black_money' the Players can buy or sell with black_money too
        -- Set 'type' to 'license' or 'item'
        license = {enable = false, type = 'license', label = 'Weaponlicense', name = 'weapon', method = true, price = 500},
        jobs = false, -- 'jobname' or false to disable
        grade = 0, -- default: 0 and all grades above
        pedmodel = 'mp_m_shopkeep_01', -- 'mp_m_shopkeep_01' or false to use a Marker instead
        text3d = {enable = true, label = '~g~Open Werkbank', size = 0.8},
        marker = {enable = true, type = 27, size = {a = 0.6, b = 0.6, c = 0.6}, color = {a = 255, b = 255, c = 255}},
        blip = {enable = true, id = 59, color = 2, scale = 0.8},
        locations = {
            {x = 2749.29, y = 3483.47, z = 55.67, h = 70.64}, -- East Highway
        },
        items = {
            -- Set 'type' to 'item' or 'weapon' // If 'weapon' then add 'ammo = 100' // Write Weapons always in BIG LETTERS!! // example: "WEAPON_PISTOL"
            -- Set 'method' to true or 'black_money' // If 'black_money' the Players can buy or sell with black_money
            -- Set 'license' to true or false // If 'false' you dont need the license to buy this item. // If 'true' you need to buy the license first
            -- Set 'price' or 'sellPrice' to false to disable buy or sell function

            {type = "item", label = "Drill", name = "drill", method = true, license = false, price = 2500, sellPrice = 1800},
            {type = "item", label = "Oxygenmask", name = "oxygenmask", method = true, license = false, price = 5000, sellPrice = 3000},
            {type = "item", label = "Lockpick", name = "lockpick", method = true, license = false, price = 1500, sellPrice = 800},
            {type = "item", label = "Repairkit", name = "fixtool", method = true, license = false, price = 1500, sellPrice = 800},
            {type = "item", label = "Cuffs", name = "cuffs", method = true, license = false, price = 1120, sellPrice = 700},
            {type = "item", label = "Bottle", name = "glasbottle", method = true, license = false, price = 10, sellPrice = 6},
            {type = "weapon", label = "Parachute", name = "GADGET_PARACHUTE", method = true, license = false, ammo = 1, price = 500, sellPrice = 300},
        }
    },
}

Optional Requirements

  • okokTextUI
  • esx_textui
  • esx_license
Code accessible No
Subscription based No
Lines (approximately) ~ 730
Requirements ESX 1.2 or Legacy, NativeUI, mysql-async or oxmysql
Support Yes

My other Scripts

Changelogs

Update v2.0
  • Edited the config.lua for easier understanding and configuration
  • Added job grades

Re-download msk_shops at your keymaster

Update v1.9
  • Added notification function in config.lua
  • Added compatibility for inventory systems. Read the comments in config.lua for better understanding.

Re-download msk_shops at your keymaster

Update v1.8
  • You can edit the Marker by yourself

Re-download msk_shops at your keymaster

Update v1.7
  • Fixed Bug with Blips

Re-download msk_shops at your keymaster

Update v1.6
  • Fixed a price amount bug

Re-download msk_shops at your keymaster

Update v1.5
  • Fixed textUI function
  • Fixed useDatabse where the item amount is added to database even though you don’t have the item or amount of that item

Re-download msk_shops at your keymaster

Update v1.4
  • Fixed Error if sellPrice = false

Re-download msk_shops at your keymaster

Update v1.3
  • Fixed Error if only 1 item in shop and useDatabase activated
  • Fixed sell Function

Re-download msk_shops at your keymaster

Update v1.2
  • Fixed NPC Speech Voice
Update v.1.1
  • Added license check for items

You can choose in config if you want to check the license as an item or as a license

4 Likes

Good work like everytime <3

1 Like

Thank you :slight_smile:

nice! all script you … very nice like !

1 Like

why rage ui ? :smiling_face_with_tear:

It’s NativeUI

1 Like

why also it can’t make nice nui shop for this :star_struck:

there is actually no need to use a nui for such a simple shop.

its also something for those who want a server on a nativeui base.

1 Like

Its not that simple as it looks like but yeah its for those who want a NativeUI based Shop with many options.

I mean there arent many shops with all of that features that you can see in the config :slight_smile:

Update v1.1

  • Added license check for items

You can choose in config if you want to check the license as an item or as a license

Update v1.2

  • Fixed NPC Speech Voice

Update v1.3

  • Fixed Error if only 1 item in shop and useDatabase activated
  • Fixed sell Function

Re-download msk_shops at your keymaster

Update v1.4

  • Fixed Error if sellPrice = false

Re-download msk_shops at your keymaster

Update v1.5

  • Fixed textUI function
  • Fixed useDatabse where the item amount is added to database even though you don’t have the item or amount of that item

Re-download msk_shops at your keymaster

Update v1.6

  • Fixed a price amount bug

Re-download msk_shops at your keymaster

Update v1.7

  • Fixed Bug with Blips

Re-download msk_shops at your keymaster

Update v1.8

  • You can edit the Marker by yourself

Re-download msk_shops at your keymaster

Update v1.9

  • Added notification function in config.lua
  • Added compatibility for inventory systems.

Read the comments in config.lua for better understanding.

Update v2.0

➥ Edited the config.lua for easier understanding and configuration
➥ Added job grades

Re-download msk_shops at your keymaster