Pulse Phone docs
Inventories
4. Items and inventories
Items are only needed on framework servers. The files are in config/items/ and the pictures
in config/items/images/.
What the phone does by itself. At start-up it works out which items the features you have switched on need (the table below), and then:
| Your inventory | What happens |
|---|---|
| ESX with its default inventory | The missing items are added to ESX's items table. Existing rows are never changed. The console prints one line naming what it added. On an older ESX that can't reload its items, restart the server once. config/items/esx.sql is only for adding them by hand. |
| QBCore with qb-inventory (ps-, lj-inventory too) | The missing items are added to QBCore's shared items while the server runs. An item qb-core already has, such as its own phone, is left as it is. The console prints one line naming what it added. |
| ox_inventory (ESX, Qbox, ox_core) | ox_inventory only reads items from its own file. The start-up check lists only the missing items and prints their entries under the box, ready to paste into ox_inventory/data/items.lua. |
| Any other inventory | The start-up check names the missing items. Add them the way that inventory adds items (the table under "What to do for your inventory"). |
Important
Pictures are never copied for you. The start-up check names each missing picture and the
folder it goes in, for example
copy pulse_magpack.png, pulse_router.png from config/items/images/ into qb-inventory/html/images.
The start-up check has one Items line: [OK] when every item is there, or [FAIL] with the
missing names and the fix below it. phone:health prints it again after you fix something.
| Item | You need it when |
|---|---|
phone |
Only with Config.Item.required = true (players must carry a phone) or unique phones. |
pulse_phone_box |
The store sells phones in a sealed box. On by default (Config.Store.box). |
pulse_magpack, pulse_magpack_max, pulse_cable |
The charging accessories. On by default (Config.Charging). |
pulse_router |
Pulse Home Wi-Fi, the router players place at home. On by default (config/apps.lua). |
pulse_burner |
The Pulse Burner, a prepaid phone with its own number. On by default (config/apps.lua). |
pulse_case, pulse_case_clear, pulse_pouch, pulse_protector |
Phone protection: cases, the waterproof pouch and the screen protector. On by default (config/apps.lua). |
pulse_buds, pulse_ringlight, pulse_wallet |
Pulse Buds, the Pulse Ring Light and the Pulse Card Wallet. On by default (config/apps.lua). |
powerbank |
Optional. The old power bank item; it works as a Reserve. |
pulse_phone_box_<finish> |
Only with Config.Store.boxPerFinish = true. |
radio (or any name) |
Only when you set Config.Radio.item (section 5, Radio). ox_inventory and qb-core already have a radio item. |
If an item is missing, the phone still starts. The store turns boxes off or takes that item off sale, and the console names the item to add.
Reserves stack. Full packs carry no metadata, so up to 20 share one slot. A pack taken off part-used becomes its own item with its charge in its metadata (on ox_inventory, qb-inventory and qs-inventory), so it needs a free slot. Without item metadata (standalone, the default ESX inventory) only the pack in use is tracked, one per character per size.
With Config.Item.required = true (or unique phones) the server checks the phone item
through your inventory and refuses phone requests from a player without it. Losing the item ends
that player's calls, emergency calls included, and closes the phone.
Giving a sealed box to someone else. On ox_inventory, qb-inventory and qs-inventory the box
item itself carries the model and finish that were bought, so whoever opens it gets that phone.
On every other inventory the box is a plain item and the model and finish live in the buyer's own
purchase record: a box given away opens as the new owner's own next purchase, or as the default
model and finish. With Config.Store.boxPerFinish = true the box item name keeps the finish, but
not the model.
The exact text to paste, for your inventory
You never have to work out an item entry yourself. When an item is missing, the start-up check
prints the exact text for your inventory below its box, and Settings > Server > Health Check
shows the same text with a Copy button. Paste it, restart the inventory and the phone, and run
phone:health again.
| Your inventory | What is printed | Where it goes |
|---|---|---|
| ox_inventory (ESX, Qbox, ox_core, ND Core) | ox_inventory entries | ox_inventory/data/items.lua, inside its table |
| QBCore (qb-, ps-, lj-inventory) | QBCore entries (only if the phone could not add them itself) | qb-core/shared/items.lua |
| qs-inventory | QBCore-shaped entries | qs-inventory's item list |
| ESX default inventory | One SQL line (only if the phone could not add them itself) | Your database tool, then restart |
| TMC | TMC entries for every item the phone needs (TMC can't be asked which it has) | TMC's item list (the file with sim_card), keeping the ones you already have |
| Any other inventory | QBCore-shaped entries, the shape most inventories read | That inventory's item list |
What each looks like, for the Reserve:
-- ox_inventory/data/items.lua
['pulse_magpack'] = { label = "Pulse Reserve", weight = 110, stack = true, close = true, consume = 0, description = "Magnetic battery pack. Fills 70% of a phone.", client = { export = "phone.usePack", image = "pulse_magpack.png" } },
-- qb-core/shared/items.lua, qs-inventory and similar
['pulse_magpack'] = { name = "pulse_magpack", label = "Pulse Reserve", weight = 110, type = 'item', image = "pulse_magpack.png", unique = false, useable = true, shouldClose = true, description = "Magnetic battery pack. Fills 70% of a phone." },
-- TMC
['pulse_magpack'] = { ['label'] = "Pulse Reserve", ['weight'] = 110, ['type'] = 'item', ['image'] = "pulse_magpack.png", ['unique'] = false, ['stackable'] = true, ['useable'] = true, ['shouldClose'] = true, ['description'] = "Magnetic battery pack. Fills 70% of a phone." },-- ESX default inventory
INSERT IGNORE INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`) VALUES
('pulse_magpack', 'Pulse Reserve', 1, 0, 1);ox_inventory's own phone item. ox_inventory ships a phone entry made for another phone
script. You don't need to change it: using it opens Pulse Phone. The start-up check has a
Phone item line that says how your entry is wired. Only when it names another script's export
([WARN], or [FAIL] with required or unique phones) does it print the replacement entry. If
the phone script that entry was made for is still running, the item opens that one instead: the
Phone item line names it; remove it from server.cfg.
What to do for your inventory
| Inventory | Where the items go | Where the pictures go |
|---|---|---|
| ox_inventory (ESX, Qbox, ox_core) | Paste the entries the start-up check prints (or the whole ox_inventory.lua) into ox_inventory/data/items.lua, inside its table. With Config.Item.required or unique phones, replace ox_inventory's own ['phone'] entry with ours |
ox_inventory/web/images/ |
| qb-inventory | Nothing: added at start-up. To add them by hand instead, paste qb-core.lua into qb-core/shared/items.lua |
qb-inventory/html/images/ |
| ps-inventory, lj-inventory | Nothing: added at start-up, as for qb-inventory | your inventory's image folder |
| qs-inventory | Paste qb-core.lua into qb-core/shared/items.lua, or into qs-inventory's own item list |
your inventory's image folder |
| codem-inventory, core_inventory, tgiann-inventory, origen_inventory | Add the items to its item list the way you add any item, using the names, labels and weights from qb-core.lua (phone, powerbank, pulse_magpack, pulse_magpack_max, pulse_cable, pulse_router, pulse_burner, pulse_buds, pulse_ringlight, pulse_wallet, pulse_phone_box). Use pulse_magpack.png for powerbank and pulse_magpack_max too |
your inventory's image folder |
| ak47_inventory | Add the items, plus the onUse lines below |
your inventory's image folder |
| ESX default inventory | Nothing: added at start-up. esx.sql is the by-hand way |
not needed |
| vRP 2 | See the vRP section above | |
| Standalone | Nothing |
For the other inventories in this table, the phone makes the items usable by itself.
ox_inventory uses the client = { export = 'phone....' } lines already in its file.
ox_inventory: if you used another phone before, also remove its Item('phone', ...) hook from
ox_inventory/modules/items/client.lua.
ak47_inventory keeps item use in each item's own entry. Add these:
-- powerbank
server = { onUse = function(source) exports.phone:UsePowerbank(source) end },
-- pulse_magpack and pulse_magpack_max
server = { onUse = function(source, item) exports.phone:UseMagPack(source, item and item.slot, item and item.name) end },
-- pulse_cable
server = { onUse = function(source) exports.phone:UseChargingCable(source) end },
-- pulse_phone_box
server = { onUse = function(source, item) exports.phone:UseBox(source, item and item.slot) end },
-- pulse_router
server = { onUse = function(source) exports.phone:UseRouter(source) end },
-- pulse_burner
server = { onUse = function(source, item) exports.phone:UseBurner(source, item and item.slot) end },
-- pulse_case, pulse_case_clear, pulse_pouch, pulse_protector
server = { onUse = function(source, item) exports.phone:FitPhoneProtection(source, item and item.name) end },
-- pulse_buds
server = { onUse = function(source) exports.phone:UseBuds(source) end },
-- pulse_ringlight
server = { onUse = function(source) exports.phone:UseRingLight(source) end },
-- pulse_wallet
server = { onUse = function(source) exports.phone:UseCardWallet(source) end },Unique phones (Config.Item.unique = true) put the phone number on the item, so handing over
the item hands over the phone. They need ox_inventory, qb-inventory, qs-inventory, core_inventory
or codem-inventory.