Scripting/Squirrel/Client Events/KeyBind::OnDown: Difference between revisions
Jump to navigation
Jump to search
This wiki is using an old backup from 2020
Some information may be old/missing
No edit summary |
|||
(3 intermediate revisions by 2 users not shown) | |||
Line 12: | Line 12: | ||
== Example == | == Example == | ||
In this function | In this function I have chosen key "ENTER". When a player will press the key/button 'enter' it will inform the server that the player pressed the key. And the server will perform the work like a Command. | ||
<source lang=squirrel> | <source lang=squirrel> | ||
local enter = KeyBind( 0x0D ); // The Key Code of enter is 0x0D. We will use KeyBind function to set the key. And it is required. | |||
function KeyBind::OnDown() | function KeyBind::OnDown( key ) | ||
{ | { | ||
if ( key == enter ) | if ( key == enter ) | ||
{ | { | ||
Console.Print( "You successfully pressed the Key Enter." ); | |||
} | } | ||
} | } | ||
</source> | </source> |
Latest revision as of 15:30, 27 January 2017
This function allows the server to inform the player, that he pressed the key and and the key works like a command.
Syntax
function KeyBind::OnDown()
Parameters
- key - The key player presses.
Example
In this function I have chosen key "ENTER". When a player will press the key/button 'enter' it will inform the server that the player pressed the key. And the server will perform the work like a Command.
local enter = KeyBind( 0x0D ); // The Key Code of enter is 0x0D. We will use KeyBind function to set the key. And it is required.
function KeyBind::OnDown( key )
{
if ( key == enter )
{
Console.Print( "You successfully pressed the Key Enter." );
}
}