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.
Syntax
Section titled “Syntax”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 |
Returns
Section titled “Returns”false refuses the change; anything else accepts it
Example
Section titled “Example”-- the vault stays shut for everyone but the guardsfunction 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 endendSee also
Section titled “See also”GetDoorState · SetDoorState · GetDoors · the Doors and containers group of the index
