Phone cases
Cases can be a free Settings option or real inventory items. Pick one mode, install the matching items, and players equip cases by using them from their inventory.
Choose a mode
Set the existing Mode field inside Config.PhoneCases in config/config.phoneCases.lua, then restart YSeries:
Notes:
- Rename items under
Config.PhoneCases.Items. Dedicated names must differ from each other and from the unified item. - Colors: red, black, white, blue, green, purple, yellow, pink, orange, cyan, navy, gray, cream, brown, teal and lavender.
- Color IDs and palette indices are separate. Keep the existing indices, because they match the streamed case props.
- In
hybrid, removing a case returns a generic case. The chosen color and artwork do not travel with the item. - Restart after changing the mode or item names.
Install inventory items
YSeries ships item snippets and icons but does not change your inventory for you.
-
Copy the entries you need from
inventory-items/ox-items-phone-cases.txtorinventory-items/qb-items-phone-cases.txtinto your inventory's item definitions.dedicated: the 16 color items.unifiedorhybrid:phone_case.
-
Copy the matching
inventory-items/phone_case*.pngicons into your inventory's image folder. -
Check the item flags:
- Unified cases must not stack:
stack = false(Ox) orunique = true(QB). Hybrid cases may stack. - Keep Ox
consume = 0and theyseries.UsePhoneCaseItemexport. YSeries removes and returns cases itself.
- Unified cases must not stack:
-
Add the items to your shops. Dedicated and hybrid entries need no metadata. Unified entries need valid
coloranddesignIDs:lua
Give unified cases from a script
Build the metadata on the server with BuildPhoneCaseMetadata, after the design resource has registered its designs:
The metadata holds the color and design IDs plus readable colorName, designLabel, label and description, so Blue / Artist Edition and Blue / Plain look different in inventory.
- Ox creation hooks fill in these labels for shop and
AddItementries. - QB has no shared creation hook, so QB shop and give scripts should always use the builder.
- Custom tooltip templates can show
colorNameanddesignLabelfrom Oxmetadataor QBinfo. The description also contains both names.
What metadata cannot do
- Unknown colors and unregistered designs cannot be equipped.
- Designs must fit the selected phone and pass existing
ImeiLocks. - Metadata cannot add new phone models, artwork URLs or privileges. Design resources still register through the existing case API.
The updated props include fitted cases for YDuo, YPhone Dual and YTriFold, folded and unfolded.
Custom designs
- Create artwork in the Case Creator.
- Install the updated props package it gives you (see below).
- Start the design registration before giving custom cases to players.
- Use the registered design ID with
BuildPhoneCaseMetadata. The readable name comes from the registration.
Where a custom design applies depends on the mode:
Compatible Case Creator packages
Upload a complete, supported yseries-props ZIP in the Case Creator's Package step. It can be the original package or one the Case Creator generated before.
- The Case Creator detects legacy or v3 geometry from the ZIP contents. Renaming the file or picking another model does not convert an incompatible package.
- It supports the verified current and prior v3 revisions, plus the separate legacy generation. Molds from different generations are not interchangeable.
- Current v3 covers Y26, YFlip, YDuo, YPhone Dual and YTriFold: 13 variants (Y26, plus closed, open and animated variants of each foldable).
- Keep all files from one release together. Do not mix assets from several versions.
Install the generated props ZIP
The download is an updated props ZIP containing your case assets, the design registration and the original package files.
- Back up the installed
yseries-propsand any existing case artwork. - Replace the
yseries-propsfolder with the new ZIP's contents. Do not merge it into the old folder. - Restart the server and reconnect clients.
- Confirm the design registers before using its ID in item metadata.
Use it with the matching phone release, and keep the ZIP for later edits. Older Y24 and YFlip designs may need to be recreated for the new phone shapes.
Equip, swap and remove
- Select the phone you want to customize.
- Use the case from your inventory. YSeries reads that exact slot and fits the case to the selected phone you own.
- Using another case swaps them and returns the old item.
Settings show the installed design and color, with a remove button. In dedicated and unified you cannot change the case for free in Settings.
Where the case is saved. With unique phones, the case is stored on the phone's IMEI and moves with that phone item. Without unique phones, dedicated and hybrid cases attach to the character's phone profile and do not follow traded phone items.
Switching modes:
- Cases set up through Settings stay visible. They have no item behind them, so removing one gives nothing back.
- An item-backed case keeps its original return item. Changing free settings does not upgrade that item to a better design.
- Remove old cases before switching inventories or deleting their item definitions. Returning a metadata case to a count-only inventory is rejected.
Inventory adapters
server/custom/functions/phoneCaseInventory.lua is editable and outside escrow. It includes adapters for:
- Ox, QB, LJ and PS
- standard ESX, count-based, for
dedicatedandhybridonly
QB variants must expose compatible AddItem, RemoveItem and CanAddItem exports. If capacity checks are unavailable, the operation is refused. These adapters are covered by fixture tests; still test your exact inventory version on a live server.
Custom inventories
Other inventories need a case adapter, even if unique phones already work. Use the included adapters as a template.
- Provide
YseriesPhoneCaseInventorywithSupportsMetadata,GetSlot(source, slot),Remove(source, snapshot),CanCarry(source, item)andAdd(source, item). - A snapshot has
name,slot,countandmetadata. A returned item hasnameandmetadata. - Count-only ESX uses the trusted usable item's name as its slot token.
- Re-read the exact slot and metadata before removing.
- Return
falseonly when the operation certainly had no effect. Throw an error if the result is uncertain. - Call
YseriesUsePhoneCaseItem(source, slot)from a trusted usable-item handler.
Interrupted operations
Inventory changes and database saves cannot share one transaction. Before touching inventory, YSeries records each step in the existing yphone_settings.metadata.phoneCaseOperation JSON field. It undoes proven failures where it can, and blocks further case changes when the result is uncertain. No schema migration is needed, and the record is never sent to the phone UI or nearby players.
To resolve a stuck case change from the server console:
-
Inspect it:
CodeThe record shows the owner, old and new appearance, return item, incoming slot, phase and operation ID.
-
Check the player's real inventory against the record. Fix missing or duplicate loose items with your usual admin inventory tools. Do not keep giving or refunding items based only on an uncertain phase.
-
Run one resolution with the operation ID from step 1:
Code
These commands only set which case stays attached and clear the record. They never move items or retry an uncertain step.