IsDoorOpen: Difference between revisions

From Onset Developer Wiki
Created page with "{{Info|Function|Server|1.0}} {{FuncDescription|Checks the door state.}} {{FuncSyntax|IsDoorOpen(door)}} {{FuncParameters}} {{FuncParam|door|The door identifier.}} {{FuncRe..."
 
28days (talk | contribs)
No edit summary
 
Line 25: Line 25:


{{RelatedFunctions}}
{{RelatedFunctions}}
__EDIT_ME__
{{Template:DoorFunctions}}

Latest revision as of 16:55, 13 December 2019

IsDoorOpen

Type: Function
Context: Server
Introduced: v1.0

Description

Checks the door state.

Syntax

IsDoorOpen(door)

Parameters

  • door
    The door identifier.

Return Value

  • Returns true if the door is open, false if closed.

Example

AddEvent("OnPlayerInteractDoor", function(player, door, bWantsOpen)
	--AddPlayerChat(player, "Door: "..door..", "..tostring(bWantsOpen))

	-- Let the players open/close the door by default.
	if IsDoorOpen(door) then
		SetDoorOpen(door, false)
	else
		SetDoorOpen(door, true)
	end
end)

See also