IsValidDoor: Difference between revisions

From Onset Developer Wiki
(Created page with "{{Info|Function|Server & Client|1.0}} {{FuncDescription|Checks whether a given door identifier is a valid door.}} {{FuncSyntax|IsValidDoor(door)}} {{FuncParameters}} {{Func...")
 
No edit summary
Line 8: Line 8:
{{FuncParam|door|The dooridentifier to check.}}
{{FuncParam|door|The dooridentifier to check.}}


{{FuncReturnValue|Returns '''true''' on success, '''false''' on error.}}
{{FuncReturnValue|Returns '''true''' on success.}}


== Example ==
== Example ==
__EDIT_ME__
<syntaxhighlight lang="Lua>
AddCommand("destroydoor", function(playerid, doorid)
doorid = tonumber(doorid)
if IsValidDoor(doorid) then
return AddPlayerChat(playerid, "Invalid door Id specified.")
end
 
DestroyDoor(doorid)
AddPlayerChat(playerid, "You destroyed the door ("..doorid..")")
return
end)
</syntaxhighlight>


{{RelatedFunctions}}
{{RelatedFunctions}}
__EDIT_ME__
* [[CreateDoor]]
* [[DestroyDoor]]
* [[IsValidDoor]]

Revision as of 16:11, 17 November 2019

IsValidDoor

Type: Function
Context: Server & Client
Introduced: v1.0

Description

Checks whether a given door identifier is a valid door.

Syntax

IsValidDoor(door)

Parameters

  • door
    The dooridentifier to check.

Return Value

  • Returns true on success.

Example

AddCommand("destroydoor", function(playerid, doorid)
	doorid = tonumber(doorid)
	if IsValidDoor(doorid) then
		return AddPlayerChat(playerid, "Invalid door Id specified.")
	end

	DestroyDoor(doorid)
	AddPlayerChat(playerid, "You destroyed the door ("..doorid..")")
	return
end)

See also