OnKeyUp: Difference between revisions

From Vice City Multiplayer
Jump to navigation Jump to search
Caution icon
This wiki is using an old backup from 2020
Some information may be old/missing
No edit summary
mNo edit summary
 
Line 35: Line 35:
Function [[Scripting/Squirrel/Functions/PrivMessage|''PrivMessage'']] and function [[Scripting/Squirrel/Functions/BindKey|''BindKey'']] were used in this example.
Function [[Scripting/Squirrel/Functions/PrivMessage|''PrivMessage'']] and function [[Scripting/Squirrel/Functions/BindKey|''BindKey'']] were used in this example.


you can Find the key codes [[https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx|''here'']]
you can Find the key codes [[https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx''here'']]


== Related Functions ==
== Related Functions ==

Latest revision as of 20:03, 11 February 2017

This function allows the server to inform the player, that He dropped the key and and the key works like a command.

Syntax

function onKeyUp( player, key )

Parameters

  • player - The player who presses the key.
  • key - The key player presses.


Example

In this function i have chosen key "ENTER". When a player will dropped the key/button 'enter' it will inform the server that the player dropped 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 onKeyUp( player, key )
{
	if ( key == enter )
	{
		PrivMessage( player, "you Successfully dropped the Key Enter." );
	}
}

Notes

Function PrivMessage and function BindKey were used in this example.

you can Find the key codes [here]

Related Functions