Hello,
I want to add this
local maxCapacity = 100
As a maxstoragelimit on the ESX vehicle inventory, right her i guess
RegisterServerEvent('esx_truck_inventory:addInventoryItem')
AddEventHandler('esx_truck_inventory:addInventoryItem', function(type, model, plate, item, count, name)
if (???? <= maxCapacity) then
local _source = source
MySQL.Async.fetchAll(
'INSERT INTO truck_inventory (item,count,plate,name) VALUES (@item,@qty,@plate,@name) ON DUPLICATE KEY UPDATE count=count+ @qty',
{
['@plate'] = plate,
['@qty'] = count,
['@item'] = item,
['@name'] = name,
},
function(result)
local xPlayer = ESX.GetPlayerFromId(_source)
xPlayer.removeInventoryItem(item, count)
end)
end)
my problem is that i dont know the name of the value, to get the "qte of the items a user wanna store.
I wanna take it, and do a comparaison, with the 100 if its lower or equal it will be fine, if itβs superior that will show error message, any help please ?
Iβm also wondering if i can add a maxcapacity like this one
local maxCapacity = {
[0] = { ["size"] = 75}, --Compact
[1] = { ["size"] = 200}, --Sedan
[2] = { ["size"] = 300}, --SUV
[3] = { ["size"] = 50}, --Coupes
[4] = { ["size"] = 100}, --Muscle
[5] = { ["size"] = 50}, --Sports Classics
[6] = { ["size"] = 25}, --Sports
[7] = { ["size"] = 20}, --Super
[8] = { ["size"] = 10}, --Motorcycles
[9] = { ["size"] = 250}, --Off-road
[10] = { ["size"] = 250}, --Industrial
[11] = { ["size"] = 250}, --Utility
[12] = { ["size"] = 400}, --Vans
[13] = { ["size"] = 0}, --Cycles
[14] = { ["size"] = 200}, --Boats
[15] = { ["size"] = 0}, --Helicopters
[16] = { ["size"] = 0}, --Planes
[17] = { ["size"] = 0}, --Service
[18] = { ["size"] = 0}, --Emergency
[19] = { ["size"] = 0}, --Military
[20] = { ["size"] = 500}, --Commercial
[21] = { ["size"] = 100}, --Trains
}
any help would be appreciated thanks ^^