onKeyDown
Description
This function allows the server to inform the player, that he pressed the key and and the key works like a command.
| Name | Description |
|---|---|
| player | The pointer of the player |
| 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.
function onScriptLoad() { enter <- BindKey(true, 0x0D, 0, 0); // The Key Code of enter is 0x0D, we will use bindkey function to set the key. And it is required.}function onKeyDown(player, key) { if(key == enter) { PrivMessage(player, "Pressed the key Enter."); } }Notes
💡
You can find the key codes here