IsFirstPersonCamera: Difference between revisions

From Onset Developer Wiki
(Created page with "{{Info|Function|Client|1.0}} {{FuncDescription|Switches the player camera between 1st and 3rd person.}} {{FuncSyntax|IsFirstPersonCamera()}} {{FuncParameters}} {{FuncNoPara...")
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{Info|Function|Client|1.0}}
{{Info|Function|Client|1.0}}


{{FuncDescription|Switches the player camera between 1st and 3rd person.}}
{{FuncDescription|Check if the first person camera is enabled from [[EnableFirstPersonCamera]].}}


{{FuncSyntax|IsFirstPersonCamera()}}
{{FuncSyntax|IsFirstPersonCamera()}}
Line 12: Line 12:
== Example ==
== Example ==
<syntaxhighlight lang="Lua">
<syntaxhighlight lang="Lua">
local bFirstPerson = false
function OnKeyPress(key)
function OnKeyPress(key)
if key == "P" then
if key == "P" then
bFirstPerson = not bFirstPerson
local bEnable = not IsFirstPersonCamera()
EnableFirstPersonCamera(bFirstPerson)
EnableFirstPersonCamera(bEnable)
end
end
end
end

Latest revision as of 22:02, 20 April 2020

IsFirstPersonCamera

Type: Function
Context: Client
Introduced: v1.0

Description

Check if the first person camera is enabled from EnableFirstPersonCamera.

Syntax

IsFirstPersonCamera()

Parameters

  • This function has no parameters.

Return Value

  • Returns true if the 1st person mode/camera is enabled.

Example

function OnKeyPress(key)
	if key == "P" then
		local bEnable = not IsFirstPersonCamera()
		EnableFirstPersonCamera(bEnable)
	end
end
AddEvent("OnKeyPress", OnKeyPress)

See also

EnableFirstPersonCamera