Skip to content

SetDoorCheck

Decide before a door moves - the player’s game waits for OnPlayerUseDoor.

Names a door (its key) or every door ("*") whose use waits for the mode: when a player opens or closes such a door, their game holds the swing and asks, and OnPlayerUseDoor decides before the door moves - false keeps it still (with a text, the player is told why), anything else lets it swing as usual. on = false takes a door back. The use waits for the round trip to the server, so name the doors you mean to judge, not every door of the level. At most 4096 doors by name (however long their names); changes go out to the players once, at the end of the tick, and only the doors that changed.

SetDoorCheck(key [, on])
Parameter Type
key string the door’s level name, or "*" for every door
on boolean true (the default) to decide first, false to take it back (optional)

boolean - false for an empty or too long key, or past 4096 doors

-- the houses players own open for their owners alone
for key, owner in pairs(HOUSE_DOORS) do SetDoorCheck(key) end
function OnPlayerUseDoor(pid, key, open, locked)
local owner = HOUSE_DOORS[key]
if owner and owner ~= GetPlayerName(pid) then return false, "This is " .. owner .. "'s house." end
end

OnPlayerUseDoor · IsDoorChecked · SetDoorPrompt · the Doors and containers group of the index