[Release] Inventory System v2.1 (Personal Menu)

roleplay
menu
inventory
#1

vdk_inventory

Resources for FiveM allowing the user to access to an inventory and for developpers to add and remove items from the inventory. It’s a resource more for developers.

Requirements

  • ESM v2
  • MySQL Async

Installation

  • Download the resource here :
  • Place the folder “vdk_inventory” to resources folder of FiveM
  • Execute dump.sql file in your database (will create the tables and the constraints)
  • Populate the items and user user_inventory tables to test

Usage

  • For users : Press your Replay Help Button (usually ‘K’) to show the menu
  • For developers : Use “player:receiveItem” and “player:looseItem” events with the item id and quantity as parameters events to add or remove items from the inventory

Thanks

For the menu

Notes

It’s my first LUA script so please be indulgent with me and all valuable proposals are more than welcome.

For help

Guys if you want some help you need to help me/us to help you so if you have any problem you need at least to share a screen of client/server error or a part of code… I’m not a genius so I can’t help you if you just say “why I don’t see anything ?”… So please be smart enough to search a minimum by yourself and don’t ask me that…
Thank you :wink:

Problems

  • MySQL 1071 : I think it’s because you have fields in your table too long like VARCHAR(300) or int(50), try to change them to VARCHAR(255) and int(11) OR change user_id varchar(255) CHARACTER SET utf8mb4 NOT NULL DEFAULT ‘’ TO user_id varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT ‘’ in my dump.sql (thanks to @Lokiro67)

Update

  • 21/04 : Update dump.sql file -> delete the primary key on users table and delete the foreign constraint in user_inventory table. Thanks to @GeekRiot
  • 22/04 :
    -Add sellItem event to earn money and loose an
    -Add export to get the quantity of object of a player

This update allow me to introduce the recolting/treatment/selling system that I will soon release :wink:

  • 23/04 : performance improvement by separating from essentialmode event who slowdown the script, thanks to @GeekRiot
  • 23/04 20:20 : fix another bug when player get a totally new item and go back to TriggerEvent(‘es:getPlayerFromId’, source, function(user) actually necessary to my next script
  • 24/04
    Adding maximun capacity of inventory :wink:
    minor fix on a sql request
  • 06/05
    I add the possibility to trade items between near players, I remove the possibility to add and remove items and fix the max capacity :wink:
  • 03/06
    It’s not only an inventory but more a personal menu. You can access to the inventory but also to animations menu and give money to near player.
    I also made a system of temporary items to limit SQL queries. Change the refreshTimer like you want
    I add the usable items system : in items table I add canUse column (for now 1 is for drink, 2 is for eat)
    I also include the MySQL Async library, thanks to @Brouznouf :wink:
  • 10/06
    Include PutInCoffre function who introduce my next release :wink:
13 Likes

[Release] New Inventory System for ES5 with my-sql-async!
Search Inventory
[Release] Harvest/Treatment/Selling Jobs System v1.1
[Release] Cops FiveM
Search in vdk inventory
[Release] Cops FiveM
#2

Please remove the Keys table, It’s all a myth. See https://wiki.fivem.net/wiki/Controls for more info
(I’ll remove the link until it’s fixed)

1 Like

#3

Sorry I don’t understand what I have to remove

0 Likes

#4

In GUI.lua there’s a table called Keys it’s a really bad way to handle keys. Check the wiki for controls.

0 Likes

#5

You probably have something like IsControlReleased( 0, 311 ) in your code and then in your post you’re telling people to press [K] to show the menu. It triggers the FiveM devs that people are assuming keys are constants (they’re not the same for everybody). So if you edit your post and change it to:

For users : Press your Replay Help button (usually: k) to show the menu

You should be good to go.

1 Like

#6

How I can add ID for resources? :confused:

0 Likes

#7

Nice bro keep work! <3

1 Like

#8

Thanks for sharing bro :slight_smile: good job !

0 Likes

#9

You must add values in ‘items’ table, you just create items with your imagination :wink:

1 Like

#10

thank you dude you are my love

0 Likes

#11

I have an error when I import the dump.sql :

Erreur
Requête SQL :


ALTER TABLE `users`
ADD PRIMARY KEY (`identifier`)
MySQL a répondu: Documentation

#1068 - Multiple primary key defined
0 Likes

#12

There is nothing else has to make in the menu ?

0 Likes

#13

Yeah me too i have the same but in game when i press K or H nothing append ? normal

0 Likes

#14

It means that you already have a PRIMARY Key on identifier, check that and skip this command if it’s ok

0 Likes

#15

What i need to do for show the menu ?

0 Likes

#16

Have all the database tables, and populate them :wink:

1 Like

#17

Personnaly, i have to create the user_inventory by my own :slight_smile: but not a problem ! (Thanks to FiveM and scripters for learning me how to manage a DB lol :))

1 Like

#19

my error when i want to create database #1071 - Specified key was too long; max key length is 767 bytes

1 Like

#20

Wow, very nice release !
If i find any way to improve the script i’ll share it with you guys.

2 Likes

#21

I added an object like water.
I gived him 2 from the databases, and when i press K i have nothing :’(

0 Likes