[RELEASE] Advanced truck inventory for ESX (black money, weapons, items)

Here is my release about esx_truck inventory where you can put ammo, black money and items.

esx_jb_advanced_truck_inventory

Thanks to Sylundev for original script and @Tracid_TV and Pando for helping

I hope you’ll all be greateful to everyone who helped because it was a lot of work!

here is another release but from pando:
esx_truck in json format

you need to add this server sided in es_extended if you use truck from pando:

ESX.GetItemLabel = function(name)
    if ESX.Items[name] ~= nil then
      return ESX.Items[name].label
    end
end

no support will be given anymore, but feel free to push some fixes

27 Likes

After opening Coffre to return back using BACK SPACE can not return I have to press ESC.

elseif lastOpen and IsControlPressed(0, Keys[“BACKSPACE”]) and (GetGameTimer() - GUI.Time) > 150 then

HI,
I’m the 95 to download your script and sadly the first to say thank you.
Thanks for your job and for sharing it !
BR

4 Likes

Hey, I was working on something like this then I saw your post on #scripts_preview ( ESX Discord ).

Thank you for saving my time on this. Have a great day/night!

Thank you so much!!! :smiley:

1 Like

How do you put stuff inside the vehicle? I press L? Says the trunk opened but no menu comes up to put stuff in?

2 Likes

Thanks for sharing this with us, I enjoyed your releases back in the day, nice to see you here again.

1 Like

Script works fine as intended, I do need to fix the backspace issue but also a known bug is that you can have multiple people enter the trunk and duplicate the item inside the trunk. Is there a way to have only one person looking in the trunk at a time because I was able to duplicate all items stored in a trunk while having someone already looking into it

How do you put stuff in the trunk? When you press L does a menu come up or what?

Good work guys!! I have found one problem. The players can duplicate weapons with this script. If you put a weapon with like ‘‘250’’ ammo in it in the trunk you can then take out 250 weapons or am i doing somethning wrong?

/Calm

weapon is a issue everywhere (property, enterprise vault, trunk ,…) … so we cannot avoid that :slight_smile: or just make it so you cannot put weaponns in trunk

1 Like

You can open trunk with ‘_’ key and You can change it in client/main.lua.

they have to know to read the code to know lol :slight_smile:

2 Likes

Thanks man awesome job

1 Like

Doing this is beyond me, however if you can limit the number of ammo you put into the trunk to “1”, it’s too much work to duplicate. In my testing with a double barrel shotgun, if I only put in one ammo, when I take it back out, I only end up with one extra ammo, not doubled.

As far as the backspace issue, I just copied the entire “-- Key Controls” section from esx_vehicle_inventory over to this one and it fixed it.

@Jager_Bom

Ok, here is a workaround with this extremely small change. This is not foolproof, but it does take a little more work to figure out how to dupe ammo. Here is how I tested:


First I bought a special carbine which gave me 43 ammo:

  • Placed the gun in the trunk using a count of 43
  • Removed the gun from the trunk using a count of 43
  • Viewed weapon wheel and seen I only had 43 ammo, not 86

Then, next test:

  • Placed the gun in the trunk using a count of 43
  • Removed the gun from the trunk using a count of 20
  • Viewed weapon wheel and seen gun with 43 ammo
  • Opened trunk again and seen the gun with 23 ammo
  • Removed weapon using a count of 20 again
  • Viewed weapon wheel and seen gun still only had 43 ammo
  • Opened trunk again and seen the gun with 3 ammo
  • Removed weapon using a count of 3
  • Viewed weapon wheel and seen gun still only had 43 ammo
  • Opened the trunk again and seen gun was finally removed from it

Next test

  • Place the gun in the trunk using a count of 10
  • Viewed weapon wheel to see gun completely removed
  • Open trunk and seen the gun with a count of 10
  • Removed gun using a count of 1
  • Viewed weapon wheel and seen the gun with a count of 43
  • Opened trunk and seen the gun with a count of 9
  • Removed gun using a count of 9
  • Viewed weapon wheel and seen the gun with a count of 43

In conclusion, there was no duping using the trunk with guns with the fix seen below.

I also conducted the same test as above with throwable items and didn’t dupe them.


In the /server/main.lua, find

if itemType == 'item_weapon' then
         xPlayer.addWeapon(item, count)
end

And change it to:

if itemType == 'item_weapon' then
         xPlayer.addWeapon(item, 0)
end

There are other methods of duping weapon ammo. However, in my testing with this script, the trunk is no longer a way to do it.

3 Likes

thx i will fix it in github, but feel free to push some modifications :slight_smile:

credit me :slight_smile: :slight_smile: :slight_smile: :slight_smile:

already done on github

LOL, you really didn’t need to. I fixed it by accident and for my own greedy reasons :slight_smile: