This is a free and open Fivem script that uses ESX Framework. The goal of this script is to implement different type of shops on your server, that can accepts multiple types of money. These shops can be used as a pawn shop, a store, or as a buyer only.
Watch the demo here: YouTube
If you need any help, you can check out my Discord
- es_extended
- esx_addonaccount
The script was tested using ESX Legacy. I do not guarantee if it works with other versions
To use this script, you need to edit the configuration to fit your needs.
Using Git
cd resources
git clone https://github.com/kac5a/k5_shops.git [scripts]/k5_shops
- Download https://github.com/k5scripts/k5_shops
- Put it in your resources directory
Add this in your server.cfg
:
ensure k5_shops
In the included config.lua, you will find 3 predefined shops that help you move around. Feel free to delete these shops and add your own.
Key | Definition |
---|---|
shopName | (string) This is the display name of the shop |
coords | (vector3) These are the coordinates of the shop itself |
sellJob | (string[]) The name of the jobs that can access the shop's sell tab (can be multiple jobs in a table) |
sellOnly | (boolean) If true, the shop will only sell items. It is recommended to use with infinite = true |
infinite | (boolean) If true, the shop ignores the storage and will sell and buy infinite amount of items |
blip | (table) This is the definition of the shop blip. Set this as nil if you don't want to add a blip |
color: (number) The color of the blip | |
sprite: (number) The sprite of the blip | |
scale: (number) The scale of the blip | |
cashierPed | (table) This is the definition of the cashier Ped. Set this as nil if you don't want to add a cashier |
ped: (string) Ped model Id | |
coords: (vector3) These are the coordinates of the cashier Ped | |
heading: (number) This is the heading of the cashier Ped | |
paymentType | (number) This is the payment type selector for the shop |
items | (table) This is the table for the shop items. See below |
Key | Definition |
---|---|
label | (string) The display name of the item |
buyPrice | (number) The amount of money players can buy from this shop. If nil , the item won't show up in the buy page |
maxCount | (number) Maximum amount of items the shop can store. Ignored if infinite=true in the shop's definition. |
sellPrice | (number) The amount of money players can sell to this shop. If nil , the item won't show up in the sell page |
This script doesn't use an SQL database, instead it uses json files for each shop. these can be found under the
data/
folder. This is how a data json looks like:
{ "gold": { "count": 5.0 }, "lighter": { "count": 17 }, "phone": { "count": 11 }, "vape": { "count": 30 } }
You can edit this data even if the script runs on your server. Make sure the shop is not accessed by any players before editing these files. This data is only accessed if a player opens a shop.
Images are stored in html/img
Each shop has a logo at the top left corner. This image has to be PNG and has to have the same name as the key of every shop.
The products has to have the same name as the key of the items in the items table. These images have to be PNG.
Feel free to fork this repository and edit the script as much as you'd like. It would be appreciated if someone would edit this to work with other frameworks aswell. This is my first public script. It was needed on a server I'm working on. Have fun!