# ox\_inventory edits (optional)

This section is completely optional. The script will still work perfectly fine even if you choose not to edit ox\_inventory. The point of this edit is to rotate the model that the customDrops spawns so they sit correctly on the ground instead of upright every time.

<table><thead><tr><th width="381" align="center">Without Edit</th><th align="center">With Edit</th></tr></thead><tbody><tr><td align="center"><img src="https://1899336952-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBH8ituluOpCeEC5vkCmb%2Fuploads%2FOYrsvibXsvyKZdb7AqmB%2Fimage.png?alt=media&#x26;token=c632ddde-fceb-4ce0-89ec-9e717a0d0bc5" alt="" data-size="original"></td><td align="center"><img src="https://1899336952-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBH8ituluOpCeEC5vkCmb%2Fuploads%2FpulMMd8GDVAlYs64mqWl%2Fimage.png?alt=media&#x26;token=56dfc24d-fabd-4889-8998-485ff5a09312" alt="" data-size="original"></td></tr></tbody></table>

We can achieve this by editing the code responsible for customDrops by passing in a rotation and offset to be used when spawning the model. If you run into any issues and need help please open a ticket in our [discord](https://discord.gg/EzBxAcM5JJ) as ox\_inventory does not handle support for modified code of their inventory.

### Steps

***

1. Go to `modules/inventory/server.lua` and edit the `CustomDrop` function.

   ```lua
   local function CustomDrop(prefix, items, coords, slots, maxWeight, instance, model, rot, offset)
   	local dropId = generateInvId()
   	local inventory = Inventory.Create(dropId, ('%s %s'):format(prefix, dropId:gsub('%D', '')), 'drop', slots or shared.dropslots, 0, maxWeight or shared.dropweight, false, {})

   	if not inventory then return end

   	inventory.items, inventory.weight = generateItems(inventory, 'drop', items)
   	inventory.coords = coords
   	Inventory.Drops[dropId] = {
   		coords = inventory.coords,
   		instance = instance,
   		model = model,
   		rot = rot,
   		offset = offset,
   	}

   	TriggerClientEvent('ox_inventory:createDrop', -1, dropId, Inventory.Drops[dropId])

       return dropId
   end
   ```
2. Go to `client.lua` where you will need to edit both the `onEnterDrop` and `createDrop` functions.

   ```lua
   local function onEnterDrop(point)
   	if not point.instance or point.instance == currentInstance and not point.entity then
   		local model = point.model or client.dropmodel

   		lib.requestModel(model)

   		local entity = CreateObject(model, point.coords.x, point.coords.y, point.coords.z, false, true, true)

   		SetModelAsNoLongerNeeded(model)
   		PlaceObjectOnGroundProperly(entity)
   		FreezeEntityPosition(entity, true)
   		SetEntityCollision(entity, false, true)

   		if point.rot then 
   			SetEntityRotation(entity, point.rot.x, point.rot.y, point.rot.z, 5, true)
   		end 

   		if point.offset then 
   			SetEntityCoords(entity, point.coords.x + point.offset.x, point.coords.y + point.offset.y, point.coords.z + point.offset.z)
   		end 

   		point.entity = entity
   	end
   end
   ```

   ```lua
   local function createDrop(dropId, data)
   	local point = lib.points.new({
   		coords = data.coords,
   		distance = 16,
   		invId = dropId,
   		instance = data.instance,
   		model = data.model,
   		rot = data.rot,
   		offset = data.offset,
   	})

   	if point.model or client.dropprops then
   		point.distance = 30
   		point.onEnter = onEnterDrop
   		point.onExit = onExitDrop
   	else
   		point.nearby = nearbyDrop
   	end

   	client.drops[dropId] = point
   end
   ```
