Scripting/Squirrel/Functions/UnbindKey: 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
No edit summary
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
'''UnbindKey''' remove a binded key. (Keys cannot be removed for one Player, only for everyone)
'''UnbindKey''' remove a binded server key.


== Syntax ==
== Syntax ==
Line 39: Line 39:


* Callbacks [[onScriptLoad]], [[onKeyDown]] and [[onPlayerCommand]] were used in this example. More info about them in the corresponding pages.
* Callbacks [[onScriptLoad]], [[onKeyDown]] and [[onPlayerCommand]] were used in this example. More info about them in the corresponding pages.
== Related Functions ==
{{Scripting/Squirrel/Functions/Game_Functions}}
[[Category:Scripting/Squirrel/Functions/Game_Functions]]

Latest revision as of 18:06, 30 January 2017

UnbindKey remove a binded server key.

Syntax

UnbindKey(key)

Arguments

  • int key - The key you want to unbind

Example

The following example will unbind a key for a player

function onScriptLoad()
{
    lshift <- BindKey(true, 0xA0, 0, 0);
}
 
function onKeyDown( player, key )
{
    if( key == lshift )
    {
        MessagePlayer( ">> You pressed the left shift key", player );
    }
}

function OnPlayerCommand( player,cmd , text )
{
	if(cmd == "unbind")
	{
		UnbindKey(lshift);
	}
}

Notes

Related Functions