<?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=TDHBoss</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=TDHBoss"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/TDHBoss"/>
	<updated>2026-05-17T07:47:56Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=CreateProjectile&amp;diff=8969</id>
		<title>CreateProjectile</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=CreateProjectile&amp;diff=8969"/>
		<updated>2007-07-07T09:35:05Z</updated>

		<summary type="html">&lt;p&gt;TDHBoss: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
This creates a projectile of the specified type on the specified coords.&lt;br /&gt;
&lt;br /&gt;
==Usage==&lt;br /&gt;
Client-side only.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool createProjectile ( element creator, int weapon, [ float x = x, float y = y, float z = z, float force = 1.0, element target = nil ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Required Arguments==&lt;br /&gt;
*'''creator:''' The [[element]] representing creator of the projectile. In case you want the projectile to be synced for everybody creator must be [[getLocalPlayer]]().&lt;br /&gt;
*'''weapon:''' [[int]] representing the projectile weapon ID. Valid IDs are:&lt;br /&gt;
{{Projectiles}}&lt;br /&gt;
&lt;br /&gt;
==Optional Arguments==&lt;br /&gt;
{{OptionalArg}}&lt;br /&gt;
*'''x''','''y''','''z''': [[float]] starting coordinates for the projectile. They are coordinates of creator by default.&lt;br /&gt;
*'''force''': [[float]] representing the starting force of the projectile.&lt;br /&gt;
*'''target''': [[element]] target used for heat seeking rockets.&lt;br /&gt;
&lt;br /&gt;
==Returns==&lt;br /&gt;
Returns ''true'' if projectile creation was succesfull. Returns ''false'' if unable to create a projectile (wrong weapon ID or projectiles limit was reached).&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example makes a rocket minigun (minigun shooting with rockets).&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- This function gets triggered everytime player shoots.&lt;br /&gt;
function onClientPlayerWeaponFireFunc(weapon,ammo,ammoInClip,hitX,hitY,hitZ,hitElement)&lt;br /&gt;
	if source == getLocalPlayer() and weapon == 38 then -- if source is a local player and he uses minigun...&lt;br /&gt;
		if not createProjectile(getLocalPlayer(),19,getElementPosition(getLocalPlayer()),200) then -- then we either create a projectile...&lt;br /&gt;
			outputChatBox ( &amp;quot;Rocket minigun overheated! Give it a rest pal!&amp;quot;, source ) -- or if projectile limit is reached we output player a chat message&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
-- Don't forget to add the onClientPlayerWeaponFireFunc function as a handler for onClientPlayerWeaponFire.&lt;br /&gt;
addEventHandler(&amp;quot;onClientPlayerWeaponFire&amp;quot;,getRootElement(),onClientPlayerWeaponFireFunc)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>TDHBoss</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=PlaySoundFrontEnd&amp;diff=8968</id>
		<title>PlaySoundFrontEnd</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=PlaySoundFrontEnd&amp;diff=8968"/>
		<updated>2007-07-07T09:30:36Z</updated>

		<summary type="html">&lt;p&gt;TDHBoss: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
This function plays a frontend sound for the specified player.&lt;br /&gt;
&lt;br /&gt;
==Usage== &lt;br /&gt;
Both server-side and client-side. &amp;quot;thePlayer&amp;quot; argument isn't used in client-side version of this function.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool playSoundFrontEnd ( player thePlayer, int sound )   &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''thePlayer:''' The [[player]] you want the sound to play for.&lt;br /&gt;
*'''sound:''' A whole [[int]] specifying the sound id to play. Valid values are:&lt;br /&gt;
{{Sounds}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the sound was successfully played , ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==  &lt;br /&gt;
This example plays a sound when a player spawns&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onPlayerSpawn ( spawnpoint, team ) --when a player spawns&lt;br /&gt;
  playSoundFrontEnd ( source, 16 ) --play a sound for him&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerSpawn&amp;quot;, getElementRoot(), onPlayerSpawn ) --add an event for onPlayerSpawn&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Audio_functions}}&lt;/div&gt;</summary>
		<author><name>TDHBoss</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=PreloadMissionAudio&amp;diff=8966</id>
		<title>PreloadMissionAudio</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=PreloadMissionAudio&amp;diff=8966"/>
		<updated>2007-07-07T07:21:33Z</updated>

		<summary type="html">&lt;p&gt;TDHBoss: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
This function preloads a game sound into a specific sound slot. The sound can then be played with [[PlayMissionAudio]].&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool preloadMissionAudio ( player thePlayer, int sound, int slot )   &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''thePlayer''': the [[player]] you want to play the sound for.&lt;br /&gt;
*'''sound''': the [[int]] sound id to play (interpreted as unsigned short). Valid values are those from the '''data/AudioEvents.txt''' file.&lt;br /&gt;
*'''slot''': [[int]] sound slot in which you preloaded the sound.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the sound was successfully preloaded, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==  &lt;br /&gt;
See [[PlayMissionAudio]].&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Audio_functions}}&lt;/div&gt;</summary>
		<author><name>TDHBoss</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=CreateProjectile&amp;diff=8963</id>
		<title>CreateProjectile</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=CreateProjectile&amp;diff=8963"/>
		<updated>2007-07-06T22:29:13Z</updated>

		<summary type="html">&lt;p&gt;TDHBoss: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
This creates a projectile of the specified type on the specified coords.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool createProjectile ( element creator, int weapon, [ float x = x, float y = y, float z = z, float force = 1.0, element target = nil ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Required Arguments==&lt;br /&gt;
*'''creator:''' The [[element]] representing creator of the projectile. In case you want the projectile to be synced for everybody creator must be [[getLocalPlayer]]().&lt;br /&gt;
*'''weapon:''' [[int]] representing the [[projectiles|projectile weapon ID]].&lt;br /&gt;
&lt;br /&gt;
==Optional Arguments==&lt;br /&gt;
{{OptionalArg}}&lt;br /&gt;
*'''x''','''y''','''z''': [[float]] starting coordinates for the projectile. They are coordinates of creator by default.&lt;br /&gt;
*'''force''': [[float]] representing the starting force of the projectile.&lt;br /&gt;
*'''target''': [[element]] target used for heat seeking rockets.&lt;br /&gt;
&lt;br /&gt;
==Returns==&lt;br /&gt;
Returns ''true'' if projectile creation was succesfull. Returns ''false'' if unable to create a projectile (wrong weapon ID or projectiles limit was reached).&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example makes a rocket minigun (minigun shooting with rockets).&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- This function gets triggered everytime player shoots.&lt;br /&gt;
function onClientPlayerWeaponFireFunc(weapon,ammo,ammoInClip,hitX,hitY,hitZ,hitElement)&lt;br /&gt;
	if source == getLocalPlayer() and weapon == 38 then -- if source is a local player and he uses minigun...&lt;br /&gt;
		if not createProjectile(getLocalPlayer(),19,getElementPosition(getLocalPlayer()),200) then -- then we either create a projectile...&lt;br /&gt;
			outputChatBox ( &amp;quot;Rocket minigun overheated! Give it a rest pal!&amp;quot;, source ) -- or if projectile limit is reached we output player a chat message&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
-- Don't forget to add the onClientPlayerWeaponFireFunc function as a handler for onClientPlayerWeaponFire.&lt;br /&gt;
addEventHandler(&amp;quot;onClientPlayerWeaponFire&amp;quot;,getRootElement(),onClientPlayerWeaponFireFunc)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>TDHBoss</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=CreateProjectile&amp;diff=8962</id>
		<title>CreateProjectile</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=CreateProjectile&amp;diff=8962"/>
		<updated>2007-07-06T22:26:22Z</updated>

		<summary type="html">&lt;p&gt;TDHBoss: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
This creates a projectile of the specified type on the specified coords. Returns [[true]] if creation was succesfull or [[false]] otherwise.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool createProjectile ( element creator, int weapon, [ float x = x, float y = y, float z = z, float force = 1.0, element target = nil ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Required Arguments==&lt;br /&gt;
*'''creator:''' The [[element]] representing creator of the projectile. In case you want the projectile to be synced for everybody creator must be [[getLocalPlayer]]().&lt;br /&gt;
*'''weapon:''' [[int]] representing the [[projectiles|projectile weapon ID]].&lt;br /&gt;
&lt;br /&gt;
==Optional Arguments==&lt;br /&gt;
{{OptionalArg}}&lt;br /&gt;
*'''x''','''y''','''z''': [[float]] starting coordinates for the projectile. They are coordinates of creator by default.&lt;br /&gt;
*'''force''': [[float]] representing the starting force of the projectile.&lt;br /&gt;
*'''target''': [[element]] target used for heat seeking rockets.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example makes a rocket minigun (minigun shooting with rockets).&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- This function gets triggered everytime player shoots.&lt;br /&gt;
function onClientPlayerWeaponFireFunc(weapon,ammo,ammoInClip,hitX,hitY,hitZ,hitElement)&lt;br /&gt;
	if source == getLocalPlayer() and weapon == 38 then -- if source is a local player and he uses minigun...&lt;br /&gt;
		if not createProjectile(getLocalPlayer(),19,getElementPosition(getLocalPlayer()),200) then -- then we either create a projectile...&lt;br /&gt;
			outputChatBox ( &amp;quot;Rocket minigun overheated! Give it a rest pal!&amp;quot;, source ) -- or if projectile limit is reached we output player a chat message&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
-- Don't forget to add the onClientPlayerWeaponFireFunc function as a handler for onClientPlayerWeaponFire.&lt;br /&gt;
addEventHandler(&amp;quot;onClientPlayerWeaponFire&amp;quot;,getRootElement(),onClientPlayerWeaponFireFunc)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>TDHBoss</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientPlayerWeaponFire&amp;diff=8961</id>
		<title>OnClientPlayerWeaponFire</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientPlayerWeaponFire&amp;diff=8961"/>
		<updated>2007-07-06T22:01:57Z</updated>

		<summary type="html">&lt;p&gt;TDHBoss: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
This event is called when player shoots a weapon.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
void onClientPlayerWeaponFire ( int weapon, int ammo, int ammoInClip, float hitX, float hitY, float hitZ, element hitElement )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
*The '''source''' of this event refers to the player who made a shot.&lt;br /&gt;
*'''weapon''':  an [[int]] representing [[weapons|weapon]] used for making a shot.&lt;br /&gt;
*'''ammo''': an [[int]] ammount of ammo left for this weapon type.&lt;br /&gt;
*'''ammoInClip''': an [[int]] ammount of ammo left for this weapon type in clip.&lt;br /&gt;
*'''hitX''', '''hitY''', '''hitZ''': [[float]] world coordinates representing a hit point.&lt;br /&gt;
*'''hitElement''': an [[element]] which was hit by a shot.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example shows player a warning if he hits any other player with minigun.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- trigger the event every time player shots&lt;br /&gt;
function onClientPlayerWeaponFireFunc(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement )&lt;br /&gt;
    if weapon == 38 and getElementType(hitElement)==&amp;quot;player&amp;quot; then -- if player shots from minigun and he hits another player...&lt;br /&gt;
         outputChatBox ( &amp;quot;Don't kill people with minigun, it's lame!&amp;quot;, source ) -- then we output him a warning&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
-- don't forget to add the onClientPlayerWeaponFireFunc function as a handler for onClientPlayerWeaponFire&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerSpawn&amp;quot;, getRootElement(), onClientPlayerWeaponFireFunc )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>TDHBoss</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientPlayerWeaponFire&amp;diff=8960</id>
		<title>OnClientPlayerWeaponFire</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientPlayerWeaponFire&amp;diff=8960"/>
		<updated>2007-07-06T22:00:12Z</updated>

		<summary type="html">&lt;p&gt;TDHBoss: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
This event is called when player shoots a weapon.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
void onClientPlayerWeaponFire ( int weapon, int ammo, int ammoInClip, float hitX, float hitY, float hitZ, element hitElement )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
*The '''source''' of this event refers to the player who made a shot.&lt;br /&gt;
*'''weapon''':  a [[weapons|weapon]] [[integer]] of a weapon used.&lt;br /&gt;
*'''ammo''': an [[integer]] ammount of ammo left for this weapon type.&lt;br /&gt;
*'''ammoInClip''': an [[integer]] ammount of ammo left for this weapon type in clip.&lt;br /&gt;
*'''hitX''', '''hitY''', '''hitZ''': [[float]] world coordinates representing a hit point.&lt;br /&gt;
*'''hitElement''': an [[element]] which was hit by a shot.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example shows player a warning if he hits any other player with minigun.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- trigger the event every time player shots&lt;br /&gt;
function onClientPlayerWeaponFireFunc(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement )&lt;br /&gt;
    if weapon == 38 and getElementType(hitElement)==&amp;quot;player&amp;quot; then -- if player shots from minigun and he hits another player...&lt;br /&gt;
         outputChatBox ( &amp;quot;Don't kill people with minigun, it's lame!&amp;quot;, source ) -- then we output him a warning&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
-- don't forget to add the onClientPlayerWeaponFireFunc function as a handler for onClientPlayerWeaponFire&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerSpawn&amp;quot;, getRootElement(), onClientPlayerWeaponFireFunc )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Projectile functions}}&lt;/div&gt;</summary>
		<author><name>TDHBoss</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientPlayerWeaponFire&amp;diff=8959</id>
		<title>OnClientPlayerWeaponFire</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientPlayerWeaponFire&amp;diff=8959"/>
		<updated>2007-07-06T21:59:17Z</updated>

		<summary type="html">&lt;p&gt;TDHBoss: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
This event is called when player shoots a weapon.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
void onClientPlayerWeaponFire ( int weapon, int ammo, int ammoInClip, float hitX, float hitY, float hitZ, element hitElement )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
*The '''source''' of this event refers to the player who made a shot.&lt;br /&gt;
*'''weapon''':  a [[weapons|weapon]] [[integer]] of a weapon used.&lt;br /&gt;
*'''ammo''': an [[integer]] ammount of ammo left for this weapon type.&lt;br /&gt;
*'''ammoInClip''': an [[integer]] ammount of ammo left for this weapon type in clip.&lt;br /&gt;
*'''hitX''', '''hitY''', '''hitZ''': [[float]] world coordinates representing a hit point.&lt;br /&gt;
*'''hitElement''': an [[element]] which was hit by a shot.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example shows player a warning if he hits any other player with minigun.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- trigger the event every time player shots&lt;br /&gt;
function onClientPlayerWeaponFireFunc(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement )&lt;br /&gt;
    if weapon == 38 and getElementType(hitElement)==&amp;quot;player&amp;quot; then -- if player shots from minigun and he hits another player...&lt;br /&gt;
         outputChatBox ( &amp;quot;Don't kill people with minigun, it's lame!&amp;quot;, source ) -- then we output him a warning&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
-- add the onClientPlayerWeaponFireFunc function as a handler for onClientPlayerWeaponFire&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerSpawn&amp;quot;, getRootElement(), onClientPlayerWeaponFireFunc )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Projectiles functions}}&lt;/div&gt;</summary>
		<author><name>TDHBoss</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnPlayerSpawn&amp;diff=8958</id>
		<title>OnPlayerSpawn</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnPlayerSpawn&amp;diff=8958"/>
		<updated>2007-07-06T21:59:11Z</updated>

		<summary type="html">&lt;p&gt;TDHBoss: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
This event is called when a player spawns.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
void onPlayerSpawn ( spawnpoint theSpawnpoint, team theTeam )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
*The '''source''' of this event refers to the player who spawned.&lt;br /&gt;
*'''theSpawnpoint''':  a [[spawnpoint]] element representing the spawnpoint at which the player was spawned.&lt;br /&gt;
*'''theTeam''': a [[team]] element representing the team of the spawnpoint.&lt;br /&gt;
&lt;br /&gt;
==Example==  &lt;br /&gt;
This example plays a sound when a player spawns.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- when a player spawns,&lt;br /&gt;
function player_Spawn ( inSpawnpoint, inTeam )&lt;br /&gt;
	-- play a frontend sound for him&lt;br /&gt;
	playSoundFrontEnd ( source, 16 )&lt;br /&gt;
end&lt;br /&gt;
-- add the player_Spawn function as a handler for onPlayerSpawn&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerSpawn&amp;quot;, getRootElement(), player_Spawn )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Event functions}}&lt;/div&gt;</summary>
		<author><name>TDHBoss</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=CancelEvent&amp;diff=8957</id>
		<title>CancelEvent</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=CancelEvent&amp;diff=8957"/>
		<updated>2007-07-06T21:25:37Z</updated>

		<summary type="html">&lt;p&gt;TDHBoss: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
This function is used to stop the automatic internal handling of events, for example this can be used to prevent an item being given to a player when they walk over a pickup, by canceling the [[onPickupUse]] event. &lt;br /&gt;
&lt;br /&gt;
[[cancelEvent]] does not have an effect on all events, see the individual event's pages for information on what happens when the event is canceled. [[cancelEvent]] does not stop further event handlers from being called, as the order of event handlers being called is undefined in many cases. Instead, you can see if the currently active event has been cancelled using [[wasEventCanceled]].&lt;br /&gt;
&lt;br /&gt;
The use of cancelEvent outside of an event handler has no effect.&lt;br /&gt;
&lt;br /&gt;
If you implement your own custom events and want to handle them being cancelled, you should call [[wasEventCanceled]] to check after your call to [[triggerEvent]].&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool cancelEvent ()   &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Always returns ''true''.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example stops the player ''huntedPlayer'' from entering a vehicle:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- call 'stopVehicleEntry' whenever hunterPlayer is about to enter a vehicle:&lt;br /&gt;
addEventHandler ( &amp;quot;onVehicleStartEnter&amp;quot;, huntedPlayer, &amp;quot;stopVehicleEntry&amp;quot; )&lt;br /&gt;
function stopVehicleEntry ( theplayer, seat, jacked )&lt;br /&gt;
   cancelEvent () -- stop the event from occuring&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Event functions}}&lt;/div&gt;</summary>
		<author><name>TDHBoss</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Id&amp;diff=8949</id>
		<title>Id</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Id&amp;diff=8949"/>
		<updated>2007-07-06T21:00:03Z</updated>

		<summary type="html">&lt;p&gt;TDHBoss: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Note: this page needs to link functions they apply to'''&lt;br /&gt;
&lt;br /&gt;
ID stands for identification. It is a whole-number integer that refers to many mechanics of San Andreas.&lt;br /&gt;
----&lt;br /&gt;
Game elements using IDs:&lt;br /&gt;
''Note: does not include small ID lists related to specific functions or IDs created by MTA''&lt;br /&gt;
*[[Character Skins]]&lt;br /&gt;
*Clothing Styles&lt;br /&gt;
*[[Projectiles|Projectiles]]&lt;br /&gt;
*[[Template:Blip_Icons|Radar Blips]]&lt;br /&gt;
*[[Template:Sounds|Sounds]]&lt;br /&gt;
*[http://vces.net/info/CarIDs.html Vehicles]&lt;br /&gt;
* [[Template:Vehicle_colors|Vehicle Colors]]&lt;br /&gt;
*Vehicle Upgrades&lt;br /&gt;
*[[Weapons|Weapons]]&lt;br /&gt;
*[http://vces.net/info/WeatherIDs.html Weather] '''brophy needs to use 1-19 only''' ''Note: blended weather allows for many more undocumented effects''&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{IDs}}&lt;br /&gt;
&lt;br /&gt;
'''Credit for information contained in the pages:'''&lt;br /&gt;
Ransom (initial creation, formatting, and all lists not credited to others) eAi (vehicle colors list) erorr404/Talidan/Brophy (sound list) Talidan (radar blip pictures/vehicle list) Hellfish (skin pictures [http://www.gtaforums.com/index.php?showtopic=205220 SOURCE]) Brophy/Ratt/Panther/Twig (lots of inital ID data) GTAForums (Allowing Ransom to find IDs for lists)&lt;/div&gt;</summary>
		<author><name>TDHBoss</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Id&amp;diff=8948</id>
		<title>Id</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Id&amp;diff=8948"/>
		<updated>2007-07-06T20:59:35Z</updated>

		<summary type="html">&lt;p&gt;TDHBoss: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Note: this page needs to link functions they apply to'''&lt;br /&gt;
&lt;br /&gt;
ID stands for identification. It is a whole-number integer that refers to many mechanics of San Andreas.&lt;br /&gt;
----&lt;br /&gt;
Game elements using IDs:&lt;br /&gt;
''Note: does not include small ID lists related to specific functions or IDs created by MTA''&lt;br /&gt;
*[[Character Skins]]&lt;br /&gt;
*Clothing Styles&lt;br /&gt;
*[[Template:Blip_Icons|Radar Blips]]&lt;br /&gt;
*[[Projectiles|Projectiles]]&lt;br /&gt;
*[[Template:Sounds|Sounds]]&lt;br /&gt;
*[http://vces.net/info/CarIDs.html Vehicles]&lt;br /&gt;
* [[Template:Vehicle_colors|Vehicle Colors]]&lt;br /&gt;
*Vehicle Upgrades&lt;br /&gt;
*[[Weapons|Weapons]]&lt;br /&gt;
*[http://vces.net/info/WeatherIDs.html Weather] '''brophy needs to use 1-19 only''' ''Note: blended weather allows for many more undocumented effects''&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{IDs}}&lt;br /&gt;
&lt;br /&gt;
'''Credit for information contained in the pages:'''&lt;br /&gt;
Ransom (initial creation, formatting, and all lists not credited to others) eAi (vehicle colors list) erorr404/Talidan/Brophy (sound list) Talidan (radar blip pictures/vehicle list) Hellfish (skin pictures [http://www.gtaforums.com/index.php?showtopic=205220 SOURCE]) Brophy/Ratt/Panther/Twig (lots of inital ID data) GTAForums (Allowing Ransom to find IDs for lists)&lt;/div&gt;</summary>
		<author><name>TDHBoss</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=BindKey&amp;diff=8829</id>
		<title>BindKey</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=BindKey&amp;diff=8829"/>
		<updated>2007-06-28T19:38:42Z</updated>

		<summary type="html">&lt;p&gt;TDHBoss: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
Binds a player's key to a console command, which will be triggered when the key is pressed. Keys that are bound to actual keyboard keys are displayed and can be modified by the user from the settings window.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bindKey ( player thePlayer, string key, string keyState, string name, function functionName,  [ var aguments, ... ] ) &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;
*'''name:''' The name for this key bind when it appears in the client's settings dialog.&lt;br /&gt;
*'''functionName:''' The function that will be triggered when the player's key is pressed. Function name IS NOT a string, so you shouldn't use &amp;quot;&amp;quot;. This function should have the form:&lt;br /&gt;
:&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;function functionName ( source, key, keyState, [ var arguments, ... ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
:The values passed to this function are:&lt;br /&gt;
:*'''source:''' 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;
&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.&lt;br /&gt;
&lt;br /&gt;
==Example==  &lt;br /&gt;
'''Example 1:''' 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 ( source, key, keyState )&lt;br /&gt;
  local state = &amp;quot;let go of&amp;quot;&lt;br /&gt;
  if ( keyState == &amp;quot;down&amp;quot; ) then&lt;br /&gt;
    state = &amp;quot;pressed&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
  outputChatBox ( getClientName ( source ) .. &amp;quot; &amp;quot; .. state .. &amp;quot; the &amp;quot; .. key .. &amp;quot; key!&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function bindthekeys ( source )&lt;br /&gt;
  bindKey ( source, &amp;quot;F1&amp;quot;, &amp;quot;down&amp;quot;, funcInput ) -- bind the player's F1 down key&lt;br /&gt;
  bindKey ( source, &amp;quot;F1&amp;quot;, &amp;quot;up&amp;quot;, funcInput ) -- bind the player's F1 up key&lt;br /&gt;
  bindKey ( source, &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;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Input functions}}&lt;/div&gt;</summary>
		<author><name>TDHBoss</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=BindKey&amp;diff=8828</id>
		<title>BindKey</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=BindKey&amp;diff=8828"/>
		<updated>2007-06-28T19:37:09Z</updated>

		<summary type="html">&lt;p&gt;TDHBoss: /* Syntax */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
Binds a player's key to a console command, which will be triggered when the key is pressed. Keys that are bound to actual keyboard keys are displayed and can be modified by the user from the settings window.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bindKey ( player thePlayer, string key, string keyState, string name, function functionName,  [ var aguments, ... ] ) &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;
*'''name:''' The name for this key bind when it appears in the client's settings dialog.&lt;br /&gt;
*'''functionName:''' The function that will be triggered when the player's key is pressed. Function name IS NOT a string, so you shouldn't use &amp;quot;&amp;quot;. This function should have the form:&lt;br /&gt;
:&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;function functionName ( source, key, keyState, [ var arguments, ... ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
:The values passed to this function are:&lt;br /&gt;
:*'''source:''' 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;
&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.&lt;br /&gt;
&lt;br /&gt;
==Example==  &lt;br /&gt;
'''Example 1:''' 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;
addCommandHandler ( &amp;quot;bindme&amp;quot;, &amp;quot;bindthekeys&amp;quot; )&lt;br /&gt;
function bindthekeys ( source )&lt;br /&gt;
  bindKey ( source, &amp;quot;F1&amp;quot;, &amp;quot;down&amp;quot;, &amp;quot;funcInput&amp;quot; ) -- bind the player's F1 down key&lt;br /&gt;
  bindKey ( source, &amp;quot;F1&amp;quot;, &amp;quot;up&amp;quot;, &amp;quot;funcInput&amp;quot; ) -- bind the player's F1 up key&lt;br /&gt;
  bindKey ( source, &amp;quot;fire&amp;quot;, &amp;quot;both&amp;quot;, &amp;quot;funcInput&amp;quot; ) -- bind the player's fire down and up control&lt;br /&gt;
end&lt;br /&gt;
 &lt;br /&gt;
function funcInput ( source, key, keyState )&lt;br /&gt;
  local state = &amp;quot;let go of&amp;quot;&lt;br /&gt;
  if ( keyState == &amp;quot;down&amp;quot; ) then&lt;br /&gt;
    state = &amp;quot;pressed&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
  outputChatBox ( getClientName ( source ) .. &amp;quot; &amp;quot; .. state .. &amp;quot; the &amp;quot; .. key .. &amp;quot; key!&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Input functions}}&lt;/div&gt;</summary>
		<author><name>TDHBoss</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=BindKey&amp;diff=8827</id>
		<title>BindKey</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=BindKey&amp;diff=8827"/>
		<updated>2007-06-28T19:35:52Z</updated>

		<summary type="html">&lt;p&gt;TDHBoss: /* Syntax */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
Binds a player's key to a console command, which will be triggered when the key is pressed. Keys that are bound to actual keyboard keys are displayed and can be modified by the user from the settings window.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bindKey ( player thePlayer, string key, string keyState, string name, function function functionName,  [ var aguments, ... ] ) &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;
*'''name:''' The name for this key bind when it appears in the client's settings dialog.&lt;br /&gt;
*'''function functionName:''' The function that will be triggered when the player's key is pressed. Function name IS NOT a string, so you shouldn't use &amp;quot;&amp;quot;. This function should have the form:&lt;br /&gt;
:&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;function functionName ( source, key, keyState, [ var arguments, ... ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
:The values passed to this function are:&lt;br /&gt;
:*'''source:''' 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;
&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.&lt;br /&gt;
&lt;br /&gt;
==Example==  &lt;br /&gt;
'''Example 1:''' 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;
addCommandHandler ( &amp;quot;bindme&amp;quot;, &amp;quot;bindthekeys&amp;quot; )&lt;br /&gt;
function bindthekeys ( source )&lt;br /&gt;
  bindKey ( source, &amp;quot;F1&amp;quot;, &amp;quot;down&amp;quot;, &amp;quot;funcInput&amp;quot; ) -- bind the player's F1 down key&lt;br /&gt;
  bindKey ( source, &amp;quot;F1&amp;quot;, &amp;quot;up&amp;quot;, &amp;quot;funcInput&amp;quot; ) -- bind the player's F1 up key&lt;br /&gt;
  bindKey ( source, &amp;quot;fire&amp;quot;, &amp;quot;both&amp;quot;, &amp;quot;funcInput&amp;quot; ) -- bind the player's fire down and up control&lt;br /&gt;
end&lt;br /&gt;
 &lt;br /&gt;
function funcInput ( source, key, keyState )&lt;br /&gt;
  local state = &amp;quot;let go of&amp;quot;&lt;br /&gt;
  if ( keyState == &amp;quot;down&amp;quot; ) then&lt;br /&gt;
    state = &amp;quot;pressed&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
  outputChatBox ( getClientName ( source ) .. &amp;quot; &amp;quot; .. state .. &amp;quot; the &amp;quot; .. key .. &amp;quot; key!&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Input functions}}&lt;/div&gt;</summary>
		<author><name>TDHBoss</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AddCommandHandler&amp;diff=8826</id>
		<title>AddCommandHandler</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AddCommandHandler&amp;diff=8826"/>
		<updated>2007-06-28T15:16:23Z</updated>

		<summary type="html">&lt;p&gt;TDHBoss: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Note_box|It is strongly advised that you do not use the same name for your handler function as the command name, as this can lead to confusion if multiple handler functions are used.}}&lt;br /&gt;
This function will attach a scripting function (handler) to a console command, so that whenever a player or administrator uses the command the function is called.&lt;br /&gt;
&lt;br /&gt;
Multiple command handlers can be attached to a single command, and they will be called in the order that the handlers were attached. Equally, multiple commands can be handled by a single function, and the ''commandName'' parameter used to decide the course of action.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool addCommandHandler ( string commandName, function handlerFunction )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''commandName:''' This is the name of the command you wish to attach a handler to. This is what must be typed into the console to trigger the function.&lt;br /&gt;
*'''handlerFunction:''' This is the name of the function that you want the command to trigger. This function can take two parameters, playerSource and commandName, followed by as many parameters you expect after your command. These are all optional. Function name IS NOT a string, so you shouldn't use &amp;quot;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;player playerSource, string commandName, [string arg1, string arg2, ...] &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''playerSource:''' The player who triggered the command. If not triggered by a player (e.g. by admin), this will be ''false''.&lt;br /&gt;
* '''commandName:''' The name of the command triggered. This is useful if multiple commands go through one function.&lt;br /&gt;
* '''arg1, arg2, ...:''' Each word after command name in the original command is passed here in a seperate variable. If there is no value for an argument, its variable will contain [[nil]]. You can deal with a variable number of arguments using the vararg expression, as shown in '''Example 3''' below.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the command handler was added successfully, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
'''Example 1:''' This example defines a command handler for the command ''createmarker''. This will create a red marker at the position of the player player who uses it.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Define our function that will handle this command&lt;br /&gt;
function consoleCreateMarker ( playerSource, commandName )&lt;br /&gt;
	-- If a player triggered it (rather than the admin) then&lt;br /&gt;
	if ( playerSource ) then&lt;br /&gt;
		-- Get that player's position&lt;br /&gt;
		local x, y, z = getElementPosition ( playerSource )&lt;br /&gt;
		-- Create a size 2, red checkpoint marker at their position&lt;br /&gt;
		createMarker ( x, y, z, &amp;quot;checkpoint&amp;quot;, 2, 255, 0, 0, 255 )&lt;br /&gt;
		-- Output it in the chat box&lt;br /&gt;
		outputChatBox ( &amp;quot;You got a red marker&amp;quot;, playerSource )&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
-- Register the command and attach it to the 'consoleCreateMarker' function&lt;br /&gt;
-- You must add a handler ONLY after function definition.&lt;br /&gt;
addCommandHandler ( &amp;quot;createmarker&amp;quot;, consoleCreateMarker )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Example 2:''' This example implements a ''set_vehicle_color'' command.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Define our function that will handle this command&lt;br /&gt;
function consoleSetVehicleColor ( playerSource, commandName, col1, col2, col3, col4 )&lt;br /&gt;
	-- If a player triggered this in-game&lt;br /&gt;
	if ( playerSource ) then&lt;br /&gt;
		-- Get the player's vehicle&lt;br /&gt;
		local playerVehicle = getPlayerOccupiedVehicle ( playerSource )&lt;br /&gt;
		-- If the player is in a vehicle and we've got at least 1 parameter&lt;br /&gt;
		if ( playerVehicle and col1 ) then&lt;br /&gt;
			-- Get the vehicle's existing color and use it if fewer than 4 arguments were passed&lt;br /&gt;
			local exCol1, exCol2, exCol3, exCol4 = getVehicleColor ( playerVehicle )&lt;br /&gt;
&lt;br /&gt;
			if not col2 then col2 = exCol2 end&lt;br /&gt;
			if not col3 then col3 = exCol3 end&lt;br /&gt;
			if not col4 then col4 = exCol4 end&lt;br /&gt;
&lt;br /&gt;
			-- Set the vehicle's color&lt;br /&gt;
			setVehicleColor ( playerVehicle, col1, col2, col3, col4 )&lt;br /&gt;
		else&lt;br /&gt;
			-- If we didn't get at least 1 parameter or the player doesn't have a vehicle, display some help text&lt;br /&gt;
			outputConsole ( &amp;quot;This function will set your current vehicle's colors. A vehicle can have up to 4 colors.&amp;quot;, playerSource )&lt;br /&gt;
			outputConsole ( &amp;quot;Syntax: set_vehicle_color color1 [ color2 color3 color4 ]&amp;quot;, playerSource )&lt;br /&gt;
			outputConsole ( &amp;quot;You must be in a vehicle to use this function.&amp;quot;, playerSource )&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
-- Register the command and attach it to the 'consoleSetVehicleColor' function&lt;br /&gt;
-- You must add a handler ONLY after function definition.&lt;br /&gt;
addCommandHandler ( &amp;quot;set_vehicle_color&amp;quot;, consoleSetVehicleColor )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Example 3:''' This example makes use of Lua's vararg expression to output the number of parameters passed, merge them all into a single string and output it.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Define our function that will handle this command (which can accept a variable number of arguments after commandName)&lt;br /&gt;
function consoleCheckParameters ( playerSource, commandName, ... )&lt;br /&gt;
	-- If a player, not an admin, triggered it,&lt;br /&gt;
	if playerSource then&lt;br /&gt;
		-- Pack all extra arguments passed in a table&lt;br /&gt;
		local parametersTable = {...}&lt;br /&gt;
		-- Get the number of arguments in that table&lt;br /&gt;
		local parameterCount = #parametersTable&lt;br /&gt;
		-- Output it to the player's chatbox&lt;br /&gt;
		outputChatBox ( &amp;quot;Number of parameters: &amp;quot; .. parameterCount, playerSource )&lt;br /&gt;
		-- Join them together in a single comma-separated string&lt;br /&gt;
		local stringWithAllParameters = table.concat( parametersTable, &amp;quot;, &amp;quot; )&lt;br /&gt;
		-- Output this parameter list to the player's chatbox&lt;br /&gt;
		outputChatBox ( &amp;quot;Parameters passed: &amp;quot; .. stringWithAllParameter, playerSource )&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
-- Register the command and attach it to the 'consoleCheckParameters' function&lt;br /&gt;
-- You must add a handler ONLY after function definition.&lt;br /&gt;
addCommandHandler ( &amp;quot;check_parameters&amp;quot;, consoleCheckParamters )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Server functions}}&lt;/div&gt;</summary>
		<author><name>TDHBoss</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AddCommandHandler&amp;diff=8825</id>
		<title>AddCommandHandler</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AddCommandHandler&amp;diff=8825"/>
		<updated>2007-06-28T15:15:23Z</updated>

		<summary type="html">&lt;p&gt;TDHBoss: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Note_box|It is strongly advised that you do not use the same name for your handler function as the command name, as this can lead to confusion if multiple handler functions are used.}}&lt;br /&gt;
This function will attach a scripting function (handler) to a console command, so that whenever a player or administrator uses the command the function is called.&lt;br /&gt;
&lt;br /&gt;
Multiple command handlers can be attached to a single command, and they will be called in the order that the handlers were attached. Equally, multiple commands can be handled by a single function, and the ''commandName'' parameter used to decide the course of action.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool addCommandHandler ( string commandName, function handlerFunction )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''commandName:''' This is the name of the command you wish to attach a handler to. This is what must be typed into the console to trigger the function.&lt;br /&gt;
*'''handlerFunction:''' This is the name of the function that you want the command to trigger. This function can take two parameters, playerSource and commandName, followed by as many parameters you expect after your command. These are all optional. Function name IS NOT a string, so you shouldn't use &amp;quot;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;player playerSource, string commandName, [string arg1, string arg2, ...] &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''playerSource:''' The player who triggered the command. If not triggered by a player (e.g. by admin), this will be ''false''.&lt;br /&gt;
* '''commandName:''' The name of the command triggered. This is useful if multiple commands go through one function.&lt;br /&gt;
* '''arg1, arg2, ...:''' Each word after command name in the original command is passed here in a seperate variable. If there is no value for an argument, its variable will contain [[nil]]. You can deal with a variable number of arguments using the vararg expression, as shown in '''Example 3''' below.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the command handler was added successfully, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
'''Example 1:''' This example defines a command handler for the command ''createmarker''. This will create a red marker at the position of the player player who uses it.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Define our function that will handle this command&lt;br /&gt;
function consoleCreateMarker ( playerSource, commandName )&lt;br /&gt;
	-- If a player triggered it (rather than the admin) then&lt;br /&gt;
	if ( playerSource ) then&lt;br /&gt;
		-- Get that player's position&lt;br /&gt;
		local x, y, z = getElementPosition ( playerSource )&lt;br /&gt;
		-- Create a size 2, red checkpoint marker at their position&lt;br /&gt;
		createMarker ( x, y, z, &amp;quot;checkpoint&amp;quot;, 2, 255, 0, 0, 255 )&lt;br /&gt;
		-- Output it in the chat box&lt;br /&gt;
		outputChatBox ( &amp;quot;You got a red marker&amp;quot;, playerSource )&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
-- Register the command and attach it to the 'consoleCreateMarker' function&lt;br /&gt;
-- You must add a handler ONLY after function definition.&lt;br /&gt;
addCommandHandler ( &amp;quot;createmarker&amp;quot;, consoleCreateMarker )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Example 2:''' This example implements a ''set_vehicle_color'' command.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Register the command and attach it to the 'consoleSetVehicleColor' function&lt;br /&gt;
addCommandHandler ( &amp;quot;set_vehicle_color&amp;quot;, &amp;quot;consoleSetVehicleColor&amp;quot; )&lt;br /&gt;
-- Define our function that will handle this command&lt;br /&gt;
function consoleSetVehicleColor ( playerSource, commandName, col1, col2, col3, col4 )&lt;br /&gt;
	-- If a player triggered this in-game&lt;br /&gt;
	if ( playerSource ) then&lt;br /&gt;
		-- Get the player's vehicle&lt;br /&gt;
		local playerVehicle = getPlayerOccupiedVehicle ( playerSource )&lt;br /&gt;
		-- If the player is in a vehicle and we've got at least 1 parameter&lt;br /&gt;
		if ( playerVehicle and col1 ) then&lt;br /&gt;
			-- Get the vehicle's existing color and use it if fewer than 4 arguments were passed&lt;br /&gt;
			local exCol1, exCol2, exCol3, exCol4 = getVehicleColor ( playerVehicle )&lt;br /&gt;
&lt;br /&gt;
			if not col2 then col2 = exCol2 end&lt;br /&gt;
			if not col3 then col3 = exCol3 end&lt;br /&gt;
			if not col4 then col4 = exCol4 end&lt;br /&gt;
&lt;br /&gt;
			-- Set the vehicle's color&lt;br /&gt;
			setVehicleColor ( playerVehicle, col1, col2, col3, col4 )&lt;br /&gt;
		else&lt;br /&gt;
			-- If we didn't get at least 1 parameter or the player doesn't have a vehicle, display some help text&lt;br /&gt;
			outputConsole ( &amp;quot;This function will set your current vehicle's colors. A vehicle can have up to 4 colors.&amp;quot;, playerSource )&lt;br /&gt;
			outputConsole ( &amp;quot;Syntax: set_vehicle_color color1 [ color2 color3 color4 ]&amp;quot;, playerSource )&lt;br /&gt;
			outputConsole ( &amp;quot;You must be in a vehicle to use this function.&amp;quot;, playerSource )&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Example 3:''' This example makes use of Lua's vararg expression to output the number of parameters passed, merge them all into a single string and output it.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Register the command and attach it to the 'consoleCheckParameters' function&lt;br /&gt;
addCommandHandler ( &amp;quot;check_parameters&amp;quot;, &amp;quot;consoleCheckParamters&amp;quot; )&lt;br /&gt;
-- Define our function that will handle this command (which can accept a variable number of arguments after commandName)&lt;br /&gt;
function consoleCheckParameters ( playerSource, commandName, ... )&lt;br /&gt;
	-- If a player, not an admin, triggered it,&lt;br /&gt;
	if playerSource then&lt;br /&gt;
		-- Pack all extra arguments passed in a table&lt;br /&gt;
		local parametersTable = {...}&lt;br /&gt;
		-- Get the number of arguments in that table&lt;br /&gt;
		local parameterCount = #parametersTable&lt;br /&gt;
		-- Output it to the player's chatbox&lt;br /&gt;
		outputChatBox ( &amp;quot;Number of parameters: &amp;quot; .. parameterCount, playerSource )&lt;br /&gt;
		-- Join them together in a single comma-separated string&lt;br /&gt;
		local stringWithAllParameters = table.concat( parametersTable, &amp;quot;, &amp;quot; )&lt;br /&gt;
		-- Output this parameter list to the player's chatbox&lt;br /&gt;
		outputChatBox ( &amp;quot;Parameters passed: &amp;quot; .. stringWithAllParameter, playerSource )&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Server functions}}&lt;/div&gt;</summary>
		<author><name>TDHBoss</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AddCommandHandler&amp;diff=8824</id>
		<title>AddCommandHandler</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AddCommandHandler&amp;diff=8824"/>
		<updated>2007-06-28T15:13:06Z</updated>

		<summary type="html">&lt;p&gt;TDHBoss: /* Syntax */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Note_box|It is strongly advised that you do not use the same name for your handler function as the command name, as this can lead to confusion if multiple handler functions are used.}}&lt;br /&gt;
This function will attach a scripting function (handler) to a console command, so that whenever a player or administrator uses the command the function is called.&lt;br /&gt;
&lt;br /&gt;
Multiple command handlers can be attached to a single command, and they will be called in the order that the handlers were attached. Equally, multiple commands can be handled by a single function, and the ''commandName'' parameter used to decide the course of action.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool addCommandHandler ( string commandName, function handlerFunction )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''commandName:''' This is the name of the command you wish to attach a handler to. This is what must be typed into the console to trigger the function.&lt;br /&gt;
*'''handlerFunction:''' This is the name of the function that you want the command to trigger. This function can take two parameters, playerSource and commandName, followed by as many parameters you expect after your command. These are all optional. Function name IS NOT a string, so you shouldn't use &amp;quot;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;player playerSource, string commandName, [string arg1, string arg2, ...] &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''playerSource:''' The player who triggered the command. If not triggered by a player (e.g. by admin), this will be ''false''.&lt;br /&gt;
* '''commandName:''' The name of the command triggered. This is useful if multiple commands go through one function.&lt;br /&gt;
* '''arg1, arg2, ...:''' Each word after command name in the original command is passed here in a seperate variable. If there is no value for an argument, its variable will contain [[nil]]. You can deal with a variable number of arguments using the vararg expression, as shown in '''Example 3''' below.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the command handler was added successfully, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
'''Example 1:''' This example defines a command handler for the command ''createmarker''. This will create a red marker at the position of the player player who uses it.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Register the command and attach it to the 'consoleCreateMarker' function&lt;br /&gt;
addCommandHandler ( &amp;quot;createmarker&amp;quot;, &amp;quot;consoleCreateMarker&amp;quot; )&lt;br /&gt;
-- Define our function that will handle this command&lt;br /&gt;
function consoleCreateMarker ( playerSource, commandName )&lt;br /&gt;
	-- If a player triggered it (rather than the admin) then&lt;br /&gt;
	if ( playerSource ) then&lt;br /&gt;
		-- Get that player's position&lt;br /&gt;
		local x, y, z = getElementPosition ( playerSource )&lt;br /&gt;
		-- Create a size 2, red checkpoint marker at their position&lt;br /&gt;
		createMarker ( x, y, z, &amp;quot;checkpoint&amp;quot;, 2, 255, 0, 0, 255 )&lt;br /&gt;
		-- Output it in the chat box&lt;br /&gt;
		outputChatBox ( &amp;quot;You got a red marker&amp;quot;, playerSource )&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Example 2:''' This example implements a ''set_vehicle_color'' command.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Register the command and attach it to the 'consoleSetVehicleColor' function&lt;br /&gt;
addCommandHandler ( &amp;quot;set_vehicle_color&amp;quot;, &amp;quot;consoleSetVehicleColor&amp;quot; )&lt;br /&gt;
-- Define our function that will handle this command&lt;br /&gt;
function consoleSetVehicleColor ( playerSource, commandName, col1, col2, col3, col4 )&lt;br /&gt;
	-- If a player triggered this in-game&lt;br /&gt;
	if ( playerSource ) then&lt;br /&gt;
		-- Get the player's vehicle&lt;br /&gt;
		local playerVehicle = getPlayerOccupiedVehicle ( playerSource )&lt;br /&gt;
		-- If the player is in a vehicle and we've got at least 1 parameter&lt;br /&gt;
		if ( playerVehicle and col1 ) then&lt;br /&gt;
			-- Get the vehicle's existing color and use it if fewer than 4 arguments were passed&lt;br /&gt;
			local exCol1, exCol2, exCol3, exCol4 = getVehicleColor ( playerVehicle )&lt;br /&gt;
&lt;br /&gt;
			if not col2 then col2 = exCol2 end&lt;br /&gt;
			if not col3 then col3 = exCol3 end&lt;br /&gt;
			if not col4 then col4 = exCol4 end&lt;br /&gt;
&lt;br /&gt;
			-- Set the vehicle's color&lt;br /&gt;
			setVehicleColor ( playerVehicle, col1, col2, col3, col4 )&lt;br /&gt;
		else&lt;br /&gt;
			-- If we didn't get at least 1 parameter or the player doesn't have a vehicle, display some help text&lt;br /&gt;
			outputConsole ( &amp;quot;This function will set your current vehicle's colors. A vehicle can have up to 4 colors.&amp;quot;, playerSource )&lt;br /&gt;
			outputConsole ( &amp;quot;Syntax: set_vehicle_color color1 [ color2 color3 color4 ]&amp;quot;, playerSource )&lt;br /&gt;
			outputConsole ( &amp;quot;You must be in a vehicle to use this function.&amp;quot;, playerSource )&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Example 3:''' This example makes use of Lua's vararg expression to output the number of parameters passed, merge them all into a single string and output it.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Register the command and attach it to the 'consoleCheckParameters' function&lt;br /&gt;
addCommandHandler ( &amp;quot;check_parameters&amp;quot;, &amp;quot;consoleCheckParamters&amp;quot; )&lt;br /&gt;
-- Define our function that will handle this command (which can accept a variable number of arguments after commandName)&lt;br /&gt;
function consoleCheckParameters ( playerSource, commandName, ... )&lt;br /&gt;
	-- If a player, not an admin, triggered it,&lt;br /&gt;
	if playerSource then&lt;br /&gt;
		-- Pack all extra arguments passed in a table&lt;br /&gt;
		local parametersTable = {...}&lt;br /&gt;
		-- Get the number of arguments in that table&lt;br /&gt;
		local parameterCount = #parametersTable&lt;br /&gt;
		-- Output it to the player's chatbox&lt;br /&gt;
		outputChatBox ( &amp;quot;Number of parameters: &amp;quot; .. parameterCount, playerSource )&lt;br /&gt;
		-- Join them together in a single comma-separated string&lt;br /&gt;
		local stringWithAllParameters = table.concat( parametersTable, &amp;quot;, &amp;quot; )&lt;br /&gt;
		-- Output this parameter list to the player's chatbox&lt;br /&gt;
		outputChatBox ( &amp;quot;Parameters passed: &amp;quot; .. stringWithAllParameter, playerSource )&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Server functions}}&lt;/div&gt;</summary>
		<author><name>TDHBoss</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AddEventHandler&amp;diff=8823</id>
		<title>AddEventHandler</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AddEventHandler&amp;diff=8823"/>
		<updated>2007-06-28T14:49:34Z</updated>

		<summary type="html">&lt;p&gt;TDHBoss: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Note_box|It is strongly advised that you do not use the same name for your handler function as the event name, as this can lead to confusion if multiple handler functions are used.}}&lt;br /&gt;
This function will add an [[event]] handler. An event handler is a function that will be called when an event is triggered. See [[event system]] for more information on how the event system works.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool addEventHandler ( string eventName, element attachedTo, function functionName )    &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''eventName:''' The name of the [[event]] you want to attach the handler function to.&lt;br /&gt;
*'''attachedTo:''' The [[element]] you wish to attach the handler to. The handler will only be called when the event it is attached to is triggered for this element, or one of its children. Often, this can be the root element (meaning the handler will be called when the event is triggered for ''any'' element).&lt;br /&gt;
*'''functionName:''' The name of the handler function you wish to call. This function should have the correct number of parameters defined for the event you are using, but it isn't required that it takes all of them. Function name IS NOT a string, so you shouldn't use &amp;quot;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the event handler was attached successfully. Returns ''false'' if the event specified could not be found or the ''attachedTo'' [[element]] specified is invalid.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example sends a message to everyone in the server when a player spawns.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Get the root element&lt;br /&gt;
rootElement = getRootElement ()&lt;br /&gt;
-- Define our handler function&lt;br /&gt;
function onSpawnpointUseHandler(thePlayer)&lt;br /&gt;
	-- Get the player's name&lt;br /&gt;
	local playerName = getClientName( thePlayer )&lt;br /&gt;
	-- Output in the chat box that they've spawned&lt;br /&gt;
	outputChatBox ( playerName .. &amp;quot;has spawned!&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
-- Add an event handler to the onSpawnPointUse event (triggered when a player spawns at a spawnpoint)&lt;br /&gt;
-- You must add a handler ONLY after function definition.&lt;br /&gt;
addEventHandler ( &amp;quot;onSpawnpointUse&amp;quot;, rootElement, onSpawnpointUseHandler )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Event_functions}}&lt;/div&gt;</summary>
		<author><name>TDHBoss</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AddEventHandler&amp;diff=8822</id>
		<title>AddEventHandler</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AddEventHandler&amp;diff=8822"/>
		<updated>2007-06-28T14:48:40Z</updated>

		<summary type="html">&lt;p&gt;TDHBoss: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Note_box|It is strongly advised that you do not use the same name for your handler function as the event name, as this can lead to confusion if multiple handler functions are used.}}&lt;br /&gt;
This function will add an [[event]] handler. An event handler is a function that will be called when an event is triggered. See [[event system]] for more information on how the event system works.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool addEventHandler ( string eventName, element attachedTo, function functionName )    &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''eventName:''' The name of the [[event]] you want to attach the handler function to.&lt;br /&gt;
*'''attachedTo:''' The [[element]] you wish to attach the handler to. The handler will only be called when the event it is attached to is triggered for this element, or one of its children. Often, this can be the root element (meaning the handler will be called when the event is triggered for ''any'' element).&lt;br /&gt;
*'''functionName:''' The name of the handler function you wish to call. This function should have the correct number of parameters defined for the event you are using, but it isn't required that it takes all of them. Function name IS NOT a string, so you shouldn't use &amp;quot;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the event handler was attached successfully. Returns ''false'' if the event specified could not be found or the ''attachedTo'' [[element]] specified is invalid.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example sends a message to everyone in the server when a player spawns.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Get the root element&lt;br /&gt;
rootElement = getRootElement ()&lt;br /&gt;
-- Define our handler function&lt;br /&gt;
function onSpawnpointUseHandler(thePlayer)&lt;br /&gt;
	-- Get the player's name&lt;br /&gt;
	local playerName = getClientName( thePlayer )&lt;br /&gt;
	-- Output in the chat box that they've spawned&lt;br /&gt;
	outputChatBox ( playerName .. &amp;quot;has spawned!&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
-- Add an event handler to the onSpawnPointUse event (triggered when a player spawns at a spawnpoint). You must add a handler '''only''' after function definition.&lt;br /&gt;
addEventHandler ( &amp;quot;onSpawnpointUse&amp;quot;, rootElement, onSpawnpointUseHandler )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Event_functions}}&lt;/div&gt;</summary>
		<author><name>TDHBoss</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AddEventHandler&amp;diff=8821</id>
		<title>AddEventHandler</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AddEventHandler&amp;diff=8821"/>
		<updated>2007-06-28T14:47:46Z</updated>

		<summary type="html">&lt;p&gt;TDHBoss: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Note_box|It is strongly advised that you do not use the same name for your handler function as the event name, as this can lead to confusion if multiple handler functions are used.}}&lt;br /&gt;
This function will add an [[event]] handler. An event handler is a function that will be called when an event is triggered. See [[event system]] for more information on how the event system works.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool addEventHandler ( string eventName, element attachedTo, function functionName )    &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''eventName:''' The name of the [[event]] you want to attach the handler function to.&lt;br /&gt;
*'''attachedTo:''' The [[element]] you wish to attach the handler to. The handler will only be called when the event it is attached to is triggered for this element, or one of its children. Often, this can be the root element (meaning the handler will be called when the event is triggered for ''any'' element).&lt;br /&gt;
*'''functionName:''' The name of the handler function you wish to call. This function should have the correct number of parameters defined for the event you are using, but it isn't required that it takes all of them. Function name IS NOT a string, so you shouldn't use &amp;quot;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the event handler was attached successfully. Returns ''false'' if the event specified could not be found or the ''attachedTo'' [[element]] specified is invalid.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example sends a message to everyone in the server when a player spawns.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Get the root element&lt;br /&gt;
rootElement = getRootElement ()&lt;br /&gt;
-- Define our handler function&lt;br /&gt;
function onSpawnpointUseHandler(thePlayer)&lt;br /&gt;
	-- Get the player's name&lt;br /&gt;
	local playerName = getClientName( thePlayer )&lt;br /&gt;
	-- Output in the chat box that they've spawned&lt;br /&gt;
	outputChatBox ( playerName .. &amp;quot;has spawned!&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
-- Add an event handler to the onSpawnPointUse event (triggered when a player spawns at a spawnpoint). You must add a handler '''only''' after function definition.&lt;br /&gt;
addEventHandler ( &amp;quot;onSpawnpointUse&amp;quot;, rootElement, onSpawnpointUseHandler )&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Event_functions}}&lt;/div&gt;</summary>
		<author><name>TDHBoss</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AddEventHandler&amp;diff=8820</id>
		<title>AddEventHandler</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AddEventHandler&amp;diff=8820"/>
		<updated>2007-06-28T14:44:50Z</updated>

		<summary type="html">&lt;p&gt;TDHBoss: /* Syntax */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Note_box|It is strongly advised that you do not use the same name for your handler function as the event name, as this can lead to confusion if multiple handler functions are used.}}&lt;br /&gt;
This function will add an [[event]] handler. An event handler is a function that will be called when an event is triggered. See [[event system]] for more information on how the event system works.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool addEventHandler ( string eventName, element attachedTo, function functionName )    &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''eventName:''' The name of the [[event]] you want to attach the handler function to.&lt;br /&gt;
*'''attachedTo:''' The [[element]] you wish to attach the handler to. The handler will only be called when the event it is attached to is triggered for this element, or one of its children. Often, this can be the root element (meaning the handler will be called when the event is triggered for ''any'' element).&lt;br /&gt;
*'''functionName:''' The name of the handler function you wish to call. This function should have the correct number of parameters defined for the event you are using, but it isn't required that it takes all of them. Function name IS NOT a string, so you shouldn't use &amp;quot;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the event handler was attached successfully. Returns ''false'' if the event specified could not be found or the ''attachedTo'' [[element]] specified is invalid.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example sends a message to everyone in the server when a player spawns.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Get the root element&lt;br /&gt;
rootElement = getRootElement ()&lt;br /&gt;
-- Add an event handler to the onSpawnPointUse event (triggered when a player spawns at a spawnpoint)&lt;br /&gt;
addEventHandler ( &amp;quot;onSpawnpointUse&amp;quot;, rootElement, &amp;quot;onSpawnpointUseHandler&amp;quot; )&lt;br /&gt;
-- Define our handler function&lt;br /&gt;
function onSpawnpointUseHandler( thePlayer )&lt;br /&gt;
	-- Get the player's name&lt;br /&gt;
	local playerName = getClientName( thePlayer )&lt;br /&gt;
	-- Output in the chat box that they've spawned&lt;br /&gt;
	outputChatBox ( playerName .. &amp;quot;has spawned!&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Event_functions}}&lt;/div&gt;</summary>
		<author><name>TDHBoss</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientClick&amp;diff=8686</id>
		<title>OnClientClick</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientClick&amp;diff=8686"/>
		<updated>2007-06-16T17:54:14Z</updated>

		<summary type="html">&lt;p&gt;TDHBoss: /* Syntax */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Incomplete Event]]&lt;br /&gt;
&lt;br /&gt;
__NOTOC__ &lt;br /&gt;
This event is blahblah and is used for blahblah.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;void onClientClick ( string button, string state, int absoluteX, int absoluteY, float worldX, float worldY, float worldZ, element clickedWorld, bool clickedGUI )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example does...&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--This line does...&lt;br /&gt;
blabhalbalhb --abababa&lt;br /&gt;
--This line does this...&lt;br /&gt;
mooo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>TDHBoss</name></author>
	</entry>
</feed>