Skip to content

OnPlayerUnlockContainer

A player unlocked a chest with its key or a lockpick - return false to keep it locked.

Their game has already unlocked it. Return false and their chest is locked again (the lockpick’s work undone). Otherwise the chest is unlocked for everyone - on every screen and for a newcomer - or, where their own lock ruled it (SetContainerLockedFor), for them alone.

function OnPlayerUnlockContainer(pid, key)
-- ...
end
Parameter Type
pid number the player
key string the chest’s key, as OnPlayerOpenContainer gets it

false keeps it locked; anything else lets the unlock stand

-- the guild's strongbox cannot be picked
function OnPlayerUnlockContainer(pid, key)
if key == GUILD_CHEST then
SendClientMessage(pid, COLOR_RED, "The lock does not give.")
return false
end
end

SetContainerLocked · SetContainerLockedFor · OnPlayerOpenContainer · the Doors and containers group of the index