[PAID][ESX] David Shops [STARTER VERSION]

A script by David_HD

No reviews yet.
[PAID][ESX] David Shops [STARTER VERSION] main image

Full Description

Dear reader!

I have always wanted to create a shop resource but I had over complicated it every time when I worked on it, so I thought that maybe it would be better if I create a shop resource with different package levels. There will be three package levels, this one will be the STARTER level resource.

This resource contains non-player owned shops, a custom shopping interface, a robbing system and almost everything can be easily configured inside the config file. Default shops are already added to the config file, so if you don't want to change anything you can just use this as a plug and play resource, the only thing you need to watch out is the dependencies/requirements.

Screenshots







Configuration file


Config = {}

Config.OldESX = false -- Set this to true if your ESX version is lower than 1.9.0.

Config.UseOxTarget = true -- Use marker or ox_target for shop interaction.
Config.ShowCategories = true -- You can set if you want to show categories under the items. It can be selected and the items will be categorized.
Config.MoneySignBeforeAmount = false -- This means where you want to appear the money sign, before or after the price ($20 or 20$).

Config.ItemImagesURL = "ox_inventory/web/images/" -- This is where the item images can be found inside a resource folder.
Config.RenderRange = 150.0 -- From how far away the ped and the markers will be appear/rendered from the shop.
Config.AmountToRob = { 500, 1200 } -- How much a player can rob during a robbery.
Config.BagPickupDistance = 1.25 -- How far away the player need to be able to pick up the bag.
Config.RobbingCooldown = 60 -- How long time it will need to reset the shop (60 minutes by default).
Config.PoliceJob = "police" -- How the police job named.
Config.PoliceNumberNeeded = 5 -- Police officers needed to be able to start a robbery.
Config.CashierReactTime = 0.2 -- How long time should pass before the cashier realise that he need to start packing the money (20 seconds by default).

-- ONLY MODIFY THESE PARAMETERS IF YOU KNOW WHAT ARE YOU DOING --
Config.EmployeeHash = 416176080 -- Hash number of the employee.
Config.RobBagHash = -1194335261 -- Hash number of the bag.
Config.CashRegisterHash = 303280717 -- Hash number of the working register.
Config.CashRegisterBrokenHash = -354930144 -- Hash number of the broken register.
-- ONLY MODIFY THESE PARAMETERS IF YOU KNOW WHAT ARE YOU DOING --

Config.BlipSettings = { -- This is where you can set how the shop icon should appear on the map.
    show = true, -- The shop icons should appear on the map.
    shopIcon = 59, -- Set the shop icon.
    color = 2, -- Set the icon color.
    size = 0.75, -- Set the icon size.
    text = "Shop" -- Set the text for the icon.
}

Config.MarkerSettings = { -- This is where you can set marker parameters (This will be all disabled if you use ox_target).
    shouldRotate = true, -- Should the marker rotate.
    faceCamera = false, -- Should the marker always face towards the camera.
    moveUpAndDown = false, -- Should the marker move a little up and down.
    size = {1.0, 1.0, 1.0}, -- Size of the marker.
    color = {0, 255, 0, 80}, -- Color of the marker.
    interactRange = 1.0, -- From how far the player will be able to interact.
    type = 29 -- The type of the marker.
}

Config.Shops = { -- This is where the shops are defined.
    [1] = {
        name = "LTD Gasoline",
        coords = vector3(-707.9543, -914.6928, 19.21558),
        entity = { -- Settings about the cashier npc.
            coords = vector3(-705.9148, -913.4557, 19.21561),
            heading = 88.49136
        },
        availableItems = { -- These are the items the players can buy, with the price and category. This item names are in the database, the display name comes from there.
            ["fixkit"] = { price = 35, category = "tools" },
            ["cola"] = { price = 10, category = "drink" },
            ["water"] = { price = 3, category = "drink" },
            ["donut"] = { price = 15, category = "food" },
            ["beer"] = { price = 10, category = "drink" },
            ["phone"] = { price = 50, category = "electronics" },
            ["bandage"] = { price = 10, category = "medical" },
            ["medikit"] = { price = 20, category = "medical" },
            ["burger"] = { price = 15, category = "food" },
            ["hotdog"] = { price = 10, category = "food" },
            ["candy"] = { price = 10, category = "food" },
            ["fertilizer"] = { price = 30, category = "medical" },
            ["cigarette"] = { price = 75, category = "other" },
        }
    },
    [2] = {
        name = "LTD Gasoline",
        coords = vector3(-1223.018, -906.6315, 12.32636),
        entity = {
            coords = vector3(-1221.693, -908.2266, 12.32636),
            heading = 38.72625
        },
        availableItems = {
            ["fixkit"] = { price = 5, category = "food" },
            ["cola"] = { price = 10, category = "food" },
            ["water"] = { price = 3, category = "drink" },
            ["donut"] = { price = 15, category = "food" },
            ["beer"] = { price = 10, category = "food" },
            ["phone"] = { price = 50, category = "electronics" },
            ["bandage"] = { price = 10, category = "medical" },
            ["medikit"] = { price = 20, category = "medical" }
        }
    },
    [3] = {
        name = "LTD Gasoline",
        coords = vector3(374.7468, 327.6589, 103.5664),
        entity = {
            coords = vector3(372.9372, 328.4662, 103.5664),
            heading = 261.2641
        },
        availableItems = {
            ["fixkit"] = { price = 5, category = "food" },
            ["cola"] = { price = 10, category = "food" },
            ["water"] = { price = 3, category = "drink" },
            ["donut"] = { price = 15, category = "food" },
            ["beer"] = { price = 10, category = "food" },
            ["phone"] = { price = 50, category = "electronics" },
            ["bandage"] = { price = 10, category = "medical" },
            ["medikit"] = { price = 20, category = "medical" }
        }
    },
    [4] = {
        name = "LTD Gasoline",
        coords = vector3(2555.384, 382.6863, 108.6229),
        entity = {
            coords = vector3(2555.036, 380.7611, 108.6231),
            heading = 1.648418
        },
        availableItems = {
            ["fixkit"] = { price = 5, category = "food" },
            ["cola"] = { price = 10, category = "food" },
            ["water"] = { price = 3, category = "drink" },
            ["donut"] = { price = 15, category = "food" },
            ["beer"] = { price = 10, category = "food" },
            ["phone"] = { price = 50, category = "electronics" },
            ["bandage"] = { price = 10, category = "medical" },
            ["medikit"] = { price = 20, category = "medical" }
        }
    },
    [5] = {
        name = "LTD Gasoline",
        coords = vector3(-3041.154, 585.6349, 7.908928),
        entity = {
            coords = vector3(-3040.897, 583.7122, 7.908928),
            heading = 19.65504
        },
        availableItems = {
            ["fixkit"] = { price = 5, category = "food" },
            ["cola"] = { price = 10, category = "food" },
            ["water"] = { price = 3, category = "drink" },
            ["donut"] = { price = 15, category = "food" },
            ["beer"] = { price = 10, category = "food" },
            ["phone"] = { price = 50, category = "electronics" },
            ["bandage"] = { price = 10, category = "medical" },
            ["medikit"] = { price = 20, category = "medical" }
        }
    },
    [6] = {
        name = "LTD Gasoline",
        coords = vector3(-3244.006, 1001.876, 12.83071),
        entity = {
            coords = vector3(-3244.374, 999.9874, 12.83071),
            heading = 2.025029
        },
        availableItems = {
            ["fixkit"] = { price = 5, category = "food" },
            ["cola"] = { price = 10, category = "food" },
            ["water"] = { price = 3, category = "drink" },
            ["donut"] = { price = 15, category = "food" },
            ["beer"] = { price = 10, category = "food" },
            ["phone"] = { price = 50, category = "electronics" },
            ["bandage"] = { price = 10, category = "medical" },
            ["medikit"] = { price = 20, category = "medical" }
        }
    },
    [7] = {
        name = "LTD Gasoline",
        coords = vector3(547.4432, 2669.203, 42.1565),
        entity = {
            coords = vector3(549.5496, 2669.325, 42.1565),
            heading = 100.7829
        },
        availableItems = {
            ["fixkit"] = { price = 5, category = "food" },
            ["cola"] = { price = 10, category = "food" },
            ["water"] = { price = 3, category = "drink" },
            ["donut"] = { price = 15, category = "food" },
            ["beer"] = { price = 10, category = "food" },
            ["phone"] = { price = 50, category = "electronics" },
            ["bandage"] = { price = 10, category = "medical" },
            ["medikit"] = { price = 20, category = "medical" }
        }
    },
    [8] = {
        name = "LTD Gasoline",
        coords = vector3(1960.711, 3742.495, 32.34374),
        entity = {
            coords = vector3(1958.891, 3741.745, 32.34374),
            heading = 304.4779
        },
        availableItems = {
            ["fixkit"] = { price = 5, category = "food" },
            ["cola"] = { price = 10, category = "food" },
            ["water"] = { price = 3, category = "drink" },
            ["donut"] = { price = 15, category = "food" },
            ["beer"] = { price = 10, category = "food" },
            ["phone"] = { price = 50, category = "electronics" },
            ["bandage"] = { price = 10, category = "medical" },
            ["medikit"] = { price = 20, category = "medical" }
        }
    },
    [9] = {
        name = "LTD Gasoline",
        coords = vector3(2677.352, 3281.752, 55.24113),
        entity = {
            coords = vector3(2676.115, 3280.237, 55.24114),
            heading = 337.0381
        },
        availableItems = {
            ["fixkit"] = { price = 5, category = "food" },
            ["cola"] = { price = 10, category = "food" },
            ["water"] = { price = 3, category = "drink" },
            ["donut"] = { price = 15, category = "food" },
            ["beer"] = { price = 10, category = "food" },
            ["phone"] = { price = 50, category = "electronics" },
            ["bandage"] = { price = 10, category = "medical" },
            ["medikit"] = { price = 20, category = "medical" }
        }
    },
    [10] = {
        name = "LTD Gasoline",
        coords = vector3(1730.334, 6416.136, 35.03723),
        entity = {
            coords = vector3(1728.669, 6417.095, 35.03723),
            heading = 250.5518
        },
        availableItems = {
            ["fixkit"] = { price = 5, category = "food" },
            ["cola"] = { price = 10, category = "food" },
            ["water"] = { price = 3, category = "drink" },
            ["donut"] = { price = 15, category = "food" },
            ["beer"] = { price = 10, category = "food" },
            ["phone"] = { price = 50, category = "electronics" },
            ["bandage"] = { price = 10, category = "medical" },
            ["medikit"] = { price = 20, category = "medical" }
        }
    },
    [11] = {
        name = "LTD Gasoline",
        coords = vector3(1136.198, -982.5228, 46.41579),
        entity = {
            coords = vector3(1134.152, -982.7167, 46.4158),
            heading = 282.6075
        },
        availableItems = {
            ["fixkit"] = { price = 5, category = "food" },
            ["cola"] = { price = 10, category = "food" },
            ["water"] = { price = 3, category = "drink" },
            ["donut"] = { price = 15, category = "food" },
            ["beer"] = { price = 10, category = "food" },
            ["phone"] = { price = 50, category = "electronics" },
            ["bandage"] = { price = 10, category = "medical" },
            ["medikit"] = { price = 20, category = "medical" }
        }
    },
    [12] = {
        name = "LTD Gasoline",
        coords = vector3(-1487.834, -379.2067, 40.16338),
        entity = {
            coords = vector3(-1486.351, -377.8446, 40.16338),
            heading = 137.2389
        },
        availableItems = {
            ["fixkit"] = { price = 5, category = "food" },
            ["cola"] = { price = 10, category = "food" },
            ["water"] = { price = 3, category = "drink" },
            ["donut"] = { price = 15, category = "food" },
            ["beer"] = { price = 10, category = "food" },
            ["phone"] = { price = 50, category = "electronics" },
            ["bandage"] = { price = 10, category = "medical" },
            ["medikit"] = { price = 20, category = "medical" }
        }
    },
    [13] = {
        name = "LTD Gasoline",
        coords = vector3(-2968.402, 391.2827, 15.0433),
        entity = {
            coords = vector3(-2966.314, 391.0984, 15.0433),
            heading = 93.60521
        },
        availableItems = {
            ["fixkit"] = { price = 5, category = "food" },
            ["cola"] = { price = 10, category = "food" },
            ["water"] = { price = 3, category = "drink" },
            ["donut"] = { price = 15, category = "food" },
            ["beer"] = { price = 10, category = "food" },
            ["phone"] = { price = 50, category = "electronics" },
            ["bandage"] = { price = 10, category = "medical" },
            ["medikit"] = { price = 20, category = "medical" }
        }
    },
    [14] = {
        name = "LTD Gasoline",
        coords = vector3(1165.716, 2708.831, 38.15765),
        entity = {
            coords = vector3(1165.644, 2710.877, 38.15765),
            heading = 184.5097
        },
        availableItems = {
            ["fixkit"] = { price = 5, category = "food" },
            ["cola"] = { price = 10, category = "food" },
            ["water"] = { price = 3, category = "drink" },
            ["donut"] = { price = 15, category = "food" },
            ["beer"] = { price = 10, category = "food" },
            ["phone"] = { price = 50, category = "electronics" },
            ["bandage"] = { price = 10, category = "medical" },
            ["medikit"] = { price = 20, category = "medical" }
        }
    },
    [15] = {
        name = "LTD Gasoline",
        coords = vector3(1392.641, 3604.386, 34.98085),
        entity = {
            coords = vector3(1392.575, 3606.381, 34.98088),
            heading = 201.1095
        },
        availableItems = {
            ["fixkit"] = { price = 5, category = "food" },
            ["cola"] = { price = 10, category = "food" },
            ["water"] = { price = 3, category = "drink" },
            ["donut"] = { price = 15, category = "food" },
            ["beer"] = { price = 10, category = "food" },
            ["phone"] = { price = 50, category = "electronics" },
            ["bandage"] = { price = 10, category = "medical" },
            ["medikit"] = { price = 20, category = "medical" }
        }
    },
    [16] = {
        name = "LTD Gasoline",
        coords = vector3(-48.68434, -1757.281, 29.42099),
        entity = {
            coords = vector3(-46.44002, -1757.795, 29.42099),
            heading = 55.60513
        },
        availableItems = {
            ["fixkit"] = { price = 5, category = "food" },
            ["cola"] = { price = 10, category = "food" },
            ["water"] = { price = 3, category = "drink" },
            ["donut"] = { price = 15, category = "food" },
            ["beer"] = { price = 10, category = "food" },
            ["phone"] = { price = 50, category = "electronics" },
            ["bandage"] = { price = 10, category = "medical" },
            ["medikit"] = { price = 20, category = "medical" }
        }
    },
    [17] = {
        name = "LTD Gasoline",
        coords = vector3(1162.681, -322.5916, 69.20503),
        entity = {
            coords = vector3(1164.768, -322.4646, 69.20503),
            heading = 104.2766
        },
        availableItems = {
            ["fixkit"] = { price = 5, category = "food" },
            ["cola"] = { price = 10, category = "food" },
            ["water"] = { price = 3, category = "drink" },
            ["donut"] = { price = 15, category = "food" },
            ["beer"] = { price = 10, category = "food" },
            ["phone"] = { price = 50, category = "electronics" },
            ["bandage"] = { price = 10, category = "medical" },
            ["medikit"] = { price = 20, category = "medical" }
        }
    },
    [18] = {
        name = "LTD Gasoline",
        coords = vector3(-1821.858, 793.3361, 138.1268),
        entity = {
            coords = vector3(-1820.191, 794.4689, 138.087),
            heading = 136.0457
        },
        availableItems = {
            ["fixkit"] = { price = 5, category = "food" },
            ["cola"] = { price = 10, category = "food" },
            ["water"] = { price = 3, category = "drink" },
            ["donut"] = { price = 15, category = "food" },
            ["beer"] = { price = 10, category = "food" },
            ["phone"] = { price = 50, category = "electronics" },
            ["bandage"] = { price = 10, category = "medical" },
            ["medikit"] = { price = 20, category = "medical" }
        }
    },
    [19] = {
        name = "LTD Gasoline",
        coords = vector3(1699.606, 4924.02, 42.06364),
        entity = {
            coords = vector3(1698.28, 4922.595, 42.06364),
            heading = 329.7021
        },
        availableItems = {
            ["fixkit"] = { price = 5, category = "food" },
            ["cola"] = { price = 10, category = "food" },
            ["water"] = { price = 3, category = "drink" },
            ["donut"] = { price = 15, category = "food" },
            ["beer"] = { price = 10, category = "food" },
            ["phone"] = { price = 50, category = "electronics" },
            ["bandage"] = { price = 10, category = "medical" },
            ["medikit"] = { price = 20, category = "medical" }
        }
    }
}

Config.Locales = { -- This is the language part, if you want to change to your own language then you need to change only these texts.
    ["money_sign"] = "$",
    ["shopInteraction"] = "~c~Press ~o~[E] ~c~to access the store.",
    ["robbery_title"] = "Shop robbery",
    ["robbery_subject"] = "Alarm triggered",
    ["robbery_message"] = "A robbery started inside %s on %s! The location marked on your map, hurry!",
    ["not_enough_money"] = "You don't have enough money!",
    ["something_went_wrong"] = "Something went wrong!",
    ["bought_items"] = "You have successfully bought the items!",
    ["add_to_cart"] = "Add to cart",
    ["shopping_cart"] = "Shopping cart",
    ["summary"] = "Summary",
    ["item_count"] = "Item count",
    ["pieces"] = "piece(s)",
    ["subtotal"] = "Subtotal",
    ["payment_method"] = "Payment method",
    ["checkout"] = "Checkout",
    ["cash"] = "Cash",
    ["card"] = "Card",
    ["not_enough_police"] = "There are not enough police officers in the city!",
    ["no_item_selected"] = "Your shopping cart is empty!",
    ["shopping_cart_empty"] = "Shopping cart is empty",
    ["open_shop"] = "Open shop"
}
Config.Locales["money_bag_picked"] = "You picked up " .. ((Config.MoneySignBeforeAmount and Config.Locales["money_sign"] .. "%s") or ("%s" .. Config.Locales["money_sign"])) .. " cash from the bag!"

-- You can change here the notifications.
function showNotification(player, message, messageType, duration) -- Used for simple notifications, like when the player successfully bought the items from the shop.
    if IsDuplicityVersion() then
        TriggerClientEvent("esx:showNotification", player, message, messageType, duration)
    else
        ESX.ShowNotification(message, messageType, duration)
    end
end

function advancedNotification(title, subject, message, icon, iconType) -- Used when the system notifies the police officers about the robbery.
    if not IsDuplicityVersion() then
        ESX.ShowAdvancedNotification(title, subject, message, icon, iconType)
    end
end

function interactNotification(show, message) -- Used when the interaction with the shop is marker based and the player is in the marker.
    if not IsDuplicityVersion() then
        if show then 
            ESX.TextUI(message)
        else 
            ESX.HideUI()
        end
    end
end

Features

  • Custom user interface (customizable)
  • Dark/Light mode can be changed in the shop menu for each player
  • Responsive user interface (almost works on every resolution except 1280x1024)
  • Built-in robbery system
  • Robbery synchronized real-time for every player (in render range)
  • Robbery limitations (cooldown after robbery, police officers minimum number)
  • Configurable blips and markers
  • Compatible with ox_target and ox_inventory
  • At the moment it only works with ESX
  • Possible to configure every shop differently (items, shop name, categories)
  • Configurable text language
  • Optimized code (0.02ms using markers, 0.0ms without markers)

Dependencies/Requirements

  • ESX (tested with v1.9.0)
  • MySQL for reading out the valid items from database
  • ox_target, ox_inventory, ox_lib (only if you want to use the ox targeting or the ox inventory system)

Links

Preview video

[ESCROW] Get resource from Tebex (7€ + tax)

[OPEN SOURCE] Get resource from Tebex (12€ + tax)

Code is accessible Only for the open-source version
Subscription-based No
Lines (approximately) ~1200
Requirements Requirements can be found above
Support Yes

Config Merger
Have you tried Config Merger? Merge your configs easily