[ESX] MSK Shopsystem - NativeUI & Database Feature

Tebex [3.80€]: https://mskscripts.tebex.io/

Description

  • Set as many Shops as you want
  • You can also create Pawnshops
  • Set a Shopname for every Shop
  • Set a license that you need to buy an item or weapon for a certain item
  • You can buy the corresponding license in this shop
  • Set a job that you need to enter the Shop
  • Choose if you want a NPC or a Marker for a certain Shop
  • Set different Blips for every Shop
  • 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 = false
Config.getSharedObject = 'esx:getSharedObject'
----------------------------------------------------------------
Config.Hotkey = 38 -- default: 38 = E // Change the Key in translation.lua too
Config.textUI = 'default' -- 'default', 'esx' or 'okok'
Config.npcVoice = true -- The NPC will say something to you
----------------------------------------------------------------
-- !!! 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.
-- 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},

-- 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 license to {type = 'license', label = 'Weaponlicense', name = 'weapon', method = true, price = 500} or false to disable
        -- 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 = false,
        jobs = false, -- 'jobname' or false to disable
        pedmodel = 'mp_m_shopkeep_01', -- 'mp_m_shopkeep_01' or false to use a Marker instead
        draw3dtext = {label = '~g~Open 24/7', size = 0.8}, -- {label = '~g~Open 24/7', size = 0.8} or false to disable
        blip = {id = 59, color = 2, scale = 0.8}, -- {id = 59, color = 2, scale = 0.8} or false to disable
        locations = { -- You can set multiple 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},
        },
        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 = 120},
            {type = "weapon", label = "Pistol", name = "WEAPON_PISTOL", method = true, license = true, price = 80, sellPrice = 120, ammo = 100},
            {type = "weapon", label = "SMG", name = "WEAPON_SMG", method = 'black_money', license = true, price = 45, sellPrice = 120, ammo = 100},
        }
    },
}

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 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