Skip to content

OpenShop

Opens the shop screen on a player.

The screen comes up with the Buy tab (and the Sell tab when the shop buys). With vendor - an NPC actor - the screen closes when the player walks 4 m from it or it dies; without one it stays until CloseShop or the player’s Esc. A shop already open on the player is replaced. An actor with a shop of its own opens it on the use key without any of this.

OpenShop(pid, shop [, vendor])
Parameter Type
pid number the player
shop number the shop
vendor number the actor the shop is on; nil = none (optional)

boolean - false when the player is not in the world or the shop does not exist

-- /shop opens the town store from anywhere
function OnPlayerCommandText(pid, cmd, args)
if cmd == "shop" then OpenShop(pid, store) return true end
end

CloseShop · GetPlayerShop · SetActorShop · the Shops and vendors group of the index