Giter Site home page Giter Site logo

k5_shops's Introduction

K5 Shops

K5 Shops

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.

Demo

Watch the demo here: YouTube

Dependencies

  • es_extended
  • esx_addonaccount

The script was tested using ESX Legacy. I do not guarantee if it works with other versions

Download & Installation

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

Manually

Installation

Add this in your server.cfg:

ensure k5_shops

Documentation

Configuration

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.

Shops

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

Items

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

Usage

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

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. Config and logo image relation

The products has to have the same name as the key of the items in the items table. These images have to be PNG. Config and image relation

Last Words

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!

k5_shops's People

Contributors

kac5a avatar johnnys avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.