<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Gtkvba</id>
	<title>Multi Theft Auto: Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Gtkvba"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/Gtkvba"/>
	<updated>2026-04-16T20:22:41Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=BindKey&amp;diff=76840</id>
		<title>BindKey</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=BindKey&amp;diff=76840"/>
		<updated>2023-05-30T11:17:54Z</updated>

		<summary type="html">&lt;p&gt;Gtkvba: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
Binds a player's key to a handler function or command, which will be called when the key is pressed.&lt;br /&gt;
&lt;br /&gt;
{{Note|Using escape key will always return false. Use [[onClientKey]] event instead.}}&lt;br /&gt;
&lt;br /&gt;
{{Note|Handler function wont be triggered while focused in cegui editbox. Use [[onClientKey]] event instead.}}&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;section name=&amp;quot;Server - Syntax 1&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool bindKey ( player thePlayer, string key, string keyState, function handlerFunction,  [ var arguments, ... ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''thePlayer:''' The player you wish to bind the key of.&lt;br /&gt;
*'''key:''' The key or control you wish to bind to the command. See [[key names]] for a list of possible keys and [[control names]] for a list of possible controls.&lt;br /&gt;
*'''keyState:''' A string that has one of the following values:&lt;br /&gt;
**'''&amp;quot;up&amp;quot;:''' If the bound key should trigger the function when the key is released&lt;br /&gt;
**'''&amp;quot;down&amp;quot;:''' If the bound key should trigger the function when the key is pressed&lt;br /&gt;
**'''&amp;quot;both&amp;quot;:''' If the bound key should trigger the function when the key is pressed or released&lt;br /&gt;
*'''handlerFunction:''' The function that will be triggered when the player's key is pressed. This function should have the form:&lt;br /&gt;
:&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;function functionName ( player keyPresser, string key, string keyState, [ var arguments, ... ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
:The values passed to this function are:&lt;br /&gt;
:*'''keyPresser:''' The player who pressed the key&lt;br /&gt;
:*'''key:''' The key that was pressed&lt;br /&gt;
:*'''keyState:''' The state of the key that was pressed, ''down'' if it was pressed, ''up'' if it was released.&lt;br /&gt;
:*'''arguments''' The optional arguments you specified when calling [[bindKey]] (see below).&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{New feature|3|1.0|&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server - Syntax 2&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This alternative syntax allows you to bind a key with a command.  This will also allow users to customize the control in their Settings menu.  Use in conjunction with [[addCommandHandler]] to add handler functions to the keybind.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool bindKey ( player thePlayer, string key, string keyState, string commandName, [ string arguments ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''thePlayer:''' The player you wish to bind the key of.&lt;br /&gt;
*'''key:''' The key or control you wish to bind to the command. See [[key names]] for a list of possible keys.&lt;br /&gt;
*'''keyState:''' A string that has one of the following values:&lt;br /&gt;
**'''&amp;quot;up&amp;quot;:''' If the bound key should trigger the function when the key is released&lt;br /&gt;
**'''&amp;quot;down&amp;quot;:''' If the bound key should trigger the function when the key is pressed&lt;br /&gt;
**'''&amp;quot;both&amp;quot;:''' If the bound key should trigger the function when the key is pressed or released&lt;br /&gt;
*'''commandName:''' The name of the command that the key should be binded to.  &lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''arguments''' Space delimited arguments that are entered as if one was typing the command.&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client - Syntax 1&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool bindKey ( string key, string keyState, function handlerFunction,  [ var arguments, ... ] ) &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''key:''' The key or control you wish to bind to the command. See [[key names]] for a list of possible keys and [[control names]] for a list of possible controls.&lt;br /&gt;
*'''keyState:''' A string that has one of the following values:&lt;br /&gt;
**'''&amp;quot;up&amp;quot;:''' If the bound key should trigger the function when the key is released&lt;br /&gt;
**'''&amp;quot;down&amp;quot;:''' If the bound key should trigger the function when the key is pressed&lt;br /&gt;
**'''&amp;quot;both&amp;quot;:''' If the bound key should trigger the function when the key is pressed or released&lt;br /&gt;
&amp;lt;!--*'''bindName:''' The name for this key bind when it appears in the client's settings dialog.--&amp;gt;&lt;br /&gt;
*'''handlerFunction:''' The function that will be triggered when the player's key is pressed. This function should have the form:&lt;br /&gt;
:&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;function functionName ( string key, string keyState, [ var arguments, ... ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
:The values passed to this function are:&lt;br /&gt;
:*'''key:''' The key that was pressed&lt;br /&gt;
:*'''keyState:''' The state of the key that was pressed, ''down'' if it was pressed, ''up'' if it was released.&lt;br /&gt;
:*'''arguments''' The optional arguments you specified when calling [[bindKey]] (see below).&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{New feature|3|1.0|&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client - Syntax 2&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This alternative syntax allows you to bind a key with a command.  This will also allow users to customize the control in their Settings menu.  Use in conjunction with [[addCommandHandler]] to add handler functions to the keybind.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool bindKey ( string key, string keyState, string commandName, [ string arguments ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''key:''' The key or control you wish to bind to the command. See [[key names]] for a list of possible keys.&lt;br /&gt;
*'''keyState:''' A string that has one of the following values:&lt;br /&gt;
**'''&amp;quot;up&amp;quot;:''' If the bound key should trigger the function when the key is released&lt;br /&gt;
**'''&amp;quot;down&amp;quot;:''' If the bound key should trigger the function when the key is pressed&lt;br /&gt;
**'''&amp;quot;both&amp;quot;:''' If the bound key should trigger the function when the key is pressed or released&lt;br /&gt;
*'''commandName:''' The name of the command that the key should be binded to.  &lt;br /&gt;
*'''arguments''' Space delimited arguments that are entered as if one was typing the command.&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
{{OptionalArg}} &lt;br /&gt;
*'''arguments:''' Any arguments you may want to pass to the function when the key is pressed by the user. Any number of arguments of  can be specified, each being passed to the designated function. You may not pass functions.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the key was bound, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
Example 1&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example will bind a player's 'F1' key and 'fire' control to 1 input function.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function funcInput ( player, key, keyState )&lt;br /&gt;
  outputChatBox ( getPlayerName ( player) .. &amp;quot; &amp;quot; .. (keyState == &amp;quot;down&amp;quot; and &amp;quot;pressed&amp;quot; or &amp;quot;released&amp;quot;) .. &amp;quot; the &amp;quot; .. key .. &amp;quot; key!&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function bindTheKeys ( player, commandName )&lt;br /&gt;
  bindKey ( player, &amp;quot;F1&amp;quot;, &amp;quot;down&amp;quot;, funcInput )   -- bind the player's F1 down key&lt;br /&gt;
  bindKey ( player, &amp;quot;F1&amp;quot;, &amp;quot;up&amp;quot;, funcInput )     -- bind the player's F1 up key&lt;br /&gt;
  bindKey ( player, &amp;quot;fire&amp;quot;, &amp;quot;both&amp;quot;, funcInput ) -- bind the player's fire down and up control&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;bindme&amp;quot;, bindTheKeys )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example 2&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example will bind a player's 'F1' key and 'fire' control to 1 input function, clientside.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function funcInput ( key, keyState )&lt;br /&gt;
	outputChatBox( &amp;quot;You &amp;quot; .. (keyState == &amp;quot;down&amp;quot; and &amp;quot;pressed&amp;quot; or &amp;quot;let go of&amp;quot;) .. &amp;quot; the &amp;quot; .. key .. &amp;quot; key!&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function bindTheKeys ( commandName )&lt;br /&gt;
	bindKey( &amp;quot;F1&amp;quot;, &amp;quot;down&amp;quot;, funcInput )   -- bind the player's F1 down key&lt;br /&gt;
	bindKey( &amp;quot;F1&amp;quot;, &amp;quot;up&amp;quot;, funcInput )     -- bind the player's F1 up key&lt;br /&gt;
	bindKey( &amp;quot;fire&amp;quot;, &amp;quot;both&amp;quot;, funcInput ) -- bind the player's fire down and up control&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;bindme&amp;quot;, bindTheKeys )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example says how cool is the MTA:SA is if players wants to move.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function fanFunction()&lt;br /&gt;
  bindKey (source,&amp;quot;forwards&amp;quot;,&amp;quot;down&amp;quot;,&lt;br /&gt;
    function(player,key,state)&lt;br /&gt;
      outputChatBox (getPlayerName (player) .. &amp;quot;#FFFF00 thinks MTA:SA is so cool.&amp;quot;,root,255,255,0,true)&lt;br /&gt;
    end&lt;br /&gt;
  )&lt;br /&gt;
end&lt;br /&gt;
addEventHandler (&amp;quot;onPlayerLogin&amp;quot;,root,fanFunction)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Input functions}}&lt;br /&gt;
[[pt-br:bindKey]]&lt;/div&gt;</summary>
		<author><name>Gtkvba</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=BindKey&amp;diff=76839</id>
		<title>BindKey</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=BindKey&amp;diff=76839"/>
		<updated>2023-05-30T11:17:17Z</updated>

		<summary type="html">&lt;p&gt;Gtkvba: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
Binds a player's key to a handler function or command, which will be called when the key is pressed.&lt;br /&gt;
&lt;br /&gt;
{{Note|Using escape key will always return false. Use [[onClientKey]] event instead.}}&lt;br /&gt;
&lt;br /&gt;
{{Note|BindKey wont be triggered while focused in cegui editbox. Use [[onClientKey]] event instead.}}&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;section name=&amp;quot;Server - Syntax 1&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool bindKey ( player thePlayer, string key, string keyState, function handlerFunction,  [ var arguments, ... ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''thePlayer:''' The player you wish to bind the key of.&lt;br /&gt;
*'''key:''' The key or control you wish to bind to the command. See [[key names]] for a list of possible keys and [[control names]] for a list of possible controls.&lt;br /&gt;
*'''keyState:''' A string that has one of the following values:&lt;br /&gt;
**'''&amp;quot;up&amp;quot;:''' If the bound key should trigger the function when the key is released&lt;br /&gt;
**'''&amp;quot;down&amp;quot;:''' If the bound key should trigger the function when the key is pressed&lt;br /&gt;
**'''&amp;quot;both&amp;quot;:''' If the bound key should trigger the function when the key is pressed or released&lt;br /&gt;
*'''handlerFunction:''' The function that will be triggered when the player's key is pressed. This function should have the form:&lt;br /&gt;
:&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;function functionName ( player keyPresser, string key, string keyState, [ var arguments, ... ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
:The values passed to this function are:&lt;br /&gt;
:*'''keyPresser:''' The player who pressed the key&lt;br /&gt;
:*'''key:''' The key that was pressed&lt;br /&gt;
:*'''keyState:''' The state of the key that was pressed, ''down'' if it was pressed, ''up'' if it was released.&lt;br /&gt;
:*'''arguments''' The optional arguments you specified when calling [[bindKey]] (see below).&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{New feature|3|1.0|&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server - Syntax 2&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This alternative syntax allows you to bind a key with a command.  This will also allow users to customize the control in their Settings menu.  Use in conjunction with [[addCommandHandler]] to add handler functions to the keybind.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool bindKey ( player thePlayer, string key, string keyState, string commandName, [ string arguments ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''thePlayer:''' The player you wish to bind the key of.&lt;br /&gt;
*'''key:''' The key or control you wish to bind to the command. See [[key names]] for a list of possible keys.&lt;br /&gt;
*'''keyState:''' A string that has one of the following values:&lt;br /&gt;
**'''&amp;quot;up&amp;quot;:''' If the bound key should trigger the function when the key is released&lt;br /&gt;
**'''&amp;quot;down&amp;quot;:''' If the bound key should trigger the function when the key is pressed&lt;br /&gt;
**'''&amp;quot;both&amp;quot;:''' If the bound key should trigger the function when the key is pressed or released&lt;br /&gt;
*'''commandName:''' The name of the command that the key should be binded to.  &lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''arguments''' Space delimited arguments that are entered as if one was typing the command.&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client - Syntax 1&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool bindKey ( string key, string keyState, function handlerFunction,  [ var arguments, ... ] ) &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''key:''' The key or control you wish to bind to the command. See [[key names]] for a list of possible keys and [[control names]] for a list of possible controls.&lt;br /&gt;
*'''keyState:''' A string that has one of the following values:&lt;br /&gt;
**'''&amp;quot;up&amp;quot;:''' If the bound key should trigger the function when the key is released&lt;br /&gt;
**'''&amp;quot;down&amp;quot;:''' If the bound key should trigger the function when the key is pressed&lt;br /&gt;
**'''&amp;quot;both&amp;quot;:''' If the bound key should trigger the function when the key is pressed or released&lt;br /&gt;
&amp;lt;!--*'''bindName:''' The name for this key bind when it appears in the client's settings dialog.--&amp;gt;&lt;br /&gt;
*'''handlerFunction:''' The function that will be triggered when the player's key is pressed. This function should have the form:&lt;br /&gt;
:&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;function functionName ( string key, string keyState, [ var arguments, ... ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
:The values passed to this function are:&lt;br /&gt;
:*'''key:''' The key that was pressed&lt;br /&gt;
:*'''keyState:''' The state of the key that was pressed, ''down'' if it was pressed, ''up'' if it was released.&lt;br /&gt;
:*'''arguments''' The optional arguments you specified when calling [[bindKey]] (see below).&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{New feature|3|1.0|&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client - Syntax 2&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This alternative syntax allows you to bind a key with a command.  This will also allow users to customize the control in their Settings menu.  Use in conjunction with [[addCommandHandler]] to add handler functions to the keybind.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool bindKey ( string key, string keyState, string commandName, [ string arguments ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''key:''' The key or control you wish to bind to the command. See [[key names]] for a list of possible keys.&lt;br /&gt;
*'''keyState:''' A string that has one of the following values:&lt;br /&gt;
**'''&amp;quot;up&amp;quot;:''' If the bound key should trigger the function when the key is released&lt;br /&gt;
**'''&amp;quot;down&amp;quot;:''' If the bound key should trigger the function when the key is pressed&lt;br /&gt;
**'''&amp;quot;both&amp;quot;:''' If the bound key should trigger the function when the key is pressed or released&lt;br /&gt;
*'''commandName:''' The name of the command that the key should be binded to.  &lt;br /&gt;
*'''arguments''' Space delimited arguments that are entered as if one was typing the command.&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
{{OptionalArg}} &lt;br /&gt;
*'''arguments:''' Any arguments you may want to pass to the function when the key is pressed by the user. Any number of arguments of  can be specified, each being passed to the designated function. You may not pass functions.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the key was bound, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
Example 1&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example will bind a player's 'F1' key and 'fire' control to 1 input function.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function funcInput ( player, key, keyState )&lt;br /&gt;
  outputChatBox ( getPlayerName ( player) .. &amp;quot; &amp;quot; .. (keyState == &amp;quot;down&amp;quot; and &amp;quot;pressed&amp;quot; or &amp;quot;released&amp;quot;) .. &amp;quot; the &amp;quot; .. key .. &amp;quot; key!&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function bindTheKeys ( player, commandName )&lt;br /&gt;
  bindKey ( player, &amp;quot;F1&amp;quot;, &amp;quot;down&amp;quot;, funcInput )   -- bind the player's F1 down key&lt;br /&gt;
  bindKey ( player, &amp;quot;F1&amp;quot;, &amp;quot;up&amp;quot;, funcInput )     -- bind the player's F1 up key&lt;br /&gt;
  bindKey ( player, &amp;quot;fire&amp;quot;, &amp;quot;both&amp;quot;, funcInput ) -- bind the player's fire down and up control&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;bindme&amp;quot;, bindTheKeys )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example 2&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example will bind a player's 'F1' key and 'fire' control to 1 input function, clientside.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function funcInput ( key, keyState )&lt;br /&gt;
	outputChatBox( &amp;quot;You &amp;quot; .. (keyState == &amp;quot;down&amp;quot; and &amp;quot;pressed&amp;quot; or &amp;quot;let go of&amp;quot;) .. &amp;quot; the &amp;quot; .. key .. &amp;quot; key!&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function bindTheKeys ( commandName )&lt;br /&gt;
	bindKey( &amp;quot;F1&amp;quot;, &amp;quot;down&amp;quot;, funcInput )   -- bind the player's F1 down key&lt;br /&gt;
	bindKey( &amp;quot;F1&amp;quot;, &amp;quot;up&amp;quot;, funcInput )     -- bind the player's F1 up key&lt;br /&gt;
	bindKey( &amp;quot;fire&amp;quot;, &amp;quot;both&amp;quot;, funcInput ) -- bind the player's fire down and up control&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;bindme&amp;quot;, bindTheKeys )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example says how cool is the MTA:SA is if players wants to move.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function fanFunction()&lt;br /&gt;
  bindKey (source,&amp;quot;forwards&amp;quot;,&amp;quot;down&amp;quot;,&lt;br /&gt;
    function(player,key,state)&lt;br /&gt;
      outputChatBox (getPlayerName (player) .. &amp;quot;#FFFF00 thinks MTA:SA is so cool.&amp;quot;,root,255,255,0,true)&lt;br /&gt;
    end&lt;br /&gt;
  )&lt;br /&gt;
end&lt;br /&gt;
addEventHandler (&amp;quot;onPlayerLogin&amp;quot;,root,fanFunction)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Input functions}}&lt;br /&gt;
[[pt-br:bindKey]]&lt;/div&gt;</summary>
		<author><name>Gtkvba</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GuiGridListAddColumn&amp;diff=75699</id>
		<title>GuiGridListAddColumn</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GuiGridListAddColumn&amp;diff=75699"/>
		<updated>2022-12-02T21:26:45Z</updated>

		<summary type="html">&lt;p&gt;Gtkvba: Adjustment&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function is used to create columns in grid lists.&lt;br /&gt;
&lt;br /&gt;
{{Note|If the width of all columns exceeds 0.95 horizontal scrollbar will appear.}}&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int guiGridListAddColumn ( element gridList, string title, float width )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[Element/GUI/Gridlist|GuiGridList]]:addColumn}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''gridList:''' The grid list you want to add a column to&lt;br /&gt;
*'''title:''' Title of the column&lt;br /&gt;
*'''width:''' Column width, relative to the grid list width&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the column id if it was created, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example creates a player list on the right side of the screen and fills it with the currently connected players.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local playerList = guiCreateGridList(0.80, 0.40, 0.15, 0.35, true)&lt;br /&gt;
guiGridListAddColumn(playerList, &amp;quot;Player&amp;quot;, 0.85)&lt;br /&gt;
&lt;br /&gt;
for _, player in ipairs(getElementsByType(&amp;quot;player&amp;quot;)) do&lt;br /&gt;
	guiGridListAddRow(playerList, getPlayerName(player))&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{GUI functions}}&lt;br /&gt;
{{GUI_events}}&lt;/div&gt;</summary>
		<author><name>Gtkvba</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GuiGridListAddColumn&amp;diff=75698</id>
		<title>GuiGridListAddColumn</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GuiGridListAddColumn&amp;diff=75698"/>
		<updated>2022-12-02T21:25:03Z</updated>

		<summary type="html">&lt;p&gt;Gtkvba: Additional info about horizontal scrollbar.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function is used to create columns in grid lists.&lt;br /&gt;
&lt;br /&gt;
{{Note|If the width of all columns exceeds 0.95 additional horizontal scrollbar will appear.}}&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int guiGridListAddColumn ( element gridList, string title, float width )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[Element/GUI/Gridlist|GuiGridList]]:addColumn}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''gridList:''' The grid list you want to add a column to&lt;br /&gt;
*'''title:''' Title of the column&lt;br /&gt;
*'''width:''' Column width, relative to the grid list width&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the column id if it was created, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example creates a player list on the right side of the screen and fills it with the currently connected players.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local playerList = guiCreateGridList(0.80, 0.40, 0.15, 0.35, true)&lt;br /&gt;
guiGridListAddColumn(playerList, &amp;quot;Player&amp;quot;, 0.85)&lt;br /&gt;
&lt;br /&gt;
for _, player in ipairs(getElementsByType(&amp;quot;player&amp;quot;)) do&lt;br /&gt;
	guiGridListAddRow(playerList, getPlayerName(player))&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{GUI functions}}&lt;br /&gt;
{{GUI_events}}&lt;/div&gt;</summary>
		<author><name>Gtkvba</name></author>
	</entry>
</feed>