IsCtrlPressed: Difference between revisions

From Onset Developer Wiki
(Created page with "{{Info|Function|Client|1.0}} {{FuncDescription|__EDIT_ME__}} {{FuncSyntax|IsCtrlPressed()}} {{FuncParameters}} {{FuncNoParam}} {{FuncReturnValue|__EDIT_ME__}} == Example...")
 
No edit summary
 
Line 1: Line 1:
{{Info|Function|Client|1.0}}
{{Info|Function|Client|1.0}}


{{FuncDescription|__EDIT_ME__}}
{{FuncDescription|Check if the player has pressed the Ctrl key.}}


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


{{FuncReturnValue|__EDIT_ME__}}
{{FuncReturnValue|Returns '''true''' on success.}}


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


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

Latest revision as of 10:16, 19 November 2019

IsCtrlPressed

Type: Function
Context: Client
Introduced: v1.0

Description

Check if the player has pressed the Ctrl key.

Syntax

IsCtrlPressed()

Parameters

  • This function has no parameters.

Return Value

  • Returns true on success.

Example

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

See also