Skip to content

OnPlayerOpenShop

A shop screen is about to open on a player - return false to keep it closed.

The use key on a vendor (after OnPlayerInteractActor) or OpenShop is opening the shop on the player. Return false and nothing opens - say why with SendClientMessage. vendor is the actor the shop is on, nil for a shop opened without one.

function OnPlayerOpenShop(pid, shop, vendor)
-- ...
end
Parameter Type
pid number the player
shop number the shop
vendor number | nil the vendor actor; nil = none

false keeps the screen closed; anything else (or nothing) opens it

-- the market closes at night
function OnPlayerOpenShop(pid, shop, vendor)
local hour = GetWorldTime()
if vendor and (hour < 6 or hour >= 20) then
SendClientMessage(pid, COLOR_RED, "The stall is closed until the morning.")
return false
end
end

OnPlayerCloseShop · OpenShop · CreateVendor · the Shops and vendors group of the index