<?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=ArtyomHead</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=ArtyomHead"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/ArtyomHead"/>
	<updated>2026-04-05T14:46:37Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetControlState&amp;diff=71066</id>
		<title>GetControlState</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetControlState&amp;diff=71066"/>
		<updated>2021-05-13T19:36:00Z</updated>

		<summary type="html">&lt;p&gt;ArtyomHead: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function will check if a player is pressing a particular control. Controls are those that affect GTA. If you wish to get the state of another key, use [[bindKey]] and a command function.&lt;br /&gt;
&lt;br /&gt;
Note: Not all control states are sent to the server at all times, as such their state may be given incorrectly. As a rule, keys that move or affect the player or their vehicle are most likely to be accurate. For increased accuracy (and also increased bandwidth usage) use bindKey instead to bind a GTA control name to a function.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool getControlState ( player thePlayer, string controlName )&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''thePlayer:''' The player you wish to get the control state of. Do not use this parameter when scripting for client.&lt;br /&gt;
*'''controlName:''' The control that you want to get the state of. See [[control names]] for a list of possible controls.&lt;br /&gt;
'''Note:''' several controls are not synched with the server, therefore the function will always return ''false'' for these controls serverside. These controls are:&lt;br /&gt;
*next_weapon&lt;br /&gt;
*previous_weapon&lt;br /&gt;
*jump&lt;br /&gt;
*zoom_in&lt;br /&gt;
*zoom_out&lt;br /&gt;
*look_behind&lt;br /&gt;
*change_camera&lt;br /&gt;
*conversation_yes&lt;br /&gt;
*conversation_no&lt;br /&gt;
*group_control_forwards&lt;br /&gt;
*group_control_back&lt;br /&gt;
*sub_mission&lt;br /&gt;
*radio_next&lt;br /&gt;
*radio_previous&lt;br /&gt;
*vehicle_look_left&lt;br /&gt;
*vehicle_look_right&lt;br /&gt;
*vehicle_look_behind&lt;br /&gt;
*vehicle_mouse_look&lt;br /&gt;
*special_control_*&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the state of the control, ''false'' if the control doesn't exist or if the player is dead.&lt;br /&gt;
&lt;br /&gt;
==Example==  &lt;br /&gt;
This example starts a repeating check when a player spawns, if a player presses the fire key, they'll be killed. &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onPlayerSpawn ( theSpawnpoint )&lt;br /&gt;
    killPlayerIfTheyPressThisKey ( source, &amp;quot;fire&amp;quot; ) -- start a repeating check&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerSpawn&amp;quot;, root, onPlayerSpawn )&lt;br /&gt;
&lt;br /&gt;
function killPlayerIfTheyPressThisKey ( thePlayer, key )&lt;br /&gt;
    if ( getControlState ( thePlayer, key ) ) then        -- if they're pressing the fire key&lt;br /&gt;
        outputChatBox ( &amp;quot;Violence will not be tolerated!&amp;quot;, thePlayer )&lt;br /&gt;
        killPed ( thePlayer )                          -- kill them&lt;br /&gt;
    else                                                  -- otherwise..&lt;br /&gt;
        setTimer ( killPlayerIfTheyPressThisKey, 500, 1, thePlayer, key ) -- call this function again in 500ms&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Changelog==&lt;br /&gt;
{{ChangelogHeader}}&lt;br /&gt;
{{ChangelogItem|1.5.5-3.11427|Deprecated client-side. Use [[setPedControlState]] and [[getPedControlState]] client-side.}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Input functions}}&lt;/div&gt;</summary>
		<author><name>ArtyomHead</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetControlState&amp;diff=71065</id>
		<title>GetControlState</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetControlState&amp;diff=71065"/>
		<updated>2021-05-13T19:31:04Z</updated>

		<summary type="html">&lt;p&gt;ArtyomHead: chaged &amp;quot;Server-only&amp;quot; to &amp;quot;Shared&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Shared function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function will check if a player is pressing a particular control. Controls are those that affect GTA. If you wish to get the state of another key, use [[bindKey]] and a command function.&lt;br /&gt;
&lt;br /&gt;
Note: Not all control states are sent to the server at all times, as such their state may be given incorrectly. As a rule, keys that move or affect the player or their vehicle are most likely to be accurate. For increased accuracy (and also increased bandwidth usage) use bindKey instead to bind a GTA control name to a function.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool getControlState ( player thePlayer, string controlName )&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''thePlayer:''' The player you wish to get the control state of. Do not use this parameter when scripting for client.&lt;br /&gt;
*'''controlName:''' The control that you want to get the state of. See [[control names]] for a list of possible controls.&lt;br /&gt;
'''Note:''' several controls are not synched with the server, therefore the function will always return ''false'' for these controls serverside. These controls are:&lt;br /&gt;
*next_weapon&lt;br /&gt;
*previous_weapon&lt;br /&gt;
*jump&lt;br /&gt;
*zoom_in&lt;br /&gt;
*zoom_out&lt;br /&gt;
*look_behind&lt;br /&gt;
*change_camera&lt;br /&gt;
*conversation_yes&lt;br /&gt;
*conversation_no&lt;br /&gt;
*group_control_forwards&lt;br /&gt;
*group_control_back&lt;br /&gt;
*sub_mission&lt;br /&gt;
*radio_next&lt;br /&gt;
*radio_previous&lt;br /&gt;
*vehicle_look_left&lt;br /&gt;
*vehicle_look_right&lt;br /&gt;
*vehicle_look_behind&lt;br /&gt;
*vehicle_mouse_look&lt;br /&gt;
*special_control_*&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the state of the control, ''false'' if the control doesn't exist or if the player is dead.&lt;br /&gt;
&lt;br /&gt;
==Example==  &lt;br /&gt;
This example starts a repeating check when a player spawns, if a player presses the fire key, they'll be killed. &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onPlayerSpawn ( theSpawnpoint )&lt;br /&gt;
    killPlayerIfTheyPressThisKey ( source, &amp;quot;fire&amp;quot; ) -- start a repeating check&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerSpawn&amp;quot;, root, onPlayerSpawn )&lt;br /&gt;
&lt;br /&gt;
function killPlayerIfTheyPressThisKey ( thePlayer, key )&lt;br /&gt;
    if ( getControlState ( thePlayer, key ) ) then        -- if they're pressing the fire key&lt;br /&gt;
        outputChatBox ( &amp;quot;Violence will not be tolerated!&amp;quot;, thePlayer )&lt;br /&gt;
        killPed ( thePlayer )                          -- kill them&lt;br /&gt;
    else                                                  -- otherwise..&lt;br /&gt;
        setTimer ( killPlayerIfTheyPressThisKey, 500, 1, thePlayer, key ) -- call this function again in 500ms&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Changelog==&lt;br /&gt;
{{ChangelogHeader}}&lt;br /&gt;
{{ChangelogItem|1.5.5-3.11427|Deprecated client-side. Use [[setPedControlState]] and [[getPedControlState]] client-side.}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Input functions}}&lt;/div&gt;</summary>
		<author><name>ArtyomHead</name></author>
	</entry>
</feed>