Skip to content

OnPlayerUseDoor

A player’s game opened, closed, locked or unlocked a door - return false to put it back.

open and locked are the door’s state as it is now on the player’s client. Return false to refuse: the record stands, the player’s door is put back, nobody else hears of it. Otherwise the state becomes the record and every client shows it.

function OnPlayerUseDoor(pid, key, open, locked)
-- ...
end
Parameter Type
pid number the player
key string the door’s level name
open boolean open now
locked boolean locked now

false refuses the change; anything else accepts it

-- the vault stays shut for everyone but the guards
function OnPlayerUseDoor(pid, key, open, locked)
if key == VAULT_DOOR and GetPlayerData(pid, "role") ~= "guard" then
SendClientMessage(pid, COLOUR_RED, "Locked. The guards have the key.")
return false
end
end

GetDoorState · SetDoorState · GetDoors · the Doors and containers group of the index