Integration

Owned shops

Selling SIM cards from any shop, adding them to fx-ownedshops, and issuing registered SIMs from your own script.

With Config.Sim.Enabled = true a number belongs to the SIM in the phone. Physical SIMs are the Config.Sim.Item item (default sim_card) and carry { iccid, number, registered, ownerName } as metadata. The server trusts only the iccid and checks everything else against its own SIM table.

#Item definition

The sim_card block for each inventory and its image are on Item setup. On ox_inventory the server.export = 'fx-phone.useSimCard' line is what lets the phone see the card being used.

#Selling SIMs from any shop

A sim_card with no metadata is a blank prepaid SIM. The first time a player uses it, the server issues an unregistered SIM for it, records the buyer, and writes the metadata onto the item. Any shop can therefore sell SIMs without calling an export. Players register a prepaid SIM to their name at the phone shop.

Set Config.Sim.AllowUnregistered = false to refuse blank cards. They then only work when issued by the phone shop or by IssueSim.

#fx-ownedshops

Add the card (and the phone, if it is not there yet) to the wholesale catalogue. Set the price columns to values that fit your economy:

sqlINSERT INTO `fx_ownedshops_catalog`
    (`item_name`, `label`, `category`, `wholesale_price`, `recommended_price`, `min_sale_price`, `max_sale_price`,
     `package_amount`, `max_order_amount`, `weight`, `stock`, `is_enabled`)
VALUES
    ('sim_card', 'SIM Card', 'electronic', 0, 0, 0, 0, 5, 50, 10, -1, 1)
ON DUPLICATE KEY UPDATE `is_enabled` = 1;

Shop owners then order and price it like any other item. Keep the price above the phone shop's prepaid price if registered SIMs should be the cheaper choice.

#Handing out registered SIMs from your own script

lualocal sim = exports['fx-phone']:IssueSim({
    identifier = citizenId,      -- owner; required for registered SIMs and eSIMs
    registered = true,
    kind = 'physical',           -- 'esim' switches on at once in a phone without a SIM
    shopName = 'Job centre',
})
if sim then
    exports.ox_inventory:AddItem(source, 'sim_card', 1, sim.metadata)
end

IssueSim and the other SIM exports are documented on SIM exports.

#Police lookups

GetSimOwner(number) returns the registered owner, or for a prepaid SIM only the buyer and the shop. See SIM exports.

#The phone's own shops

FX Phone has its own NPC phone shops that sell phones, SIMs, eSIMs and cases, and can be run as a player business. See Shop and Shop and cases configuration.