[Release] Car Inventory System v1 (10/06)

vdk_truck

Resources for FiveM allowing the user to access to a car inventory and for developpers to add and remove items from this inventory.

Requirements

Installation

  • Download the resource here : https://github.com/vodkhard/vdk_truck
  • Place the folder vdk_truck to resources folder of FiveM
  • Execute dump.sql file in your database (will create the tables and the constraints)

Usage

  • For users : Press your INPUT CELLPHONE CAMERA FOCUS LOCK (usually ‘L’) to show the menu in front a vehicle
  • For developers : Use “car:receiveItem” and “car:looseItem” server events
  • You can change the max capacity in server.lua with the maxCapacity variable
  • You can watch the PutInCoffre function of vdk_inventory to see an example

Next steps

  • Add this system for job vehicles because actually it only work with personal vehicles :wink:
  • Add a maximum capacity for every category of vehicle :wink:
12 Likes

But how to add your items? Show


If you have the last vdk_inventory version you can put your item in the truck with the menu :wink: and it must be your personal vehicle

1 Like

Wowo ! big Thanks for this !

How to put items in the car inventory ?

Oh nice release ! Well done !

i need to. please help

Provably a dumb question, but will this work with inventory without async mysql?

Perfectly work ! Good job :slight_smile: !
For clients are sure to item are in vehicle you can add

TriggerClientEvent("es_freeroam:notify", source, "CHAR_SOCIAL_CLUB", 1, "Coffre VĂ©hicule", false, "~g~+".. quantity .." ~s~dans le coffre !\n")

TriggerClientEvent("es_freeroam:notify", source, "CHAR_SOCIAL_CLUB", 1, "Coffre VĂ©hicule", false, "~r~-".. quantity .." ~s~dans le coffre !\n")
1 Like

Woah realy cool ! Is there a way to customize the max inventory for each vehicle ? Like 0 for bike / 50 for side car and 100 for trucks ?

I will work on this feature :wink:

1 Like

Many thanks :smiley: Great job man

1 Like

You must be add function to say “It’s not your vehicle” when player try to open inventory of others cars ^^

A little contribution for this script.

https://pastebin.com/3JBjgEuh - Server.lua
https://pastebin.com/tMVfudeh - Client.lua

1 - Compatibility with “La_Life”
2 - You can now select objects to put in the car chest directly from the menu.
2 - You can put any object into any vehicle, no need to own the vehicle
 (But if you loose the vehicle you loose your objects too 
)

NB : please add this line into the “inventory_client.lua” of your “fivemenu” folder
RegisterNetEvent(“player:receiveItem”)

NB (number 2) : i don’t make the support of this script it’s just for share. For me this script works correctly.

And good job VODKHARD :wink:

4 Likes

Each personal vehicle have different plate so no :wink:

Like Arma life servers =3 you are my god =3

Can anyone explain how to add their items?

It’s you talk about 2 personals vehicles, yes it’s normal. For bypass plates duplicata between two (or more) players. This is generate by the vehicle shop script. It give you always the same plate, of memory it’s CTZN+ last 4 string of your steamid.

You can show this inside your vehshop_s.lua | GetIdentifier event

Some modification and feature of my last post 

https://hastebin.com/lesehixiqu.lua - Server
https://hastebin.com/dafezupiwu.lua - Client

  • Add : Limit slot by class vehicle
  • Add : Not possible to open when the vehicle is closed ( status lock 2 and 7 )
  • Add : Some alert ( Full, No more slot, etc )
  • Fix : Solved a problem with the items list after reboot.

NB : please add this line into the “inventory_client.lua” of your “fivemenu” folder
RegisterNetEvent(“player:receiveItem”)

Tips : If some people want generate random plate when you buy a new vehicule in La_Life go inside your vehshop_s.lua and search vehshop:GetIdentifier add this.

AddEventHandler('vehshop:GetIdentifier', function()
  TriggerEvent('es:getPlayerFromId', source, function(user)
    local player = user.identifier
    local L = #player - 4
    local L1 = #player - 3
    local L2 = #player - 2
    local L3 = #player - 1
    local plate = RandPlate() .. "Z" .. player[L] .. player[L1] .. player[L2] .. player[L3]
    plate = string.upper(plate)
    TriggerClientEvent("vehshop:f_GetIdentifier", source, plate)
  end)
end)

local RANDOMLIST = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}

function RandPlate()
    math.randomseed( os.time() )
    local atime = math.random(1,35)
    local btime = math.random(1,35)
    local ctime = math.random(1,35)
    local result = RANDOMLIST[atime] .. RANDOMLIST[btime] .. RANDOMLIST[ctime]
    return result
end

NB : No support it’s always for share and it’s my last proposal for this script because i haven’t more idea, enjoy :wink:

4 Likes

Thank you guy, for those who aren’t in hurry I will integrate these features directly :wink:

Another thank you to @ZeCreeps :wink:

1 Like