This is a simple script that adds bikes as an item, that when used places them into the world. The player can then ride the bike like normal and when done pick the bike back up and receive the item.
When picking up a bike, all of the metadata (primaryColor, secondaryColor, pearlescentColor, wheelColor, xenonColor) is saved to the item so that it can be placed back into the world with the same state it was in when picked up.
- QBCore / ESX / Or other frameworks (must implement framework specific solutions in framework.lua)
This script is very lightweight and has no impact on performance.
Resouce monitor results: 0.0ms
Get it here: Github - wp-pocketbikes
The Pick up bike option cannot appear
With ESX when trying to place the bike down there is no metadata and it throws this error
Do you know if ESX has a way to store metadata/ item info on items?
Anyways, looks like I need to add some additional checks that the info exists first. So for scripts that do not have item metadata support, that just means that the bike metadata (like colors) will not persist.
I’ve opened an issue on github to track this: Add check for item.info being defined · Issue #1 · WaypointRP/wp-pocketbikes · GitHub
I’ll get to it sometime this week, should be a simple enough fix.
Do you see any errors in your F8 console? Server console?
You can add metadata to and item using inventory like ox_inventory
This issue is now fixed in v1.0.1. Thanks for reporting this bug!