Stoic-CarItems


Stoic CarItems

ox_inventory standalone CAR ITEMS!

  • ox_inventory Standalone support | :white_check_mark:
  • qb-core support | hypothetical
  • esx support | hypothetical
Features
  • Define a usable item that spawns a vehicle when used.
  • Automatically handles vehicle ownership for ESX and QBCore frameworks.
  • Uses built-in progress bar and animations for item usage.
  • Provides notifications for successful or failed actions.

How It Works
  1. Define the Item: The item is defined in items.lua with properties such as label, weight, stack, close, and client-side usage settings.
  2. Item Usage: When the item is used, it triggers a client-side export function that spawns a vehicle with the same name as the item.
  3. Vehicle Spawning: The client script requests and spawns the vehicle model, then places the player inside the vehicle.
  4. Server-Side Ownership: A server-side event assigns vehicle ownership to the player using either ESX or QBCore framework, or handles it without a framework if neither is found.
  5. Add the Item to Your Inventory: Ensure the item is added to your player’s inventory.
  6. Use the Item: When used, the item will spawn a vehicle with the same name as the item and assign ownership to the player.

Item Images

Vehicle models - Cfx.re Docs


How to Create Custom Car Images for Items

How to Create Custom Car Images for Items


If you have an addon car and want to create a custom image for it in your FiveM inventory, follow these steps:


  1. Take a Screenshot of the Car In-Game:
    • Spawn your addon car in the game.
    • Position the camera to get a clear and aesthetically pleasing view of the car.
    • Take a screenshot.

  1. Remove the Background:
    • Go to remove.bg.
    • Upload the screenshot you took.
    • Use the tool to remove the background from the image.
    • Download the edited image.

  1. Rename the Image:
    • Rename the image file to match the spawn name of the vehicle. For example, if your vehicle spawn name is addoncar, rename the image to addoncar.png.

  1. Add the Image to ox_inventory:
    • Place the renamed image file (addoncar.png) into the ox_inventory/web/images/ directory of your FiveM server.

  1. Refresh and Ensure ox_inventory:
    • Refresh the inventory images by ensuring ox_inventory twice. You can do this by running the following commands in your server console:
      refresh
      ensure ox_inventory
      ensure ox_inventory
      ```-------------
      

** I do once, wait a minute and do it again than wait for chat to load. Then try to open my inventory. You’ll know it’s started when it says it at the top Right hand side.**
By following these steps, you can have custom car images for your addon vehicles in your FiveM inventory.



Preview


Backup link

https://www.youtube.com/watch?v=3uCB5ZBKwWQ&ab_channel=TheStoicBear


Download Click Image!

Github Download

Image Name

Code is accessible Yes
Subscription-based No
Lines (approximately) 75
Requirements ox_inventory / oxlb
Support Yes
2 Likes

If you dont mind me asking, what chat is that? :slight_smile:

1 Like

Its his chat script

2 Likes

It would be nice if it were an item on a call button and contained a function to call the vehicle in your garage with an animation of the npc leaving the vehicle for you. Or make a call style like GTA V that calls the mechanic and the vehicle you selected appears

That is whats so nice about this its so simple and has a client side setup.

A novice developer could easily help you with creating this.

Yet I wanted to make it since I have not seen one for ox_inventory before.
I may be mistaken

1 Like

Incredible, it would be possible to make it compatible with qs inventory (Quasar Inventory), Thank you :grinning:

I have never used qs-inventory…

Report Issues

Please Include

  • Errrors In F8/Server console if any.
  • Replication video if possible (video/streamable/gif)

And can this be limited to the fact that you can only use it as an item once in your inventory? Because otherwise you would have all the cars in your inventory and the role dynamics would not be as attractive.

consume?: number
Item count needed and removed use.
Default: 1
If set to a decimal will consume durability instead (0.2 = 20%).

Should be able to use this yet I may be mistaken :flushed:

    -- data/items.lua
    ['adder'] = {
        label = 'adder Spawn',
        weight = 500,
        stack = true,
        close = true,
        consume = 1, 
        client = {
            export = 'Stoic-CarItems.vehicleSpawn',
            usetime = 5000,
            anim = { dict = 'amb@world_human_seat_wall_tablet@female@base', clip = 'base' },
            prop = {
                model = 'prop_cs_tablet',
                pos = { x = 0.17, y = 0.10, z = -0.13 },
                rot = { x = 20.0, y = 180.0, z = 180.0 },
                bone = 57005
            }
        }
    },```