EnableFirstPersonCamera: 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|EnableFirstPersonCamera(bEnable)}} {{FuncParameters}} {..." |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 11: | Line 11: | ||
== Example == | == Example == | ||
<syntaxhighlight lang="Lua"> | |||
local bFirstPerson = false | |||
function OnKeyPress(key) | |||
if key == "P" then | |||
bFirstPerson = not bFirstPerson | |||
EnableFirstPersonCamera(bFirstPerson) | |||
end | |||
end | |||
AddEvent("OnKeyPress", OnKeyPress) | |||
</syntaxhighlight> | |||
{{RelatedFunctions}} | {{RelatedFunctions}} | ||
[[IsFirstPersonCamera]] |
Latest revision as of 16:12, 20 October 2019
Description
Switches the player camera between 1st and 3rd person.
Syntax
EnableFirstPersonCamera(bEnable)
Parameters
- bEnable
true to enable, false to disable.
Return Value
- Returns true on success.
Example
local bFirstPerson = false
function OnKeyPress(key)
if key == "P" then
bFirstPerson = not bFirstPerson
EnableFirstPersonCamera(bFirstPerson)
end
end
AddEvent("OnKeyPress", OnKeyPress)