IsAltPressed: Difference between revisions

From Onset Developer Wiki
Created page with "{{Info|Function|Client|1.0}} {{FuncDescription|__EDIT_ME__}} {{FuncSyntax|IsAltPressed()}} {{FuncParameters}} {{FuncNoParam}} {{FuncReturnValue|__EDIT_ME__}} == Example =..."
 
28days (talk | contribs)
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|__EDIT_ME__}}
{{FuncDescription|Check if the client has pressed the Alt key}}


{{FuncSyntax|IsAltPressed()}}
{{FuncSyntax|IsAltPressed()}}
Line 8: Line 8:
{{FuncNoParam}}
{{FuncNoParam}}


{{FuncReturnValue|__EDIT_ME__}}
{{FuncReturnValue|Returns '''true''' if pressed, otherwise '''false'''}}


== Example ==
== Example ==
__EDIT_ME__
<syntaxhighlight lang="Lua>
AddEvent("OnKeyPress", function(key)
if IsAltPressed() and key == 'R' then
AddPlayerChat("You have pressed Alt + R")
end
end)
</syntaxhighlight>


{{RelatedFunctions}}
{{RelatedFunctions}}
__EDIT_ME__
{{Template:KeyFunctions}}

Latest revision as of 16:11, 19 November 2019

IsAltPressed

Type: Function
Context: Client
Introduced: v1.0

Description

Check if the client has pressed the Alt key

Syntax

IsAltPressed()

Parameters

  • This function has no parameters.

Return Value

  • Returns true if pressed, otherwise false

Example

AddEvent("OnKeyPress", function(key)
	if IsAltPressed() and key == 'R' then
		AddPlayerChat("You have pressed Alt + R")
	end
end)

See also