Unique phones

What are unique phones?

A phone is bound to a phone item, not to a character.

Every phone is like a physical phone and can be used with all stored data.

You can give your phone to another player, and they can use it with all the data stored in it.

Supported inventories

An inventory with metadata is enough, but not all inventories are supported out of the box. If your inventory is not supported, see custom inventory for a guide on how to implement it yourself.

How do you enable unique phones?

To enable unique phones, you need to set Config.MetaItem to true in gksphone/config/config.lua.

Config.MetaItem = true

How do you set up unique phones with your inventory?

ox_inventory

Add the following to ox_inventory/data/items.lua. If you already have an item called "phone" and "iphone", replace the data.

["phone"] = {
	label = "Phone",
	weight = 190,
	stack = false,
	consume = 0,
	client = {
		export = "gksphone.UsePhoneItem",
		remove = function()
			TriggerEvent("gksphone:client:ItemRemoved", "phone")
		end
	}
},
["iphone"] = {
	label = "iPhone",
	weight = 190,
	stack = false,
	consume = 0,
	client = {
		export = "gksphone.UsePhoneItem",
		remove = function()
			TriggerEvent("gksphone:client:ItemRemoved", "iphone")
		end
	}
},

qb-inventory, core_inventory, qs-inventory, tgiann-inventory

Open qb-core/shared/items.lua and search for phone and iphone. Replace it with the following:

phone = { name = 'phone', label = 'Phone', weight = 700, type = 'item', image = 'phone.png', unique = true, useable = true, shouldClose = true, combinable = nil, description = 'Neat phone ya got there' },
iphone = { name = 'iphone', label = 'iPhone', weight = 1000, type = 'item', image = 'iphone.png', unique = true, useable = true, shouldClose = true, combinable = nil, description = 'Very expensive phone' },

Last updated