<?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=Guix</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=Guix"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/Guix"/>
	<updated>2026-05-12T20:44:24Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetAircraftMaxVelocity&amp;diff=34836</id>
		<title>SetAircraftMaxVelocity</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetAircraftMaxVelocity&amp;diff=34836"/>
		<updated>2013-02-08T15:16:08Z</updated>

		<summary type="html">&lt;p&gt;Guix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
{{New feature/item|4.0132|1.3.1|5000|&lt;br /&gt;
This function sets the maximum velocity at which aircrafts could fly. Using this function server-side will overwrite the value that was previously set client-side.&lt;br /&gt;
}}&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 setAircraftMaxVelocity ( float velocity )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''velocity:''' The max velocity, can be 0 or any positive value. Default is '''1.5'''.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns true if the max velocity was set correctly, false otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&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 increase or decrease the max velocity by pressing numpad keys + or -.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;function handleKeyboard( key, state )&lt;br /&gt;
&lt;br /&gt;
    if state then&lt;br /&gt;
&lt;br /&gt;
        if key == &amp;quot;num_add&amp;quot; then&lt;br /&gt;
&lt;br /&gt;
            local fMaxVelocity = getAircraftMaxVelocity() + 0.1&lt;br /&gt;
&lt;br /&gt;
            if setAircraftMaxVelocity( fMaxVelocity ) then&lt;br /&gt;
                outputChatBox( string.format( &amp;quot;Max velocity set to %.1f&amp;quot;, fMaxVelocity ))&lt;br /&gt;
            else&lt;br /&gt;
                outputChatBox( string.format( &amp;quot;Unable to set max velocity to %.1f&amp;quot;, fMaxVelocity ) )&lt;br /&gt;
            end&lt;br /&gt;
&lt;br /&gt;
        elseif key == &amp;quot;num_sub&amp;quot; then&lt;br /&gt;
&lt;br /&gt;
            local fMaxVelocity = getAircraftMaxVelocity() - 0.1&lt;br /&gt;
&lt;br /&gt;
            if setAircraftMaxVelocity( fMaxVelocity ) then&lt;br /&gt;
                outputChatBox( string.format( &amp;quot;Max velocity set to %.1f&amp;quot;, fMaxVelocity ) )&lt;br /&gt;
            else&lt;br /&gt;
                outputChatBox( string.format( &amp;quot;Unable to set max velocity to %.1f&amp;quot;, fMaxVelocity ) )&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEventHandler( &amp;quot;onClientKey&amp;quot;, root, handleKeyboard )&amp;lt;/syntaxhighlight&amp;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 will double the max velocity for everyone when the resource is started.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function handleResourceStart( )&lt;br /&gt;
    setAircraftMaxVelocity( 3 )&lt;br /&gt;
end&lt;br /&gt;
addEventHandler( &amp;quot;onResourceStart&amp;quot;,  resourceRoot, handleResourceStart )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_world_functions}}&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetAircraftMaxVelocity&amp;diff=34827</id>
		<title>SetAircraftMaxVelocity</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetAircraftMaxVelocity&amp;diff=34827"/>
		<updated>2013-02-08T05:00:01Z</updated>

		<summary type="html">&lt;p&gt;Guix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
{{New feature/item|4.0132|1.3.1|5000|&lt;br /&gt;
This function sets the maximum velocity at which aircrafts could fly. Default value is 1.5 (around 276 km/h). Only positive values, including 0, are accepted. Using this function server-side will overwrite the value that was previously set client-side.&lt;br /&gt;
}}&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 setAircraftMaxVelocity ( float fVelocity )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns true if the max velocity was set correctly, false otherwise.&lt;br /&gt;
&lt;br /&gt;
==Examples==&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 increase or decrease the max velocity by pressing numpad keys + or -.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;function handleKeyboard( key, state )&lt;br /&gt;
&lt;br /&gt;
    if state then&lt;br /&gt;
&lt;br /&gt;
        if key == &amp;quot;num_add&amp;quot; then&lt;br /&gt;
&lt;br /&gt;
            local fMaxVelocity = getAircraftMaxVelocity() + 0.1&lt;br /&gt;
&lt;br /&gt;
            if setAircraftMaxVelocity( fMaxVelocity ) then&lt;br /&gt;
                outputChatBox( string.format( &amp;quot;Max velocity set to %.1f&amp;quot;, fMaxVelocity ))&lt;br /&gt;
            else&lt;br /&gt;
                outputChatBox( string.format( &amp;quot;Unable to set max velocity to %.1f&amp;quot;, fMaxVelocity ) )&lt;br /&gt;
            end&lt;br /&gt;
&lt;br /&gt;
        elseif key == &amp;quot;num_sub&amp;quot; then&lt;br /&gt;
&lt;br /&gt;
            local fMaxVelocity = getAircraftMaxVelocity() - 0.1&lt;br /&gt;
&lt;br /&gt;
            if setAircraftMaxVelocity( fMaxVelocity ) then&lt;br /&gt;
                outputChatBox( string.format( &amp;quot;Max velocity set to %.1f&amp;quot;, fMaxVelocity ) )&lt;br /&gt;
            else&lt;br /&gt;
                outputChatBox( string.format( &amp;quot;Unable to set max velocity to %.1f&amp;quot;, fMaxVelocity ) )&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEventHandler( &amp;quot;onClientKey&amp;quot;, root, handleKeyboard )&amp;lt;/syntaxhighlight&amp;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 will double the max velocity for everyone when the resource is started.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function handleResourceStart( res )&lt;br /&gt;
&lt;br /&gt;
    if res == resource then&lt;br /&gt;
        setAircraftMaxVelocity( 3 )&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler( &amp;quot;onResourceStart&amp;quot;,  root, handleResourceStart )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_world_functions}}&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetAircraftMaxVelocity&amp;diff=34826</id>
		<title>GetAircraftMaxVelocity</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetAircraftMaxVelocity&amp;diff=34826"/>
		<updated>2013-02-08T04:59:58Z</updated>

		<summary type="html">&lt;p&gt;Guix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
{{New feature/item|4.0132|1.3.1|5000|&lt;br /&gt;
This function returns the maximum velocity at which aircrafts could fly. Using this function server-side will return the server-side value, not necessarily the same that is set client-side.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float getAircraftMaxVelocity ()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a float being the max velocity that is currently set, depending on which side it is used.&lt;br /&gt;
&lt;br /&gt;
==Examples==&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 increase or decrease the max velocity by pressing numpad keys + or -.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;function handleKeyboard( key, state )&lt;br /&gt;
&lt;br /&gt;
    if state then&lt;br /&gt;
&lt;br /&gt;
        if key == &amp;quot;num_add&amp;quot; then&lt;br /&gt;
&lt;br /&gt;
            local fMaxVelocity = getAircraftMaxVelocity() + 0.1&lt;br /&gt;
&lt;br /&gt;
            if setAircraftMaxVelocity( fMaxVelocity ) then&lt;br /&gt;
                outputChatBox( string.format( &amp;quot;Max velocity set to %.1f&amp;quot;, fMaxVelocity ))&lt;br /&gt;
            else&lt;br /&gt;
                outputChatBox( string.format( &amp;quot;Unable to set max velocity to %.1f&amp;quot;, fMaxVelocity ) )&lt;br /&gt;
            end&lt;br /&gt;
&lt;br /&gt;
        elseif key == &amp;quot;num_sub&amp;quot; then&lt;br /&gt;
&lt;br /&gt;
            local fMaxVelocity = getAircraftMaxVelocity() - 0.1&lt;br /&gt;
&lt;br /&gt;
            if setAircraftMaxVelocity( fMaxVelocity ) then&lt;br /&gt;
                outputChatBox( string.format( &amp;quot;Max velocity set to %.1f&amp;quot;, fMaxVelocity ) )&lt;br /&gt;
            else&lt;br /&gt;
                outputChatBox( string.format( &amp;quot;Unable to set max velocity to %.1f&amp;quot;, fMaxVelocity ) )&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEventHandler( &amp;quot;onClientKey&amp;quot;, root, handleKeyboard )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;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 will tell the max velocity to everyone when the resource is started.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function handleResourceStart( res )&lt;br /&gt;
&lt;br /&gt;
    if res == resource then&lt;br /&gt;
        outputChatBox( string.format( &amp;quot;Server's aircraft max velocity is set to %.1f&amp;quot;, getAircraftMaxVelocity() ) )&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler( &amp;quot;onResourceStart&amp;quot;,  root, handleResourceStart )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_world_functions}}&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetAircraftMaxVelocity&amp;diff=34825</id>
		<title>GetAircraftMaxVelocity</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetAircraftMaxVelocity&amp;diff=34825"/>
		<updated>2013-02-08T04:49:30Z</updated>

		<summary type="html">&lt;p&gt;Guix: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function returns the maximum velocity at which aircrafts could fly. Using this function server-side will return the server-side value, not necessarily the same that is set client-side.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float getAircraftMaxVelocity ()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a float being the max velocity that is currently set, depending on which side it is used.&lt;br /&gt;
&lt;br /&gt;
==Examples==&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 increase or decrease the max velocity by pressing numpad keys + or -.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;function handleKeyboard( key, state )&lt;br /&gt;
&lt;br /&gt;
    if state then&lt;br /&gt;
&lt;br /&gt;
        if key == &amp;quot;num_add&amp;quot; then&lt;br /&gt;
&lt;br /&gt;
            local fMaxVelocity = getAircraftMaxVelocity() + 0.1&lt;br /&gt;
&lt;br /&gt;
            if setAircraftMaxVelocity( fMaxVelocity ) then&lt;br /&gt;
                outputChatBox( string.format( &amp;quot;Max velocity set to %.1f&amp;quot;, fMaxVelocity ))&lt;br /&gt;
            else&lt;br /&gt;
                outputChatBox( string.format( &amp;quot;Unable to set max velocity to %.1f&amp;quot;, fMaxVelocity ) )&lt;br /&gt;
            end&lt;br /&gt;
&lt;br /&gt;
        elseif key == &amp;quot;num_sub&amp;quot; then&lt;br /&gt;
&lt;br /&gt;
            local fMaxVelocity = getAircraftMaxVelocity() - 0.1&lt;br /&gt;
&lt;br /&gt;
            if setAircraftMaxVelocity( fMaxVelocity ) then&lt;br /&gt;
                outputChatBox( string.format( &amp;quot;Max velocity set to %.1f&amp;quot;, fMaxVelocity ) )&lt;br /&gt;
            else&lt;br /&gt;
                outputChatBox( string.format( &amp;quot;Unable to set max velocity to %.1f&amp;quot;, fMaxVelocity ) )&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEventHandler( &amp;quot;onClientKey&amp;quot;, root, handleKeyboard )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;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 will tell the max velocity to everyone when the resource is started.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function handleResourceStart( res )&lt;br /&gt;
&lt;br /&gt;
    if res == resource then&lt;br /&gt;
        outputChatBox( string.format( &amp;quot;Server's aircraft max velocity is set to %.1f&amp;quot;, getAircraftMaxVelocity() ) )&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler( &amp;quot;onResourceStart&amp;quot;,  root, handleResourceStart )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_world_functions}}&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetAircraftMaxVelocity&amp;diff=34824</id>
		<title>GetAircraftMaxVelocity</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetAircraftMaxVelocity&amp;diff=34824"/>
		<updated>2013-02-08T04:48:52Z</updated>

		<summary type="html">&lt;p&gt;Guix: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function returns the maximum velocity at which aircrafts could fly. Using this function server-side will return the server-side value, not necessarily the same that is set client-side.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float getAircraftMaxVelocity ()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a float being the max velocity that is currently set, depending on which side it is used.&lt;br /&gt;
&lt;br /&gt;
==Example==&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 increase or decrease the max velocity by pressing numpad keys + or -.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;function handleKeyboard( key, state )&lt;br /&gt;
&lt;br /&gt;
    if state then&lt;br /&gt;
&lt;br /&gt;
        if key == &amp;quot;num_add&amp;quot; then&lt;br /&gt;
&lt;br /&gt;
            local fMaxVelocity = getAircraftMaxVelocity() + 0.1&lt;br /&gt;
&lt;br /&gt;
            if setAircraftMaxVelocity( fMaxVelocity ) then&lt;br /&gt;
                outputChatBox( string.format( &amp;quot;Max velocity set to %.1f&amp;quot;, fMaxVelocity ))&lt;br /&gt;
            else&lt;br /&gt;
                outputChatBox( string.format( &amp;quot;Unable to set max velocity to %.1f&amp;quot;, fMaxVelocity ) )&lt;br /&gt;
            end&lt;br /&gt;
&lt;br /&gt;
        elseif key == &amp;quot;num_sub&amp;quot; then&lt;br /&gt;
&lt;br /&gt;
            local fMaxVelocity = getAircraftMaxVelocity() - 0.1&lt;br /&gt;
&lt;br /&gt;
            if setAircraftMaxVelocity( fMaxVelocity ) then&lt;br /&gt;
                outputChatBox( string.format( &amp;quot;Max velocity set to %.1f&amp;quot;, fMaxVelocity ) )&lt;br /&gt;
            else&lt;br /&gt;
                outputChatBox( string.format( &amp;quot;Unable to set max velocity to %.1f&amp;quot;, fMaxVelocity ) )&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEventHandler( &amp;quot;onClientKey&amp;quot;, root, handleKeyboard )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;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 will tell the max velocity to everyone when the resource is started.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function handleResourceStart( res )&lt;br /&gt;
&lt;br /&gt;
    if res == resource then&lt;br /&gt;
        outputChatBox( string.format( &amp;quot;Server's aircraft max velocity is set to %.1f&amp;quot;, getAircraftMaxVelocity() ) )&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler( &amp;quot;onResourceStart&amp;quot;,  root, handleResourceStart )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_world_functions}}&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetAircraftMaxVelocity&amp;diff=34823</id>
		<title>SetAircraftMaxVelocity</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetAircraftMaxVelocity&amp;diff=34823"/>
		<updated>2013-02-08T04:48:45Z</updated>

		<summary type="html">&lt;p&gt;Guix: /* Examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function sets the maximum velocity at which aircrafts could fly. Default value is 1.5 (around 276 km/h). Only positive values, including 0, are accepted. Using this function server-side will overwrite the value that was previously set client-side.&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 setAircraftMaxVelocity ( float fVelocity )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns true if the max velocity was set correctly, false otherwise.&lt;br /&gt;
&lt;br /&gt;
==Examples==&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 increase or decrease the max velocity by pressing numpad keys + or -.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;function handleKeyboard( key, state )&lt;br /&gt;
&lt;br /&gt;
    if state then&lt;br /&gt;
&lt;br /&gt;
        if key == &amp;quot;num_add&amp;quot; then&lt;br /&gt;
&lt;br /&gt;
            local fMaxVelocity = getAircraftMaxVelocity() + 0.1&lt;br /&gt;
&lt;br /&gt;
            if setAircraftMaxVelocity( fMaxVelocity ) then&lt;br /&gt;
                outputChatBox( string.format( &amp;quot;Max velocity set to %.1f&amp;quot;, fMaxVelocity ))&lt;br /&gt;
            else&lt;br /&gt;
                outputChatBox( string.format( &amp;quot;Unable to set max velocity to %.1f&amp;quot;, fMaxVelocity ) )&lt;br /&gt;
            end&lt;br /&gt;
&lt;br /&gt;
        elseif key == &amp;quot;num_sub&amp;quot; then&lt;br /&gt;
&lt;br /&gt;
            local fMaxVelocity = getAircraftMaxVelocity() - 0.1&lt;br /&gt;
&lt;br /&gt;
            if setAircraftMaxVelocity( fMaxVelocity ) then&lt;br /&gt;
                outputChatBox( string.format( &amp;quot;Max velocity set to %.1f&amp;quot;, fMaxVelocity ) )&lt;br /&gt;
            else&lt;br /&gt;
                outputChatBox( string.format( &amp;quot;Unable to set max velocity to %.1f&amp;quot;, fMaxVelocity ) )&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEventHandler( &amp;quot;onClientKey&amp;quot;, root, handleKeyboard )&amp;lt;/syntaxhighlight&amp;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 will double the max velocity for everyone when the resource is started.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function handleResourceStart( res )&lt;br /&gt;
&lt;br /&gt;
    if res == resource then&lt;br /&gt;
        setAircraftMaxVelocity( 3 )&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler( &amp;quot;onResourceStart&amp;quot;,  root, handleResourceStart )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_world_functions}}&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetAircraftMaxVelocity&amp;diff=34822</id>
		<title>SetAircraftMaxVelocity</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetAircraftMaxVelocity&amp;diff=34822"/>
		<updated>2013-02-08T04:46:17Z</updated>

		<summary type="html">&lt;p&gt;Guix: /* Returns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function sets the maximum velocity at which aircrafts could fly. Default value is 1.5 (around 276 km/h). Only positive values, including 0, are accepted. Using this function server-side will overwrite the value that was previously set client-side.&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 setAircraftMaxVelocity ( float fVelocity )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns true if the max velocity was set correctly, false otherwise.&lt;br /&gt;
&lt;br /&gt;
==Examples==&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 increase or decrease the max velocity by pressing numpad keys + or -.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;function handleKeyboard( key, state )&lt;br /&gt;
&lt;br /&gt;
    if state then&lt;br /&gt;
&lt;br /&gt;
        if key == &amp;quot;num_add&amp;quot; then&lt;br /&gt;
&lt;br /&gt;
            local fMaxVelocity = getAircraftMaxVelocity() + 0.1&lt;br /&gt;
&lt;br /&gt;
            if setAircraftMaxVelocity( fMaxVelocity ) then&lt;br /&gt;
                outputChatBox( string.format( &amp;quot;Max velocity set to %.1f&amp;quot;, fMaxVelocity ))&lt;br /&gt;
            end&lt;br /&gt;
&lt;br /&gt;
        elseif key == &amp;quot;num_sub&amp;quot; then&lt;br /&gt;
&lt;br /&gt;
            local fMaxVelocity = getAircraftMaxVelocity() - 0.1&lt;br /&gt;
&lt;br /&gt;
            if setAircraftMaxVelocity( fMaxVelocity ) then&lt;br /&gt;
                outputChatBox( string.format( &amp;quot;Max velocity set to %.1f&amp;quot;, fMaxVelocity ) )&lt;br /&gt;
            else&lt;br /&gt;
                outputChatBox( string.format( &amp;quot;Unable to set max velocity to %.1f&amp;quot;, fMaxVelocity ) )&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEventHandler( &amp;quot;onClientKey&amp;quot;, root, handleKeyboard )&amp;lt;/syntaxhighlight&amp;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 will double the max velocity for everyone when the resource is started.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function handleResourceStart( res )&lt;br /&gt;
&lt;br /&gt;
    if res == resource then&lt;br /&gt;
        setAircraftMaxVelocity( 3 )&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler( &amp;quot;onResourceStart&amp;quot;,  root, handleResourceStart )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_world_functions}}&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetAircraftMaxVelocity&amp;diff=34821</id>
		<title>SetAircraftMaxVelocity</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetAircraftMaxVelocity&amp;diff=34821"/>
		<updated>2013-02-08T04:45:53Z</updated>

		<summary type="html">&lt;p&gt;Guix: Created page with &amp;quot;__NOTOC__ {{Server client function}} This function sets the maximum velocity at which aircrafts could fly. Default value is 1.5 (around 276 km/h). Only positive values, including...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function sets the maximum velocity at which aircrafts could fly. Default value is 1.5 (around 276 km/h). Only positive values, including 0, are accepted. Using this function server-side will overwrite the value that was previously set client-side.&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 setAircraftMaxVelocity ( float fVelocity )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns true if the velocity was set correctly, false otherwise.&lt;br /&gt;
&lt;br /&gt;
==Examples==&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 increase or decrease the max velocity by pressing numpad keys + or -.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;function handleKeyboard( key, state )&lt;br /&gt;
&lt;br /&gt;
    if state then&lt;br /&gt;
&lt;br /&gt;
        if key == &amp;quot;num_add&amp;quot; then&lt;br /&gt;
&lt;br /&gt;
            local fMaxVelocity = getAircraftMaxVelocity() + 0.1&lt;br /&gt;
&lt;br /&gt;
            if setAircraftMaxVelocity( fMaxVelocity ) then&lt;br /&gt;
                outputChatBox( string.format( &amp;quot;Max velocity set to %.1f&amp;quot;, fMaxVelocity ))&lt;br /&gt;
            end&lt;br /&gt;
&lt;br /&gt;
        elseif key == &amp;quot;num_sub&amp;quot; then&lt;br /&gt;
&lt;br /&gt;
            local fMaxVelocity = getAircraftMaxVelocity() - 0.1&lt;br /&gt;
&lt;br /&gt;
            if setAircraftMaxVelocity( fMaxVelocity ) then&lt;br /&gt;
                outputChatBox( string.format( &amp;quot;Max velocity set to %.1f&amp;quot;, fMaxVelocity ) )&lt;br /&gt;
            else&lt;br /&gt;
                outputChatBox( string.format( &amp;quot;Unable to set max velocity to %.1f&amp;quot;, fMaxVelocity ) )&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEventHandler( &amp;quot;onClientKey&amp;quot;, root, handleKeyboard )&amp;lt;/syntaxhighlight&amp;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 will double the max velocity for everyone when the resource is started.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function handleResourceStart( res )&lt;br /&gt;
&lt;br /&gt;
    if res == resource then&lt;br /&gt;
        setAircraftMaxVelocity( 3 )&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler( &amp;quot;onResourceStart&amp;quot;,  root, handleResourceStart )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_world_functions}}&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetAircraftMaxVelocity&amp;diff=34820</id>
		<title>GetAircraftMaxVelocity</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetAircraftMaxVelocity&amp;diff=34820"/>
		<updated>2013-02-08T04:45:17Z</updated>

		<summary type="html">&lt;p&gt;Guix: Created page with &amp;quot;__NOTOC__ {{Server client function}} This function returns the maximum velocity at which aircrafts could fly. Using this function server-side will return the server-side value, n...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function returns the maximum velocity at which aircrafts could fly. Using this function server-side will return the server-side value, not necessarily the same that is set client-side.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float getAircraftMaxVelocity ()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a float being the max velocity that is currently set, depending on which side it is used.&lt;br /&gt;
&lt;br /&gt;
==Example==&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 increase or decrease the max velocity by pressing numpad keys + or -.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;function handleKeyboard( key, state )&lt;br /&gt;
&lt;br /&gt;
    if state then&lt;br /&gt;
&lt;br /&gt;
        if key == &amp;quot;num_add&amp;quot; then&lt;br /&gt;
&lt;br /&gt;
            local fMaxVelocity = getAircraftMaxVelocity() + 0.1&lt;br /&gt;
&lt;br /&gt;
            if setAircraftMaxVelocity( fMaxVelocity ) then&lt;br /&gt;
                outputChatBox( string.format( &amp;quot;Max velocity set to %.1f&amp;quot;, fMaxVelocity ))&lt;br /&gt;
            end&lt;br /&gt;
&lt;br /&gt;
        elseif key == &amp;quot;num_sub&amp;quot; then&lt;br /&gt;
&lt;br /&gt;
            local fMaxVelocity = getAircraftMaxVelocity() - 0.1&lt;br /&gt;
&lt;br /&gt;
            if setAircraftMaxVelocity( fMaxVelocity ) then&lt;br /&gt;
                outputChatBox( string.format( &amp;quot;Max velocity set to %.1f&amp;quot;, fMaxVelocity ) )&lt;br /&gt;
            else&lt;br /&gt;
                outputChatBox( string.format( &amp;quot;Unable to set max velocity to %.1f&amp;quot;, fMaxVelocity ) )&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEventHandler( &amp;quot;onClientKey&amp;quot;, root, handleKeyboard )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;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 will tell the max velocity to everyone when the resource is started.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function handleResourceStart( res )&lt;br /&gt;
&lt;br /&gt;
    if res == resource then&lt;br /&gt;
        outputChatBox( string.format( &amp;quot;Server's aircraft max velocity is set to %.1f&amp;quot;, getAircraftMaxVelocity() ) )&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler( &amp;quot;onResourceStart&amp;quot;,  root, handleResourceStart )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_world_functions}}&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=User_talk:X86dev&amp;diff=34678</id>
		<title>User talk:X86dev</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=User_talk:X86dev&amp;diff=34678"/>
		<updated>2013-01-29T18:29:29Z</updated>

		<summary type="html">&lt;p&gt;Guix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Cmon x86, not all scripters knew that about setGameSpeed. Why to delete it? Was it specified somewhere else or what? --[[User:The Kid|Benxamix2]] 20:10, 16 November 2011 (CET)&lt;br /&gt;
&lt;br /&gt;
: It's rather obvious and applies to every function that is implemented both server- and client-side. --[[User:Wielebny|Wielebny]] 03:51, 17 November 2011 (CET)&lt;br /&gt;
&lt;br /&gt;
Why did you undo my revision 29816 of createPed? The arguments name is bSynced in the source code while the &amp;quot;b&amp;quot; indicates the type of the argument, a boolean. The &amp;quot;b&amp;quot; is not necessary since the type of the argument is already determined in the syntax. The real LUA name should be &amp;quot;synced&amp;quot;. --[[User:-ffs-Sniper|-ffs-Sniper]] 21:18, 31 March 2012 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Can I know why you deleted all my useful functions? I bet Wielebny is your friend, he hate me for some unknow reason (I don't even know who is this guy) and he asked you to delete them. It's so obvious. Weird mentality.--[[User:Guix|Guix]] 14:37, 28 January 2013 (UTC)&lt;br /&gt;
: No he's not. You've added useless functions, nobody will use them. Look at other functions, that's what you can name a useful function. The page structure was bad also! --[[User:X86dev|X86dev]] 08:19, 29 January 2013 (UTC)&lt;br /&gt;
:: What do you mean, nobody will use them? If I made them it's because I needed them (ok to be honest I didn't need get/setColorRed/Green/Blue, only Alpha), so why not someone else? And are you saying functions such as wavelengthToRGBA or generateString are more useful than colorToRGBA or mapValue..? Looks like I just wasted my time writing on this wiki, but I won't do this mistake again :/ --[[User:Guix|Guix]] 18:29, 29 January 2013 (UTC)&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Tocolor&amp;diff=34672</id>
		<title>Tocolor</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Tocolor&amp;diff=34672"/>
		<updated>2013-01-28T15:04:55Z</updated>

		<summary type="html">&lt;p&gt;Guix: Removed links to useless functions.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}} &lt;br /&gt;
This function retrieves the hex number of a specified color, useful for the dx functions.&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 tocolor ( int red, int green, int blue [, int alpha = 255] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
* '''red:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space red] in the color (0-255).&lt;br /&gt;
* '''green:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space green] in the color (0-255).&lt;br /&gt;
* '''blue:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space blue] in the color (0-255).&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
* '''alpha:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space alpha] in the color (0-255).&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a single value representing the color.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example displays the text &amp;quot;Tuna&amp;quot; in small at the top left side of your screen. The color of this text can be changed using the command /tunaColor.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local tunaColor = tocolor(255, 0, 0, 255) -- Default color&lt;br /&gt;
&lt;br /&gt;
-- This function draws the text&lt;br /&gt;
local function drawTuna()&lt;br /&gt;
	dxDrawText(&amp;quot;Tuna&amp;quot;, 5, 5, 100, 100, tunaColor)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientRender&amp;quot;, root, drawTuna)&lt;br /&gt;
&lt;br /&gt;
--This function handles the /tunaColor command, allowing players to set the color of tuna&lt;br /&gt;
local function tunaColorCommand(command, red, green, blue, alpha)&lt;br /&gt;
	red, green, blue, alpha = tonumber(red), tonumber(green), tonumber(blue), tonumber(alpha) -- Convert all the args to numbers. NOTE: tonumber will return false if the arg is not provided/is not valid.&lt;br /&gt;
	&lt;br /&gt;
	-- Remind the user of the proper syntax if they failed to provide all the args&lt;br /&gt;
	if not red or not green or not blue then&lt;br /&gt;
		outputChatBox(&amp;quot;* USAGE: /tunaColor [red] [green] [blue] [alpha]&amp;quot;, 255, 0, 0)&lt;br /&gt;
		return&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Make the alpha arg optional&lt;br /&gt;
	if not alpha then&lt;br /&gt;
		alpha = 255&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Update the color&lt;br /&gt;
	tunaColor = tocolor(red, green, blue, alpha)&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;tunaColor&amp;quot;, tunaColorCommand)&lt;br /&gt;
-- Example /setcoloroftuna 255 0 0 255 - for red.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_utility_functions}}&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&amp;diff=34671</id>
		<title>Template:Useful Functions</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&amp;diff=34671"/>
		<updated>2013-01-28T15:03:07Z</updated>

		<summary type="html">&lt;p&gt;Guix: Apparently my work isn't welcome here.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[callClientFunction]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to call any clientside function from the server's side.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[callServerFunction]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to call any server-side function from the client's side.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[centerWindow]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function center the window in any resolution.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[Check]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if it's arguments are of the right types and calls the error-function if one isn't.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[coroutine.resume]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Fix for hidden coroutine error messages&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawColorText]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a dx text with #RRGGBB color codes support.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawGifImage]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function simulates the effect of a GIF image by using image sprites.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawImage3D]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a 3D image.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawRectangle3D]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a 3D rectangle.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxGetFontSizeFromHeight]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function calculate a font size from given height for dxDraw.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxGetRealFontHeight]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Accurately measures the pixel height of a font.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[findRotation]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Takes two points and returns the direction from point A to point B.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[FormatDate]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Formats a date on the basis of a format string and returns it.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[GenerateString]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» With this function you can generate a random string with any characters.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAge]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function calculates the age of a birthday.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAlivePlayers (Client)|getAlivePlayers]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns all the alive players by a client side, so you can store them into a Gridlist or something like that, faster.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAlivePlayersInTeam]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of the alive players in a team.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getCursorMoveOn]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks in which way the cursor is currently moving.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getDistanceBetweenPointAndSegment2D]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Takes point coordinates and line (a segment) starting and ending coordinates. It returns the shortest distance between the point and the line.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getElementSpeed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to get element speed in kph or mph units.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getJetpackWeaponsEnabled]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of enabled weapons usable on a jetpack.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getOffsetFromXYZ]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to take an entity and a position and calculate the relative offset between them accounting for rotations.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getOnlineAdmins]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function will give the online admins.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getOnlineStaff]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Returns all online staff, names separated by two spaces.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayerFromNamePart]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to get player From his Name part.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayersInPhotograph]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function gets all the players in a photograph.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPointFromDistanceRotation]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Finds a point based on a starting point, direction and distance.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getResourceSettings]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of the resource settings.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getTimestamp]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» With this function you can get the UNIX timestamp.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getXMLNodes]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Returns all children of a node&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[guiComboBoxAdjustHeight]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Adjusts the combobox to have a correct height.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[guiEditSetActive]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Puts the caret of an editbox to the gived position.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[IfElse]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Returns one of two values based on a boolean expression.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementInPhotograph]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if an element was in the player's camera picture.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementInRange]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to check is the element's range to the main point is smaller than (or as big as) the maximum range.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[IsElementMoving]]&amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if an element is moving.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPedAiming]]&amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if a ped is aiming.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPlayerInTeam]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function check if the player in the team.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isLeapYear]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Checks if the given year is a leap year.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isVehicleOnRoof]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks whether vehicle is on roof.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[iterElements]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Returns an iterator for your for loops saving time typing ipairs( getElementsByType( type ) ), instead you type: iterElements( type ).&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[math.round]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Rounds a number whereas the number of decimals to keep and the method may be set.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[multi_check]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks one element to many, handy and clean.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[onVehicleWeaponFire]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This code implements an event that is triggered when a player in a vehicle fires a vehicles weapon.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setElementSpeed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to set moving element speed in kph or mph units.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setTableProtected]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Protects a table and makes it read-only.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setVehicleGravityPoint]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This clientside function sets a vehicle's gravity in the direction of a 3 dimensional coordinate with the strength specified.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[smoothMoveCamera]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This clientside function allows you to create a cinematic camera flight.&lt;br /&gt;
*[[string.count]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function counts a text from a text.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[string.explode]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function splits a string at a given separator pattern and returns a table with the pieces.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[switch]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allow the value of a variable or expression to control the flow of program execution via a multiway branch.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.copy]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function copies a whole table and all the tables in that table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.condition]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function check if both tables is equal. &amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.empty]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function check is empty table or not.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.map]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function goes through a table and replaces every field with the return of the passed function, where the field's value is passed as first argument and optionally more arguments.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.random]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function retrieves a random variable from a table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.size]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Finds the absolute size of a table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[var dump]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function outputs information about one or more variables using outputConsole()&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[RGBToHex]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a string representing the color in hexadecimal.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[toHex]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts a decimal number to a hexadecimal number, as a fix to be used clientside.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[wavelengthToRGBA]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts a phisical wavelength of light to a RGBA color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[convertNumber]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts large numbers and adds commas to it. (Example: 100000 -&amp;gt; 100,000)&amp;lt;/span&amp;gt;&lt;br /&gt;
[[Category:Useful Functions]]&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Talk:IsVehicleOnRoof&amp;diff=34670</id>
		<title>Talk:IsVehicleOnRoof</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Talk:IsVehicleOnRoof&amp;diff=34670"/>
		<updated>2013-01-28T14:56:37Z</updated>

		<summary type="html">&lt;p&gt;Guix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Is this what you call an useful function? Not only it's bugged, but everyone can do that. Please refrain from adding such things.&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=User_talk:X86dev&amp;diff=34668</id>
		<title>User talk:X86dev</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=User_talk:X86dev&amp;diff=34668"/>
		<updated>2013-01-28T14:37:57Z</updated>

		<summary type="html">&lt;p&gt;Guix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Cmon x86, not all scripters knew that about setGameSpeed. Why to delete it? Was it specified somewhere else or what? --[[User:The Kid|Benxamix2]] 20:10, 16 November 2011 (CET)&lt;br /&gt;
&lt;br /&gt;
: It's rather obvious and applies to every function that is implemented both server- and client-side. --[[User:Wielebny|Wielebny]] 03:51, 17 November 2011 (CET)&lt;br /&gt;
&lt;br /&gt;
Why did you undo my revision 29816 of createPed? The arguments name is bSynced in the source code while the &amp;quot;b&amp;quot; indicates the type of the argument, a boolean. The &amp;quot;b&amp;quot; is not necessary since the type of the argument is already determined in the syntax. The real LUA name should be &amp;quot;synced&amp;quot;. --[[User:-ffs-Sniper|-ffs-Sniper]] 21:18, 31 March 2012 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Can I know why you deleted all my useful functions? I bet Wielebny is your friend, he hate me for some unknow reason (I don't even know who is this guy) and he asked you to delete them. It's so obvious. Weird mentality.--[[User:Guix|Guix]] 14:37, 28 January 2013 (UTC)&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=User_talk:Guix&amp;diff=34655</id>
		<title>User talk:Guix</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=User_talk:Guix&amp;diff=34655"/>
		<updated>2013-01-27T21:27:14Z</updated>

		<summary type="html">&lt;p&gt;Guix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I think that your recent contributions are pretty useless. Why do you post functions that do nothing else than return some other functions? Functions like [[getColorBlue]], [[getColorRed]], ... provide no usefulness and should not be used by anyone. They are really bad examples. Please refrain from adding such things. --[[User:Wielebny|Wielebny]] 13:47, 26 January 2013 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Just because you have no use for these functions doesn't mean it is useless. Actually I needed them so I made them, it was useful for me so it will be for someone else.&lt;br /&gt;
--[[User:Guix|Guix]] 20:41, 26 January 2013 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function a(x) return b(x) end&amp;lt;/pre&amp;gt; do you still stand that this is a useful function? It's a programming antipattern and should never be used! --[[User:Wielebny|Wielebny]] 15:56, 27 January 2013 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
None of my functions do that.--[[User:Guix|Guix]] 21:27, 27 January 2013 (UTC)&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=User_talk:Guix&amp;diff=34654</id>
		<title>User talk:Guix</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=User_talk:Guix&amp;diff=34654"/>
		<updated>2013-01-27T21:26:29Z</updated>

		<summary type="html">&lt;p&gt;Guix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I think that your recent contributions are pretty useless. Why do you post functions that do nothing else than return some other functions? Functions like [[getColorBlue]], [[getColorRed]], ... provide no usefulness and should not be used by anyone. They are really bad examples. Please refrain from adding such things. --[[User:Wielebny|Wielebny]] 13:47, 26 January 2013 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Just because you have no use for these functions doesn't mean it is useless. Actually I needed them so I made them, it was useful for me so it will be for someone else.&lt;br /&gt;
--[[User:Guix|Guix]] 20:41, 26 January 2013 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function a(x) return b(x) end&amp;lt;/pre&amp;gt; do you still stand that this is a useful function? It's a programming antipattern and should never be used! --[[User:Wielebny|Wielebny]] 15:56, 27 January 2013 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
None of my functions do that.--[[User:Guix|Guix]] 21:26, 27 January 2013 (UTC)&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=User_talk:Guix&amp;diff=34653</id>
		<title>User talk:Guix</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=User_talk:Guix&amp;diff=34653"/>
		<updated>2013-01-27T21:25:37Z</updated>

		<summary type="html">&lt;p&gt;Guix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I think that your recent contributions are pretty useless. Why do you post functions that do nothing else than return some other functions? Functions like [[getColorBlue]], [[getColorRed]], ... provide no usefulness and should not be used by anyone. They are really bad examples. Please refrain from adding such things. --[[User:Wielebny|Wielebny]] 13:47, 26 January 2013 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Just because you have no use for these functions doesn't mean it is useless. Actually I needed them so I made them, it was useful for me so it will be for someone else.&lt;br /&gt;
--[[User:Guix|Guix]] 20:41, 26 January 2013 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;function a(x) return b(x) end&amp;lt;/pre&amp;gt; do you still stand that this is a useful function? It's a programming antipattern and should never be used! --[[User:Wielebny|Wielebny]] 15:56, 27 January 2013 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
None of my functions do that.--[[User:Guix|Guix]] 21:25, 27 January 2013 (UTC)&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Talk:GetResultingColor&amp;diff=34649</id>
		<title>Talk:GetResultingColor</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Talk:GetResultingColor&amp;diff=34649"/>
		<updated>2013-01-26T21:04:29Z</updated>

		<summary type="html">&lt;p&gt;Guix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This function is wrong. Mixing (0,0,0,255) with (255,255,255,128) would obviously result in (64,64,64,255), not the values that your function returns. --[[User:Wielebny|Wielebny]] 14:01, 26 January 2013 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I don't know where you got your so obvious result... The return values are correct.&lt;br /&gt;
&lt;br /&gt;
You can easily test it:&lt;br /&gt;
&lt;br /&gt;
dxDrawRectangle( 200, 200, 200, 200, tocolor(0, 0, 0, 255))&lt;br /&gt;
&lt;br /&gt;
dxDrawRectangle( 250, 250, 100, 100, tocolor(255, 255, 255, 128))&lt;br /&gt;
&lt;br /&gt;
Do a screenshot, open it with your favorite image editor (I use Paint.NET, it's free and awesome), use the Color Picker tool and see the result.&lt;br /&gt;
--[[User:Guix|Guix]] 20:47, 26 January 2013 (UTC)&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Talk:GetResultingColor&amp;diff=34648</id>
		<title>Talk:GetResultingColor</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Talk:GetResultingColor&amp;diff=34648"/>
		<updated>2013-01-26T21:03:41Z</updated>

		<summary type="html">&lt;p&gt;Guix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This function is wrong. Mixing (0,0,0,255) with (255,255,255,128) would obviously result in (64,64,64,255), not the values that your function returns. --[[User:Wielebny|Wielebny]] 14:01, 26 January 2013 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I don't know where you got your so obvious result... The return values are correct.&lt;br /&gt;
&lt;br /&gt;
You can easily test it:&lt;br /&gt;
&lt;br /&gt;
dxDrawRectangle( 200, 200, 200, 200, tocolor(0, 0, 0, 255))&lt;br /&gt;
dxDrawRectangle( 250, 250, 100, 100, tocolor(255, 255, 255, 128))&lt;br /&gt;
&lt;br /&gt;
Do a screenshot, open it with your favorite image editor (I use Paint.NET, it's free and awesome), use the Color Picker tool and see the result.&lt;br /&gt;
--[[User:Guix|Guix]] 20:47, 26 January 2013 (UTC)&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Talk:GetResultingColor&amp;diff=34647</id>
		<title>Talk:GetResultingColor</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Talk:GetResultingColor&amp;diff=34647"/>
		<updated>2013-01-26T20:47:26Z</updated>

		<summary type="html">&lt;p&gt;Guix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This function is wrong. Mixing (0,0,0,255) with (255,255,255,128) would obviously result in (64,64,64,255), not the values that your function returns. --[[User:Wielebny|Wielebny]] 14:01, 26 January 2013 (UTC)&lt;br /&gt;
&lt;br /&gt;
I don't know where you got your so obvious result... The return values are correct.--[[User:Guix|Guix]] 20:47, 26 January 2013 (UTC)&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=User_talk:Guix&amp;diff=34646</id>
		<title>User talk:Guix</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=User_talk:Guix&amp;diff=34646"/>
		<updated>2013-01-26T20:41:03Z</updated>

		<summary type="html">&lt;p&gt;Guix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I think that your recent contributions are pretty useless. Why do you post functions that do nothing else than return some other functions? Functions like [[getColorBlue]], [[getColorRed]], ... provide no usefulness and should not be used by anyone. They are really bad examples. Please refrain from adding such things. --[[User:Wielebny|Wielebny]] 13:47, 26 January 2013 (UTC)&lt;br /&gt;
&lt;br /&gt;
Just because you have no use for these functions doesn't mean it is useless. Actually I needed them so I made them, it was useful for me so it will be for someone else.&lt;br /&gt;
--[[User:Guix|Guix]] 20:41, 26 January 2013 (UTC)&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=User_talk:Guix&amp;diff=34645</id>
		<title>User talk:Guix</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=User_talk:Guix&amp;diff=34645"/>
		<updated>2013-01-26T20:40:33Z</updated>

		<summary type="html">&lt;p&gt;Guix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I think that your recent contributions are pretty useless. Why do you post functions that do nothing else than return some other functions? Functions like [[getColorBlue]], [[getColorRed]], ... provide no usefulness and should not be used by anyone. They are really bad examples. Please refrain from adding such things. --[[User:Wielebny|Wielebny]] 13:47, 26 January 2013 (UTC)&lt;br /&gt;
&lt;br /&gt;
Just because you have no use for these functions doesn't mean it is useless. Actually I needed them so I made them, it was useful for me so it will be for someone else.&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=User_talk:Darlineluckow&amp;diff=34622</id>
		<title>User talk:Darlineluckow</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=User_talk:Darlineluckow&amp;diff=34622"/>
		<updated>2013-01-25T04:01:46Z</updated>

		<summary type="html">&lt;p&gt;Guix: Replaced content with &amp;quot;I'm a spammer, ban me please!&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I'm a spammer, ban me please!&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Tocolor&amp;diff=34596</id>
		<title>Tocolor</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Tocolor&amp;diff=34596"/>
		<updated>2013-01-23T06:58:28Z</updated>

		<summary type="html">&lt;p&gt;Guix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}} &lt;br /&gt;
This function retrieves the hex number of a specified color, useful for the dx functions.&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 tocolor ( int red, int green, int blue [, int alpha = 255] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
* '''red:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space red] in the color (0-255).&lt;br /&gt;
* '''green:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space green] in the color (0-255).&lt;br /&gt;
* '''blue:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space blue] in the color (0-255).&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
* '''alpha:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space alpha] in the color (0-255).&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a single value representing the color.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example displays the text &amp;quot;Tuna&amp;quot; in small at the top left side of your screen. The color of this text can be changed using the command /tunaColor.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local tunaColor = tocolor(255, 0, 0, 255) -- Default color&lt;br /&gt;
&lt;br /&gt;
-- This function draws the text&lt;br /&gt;
local function drawTuna()&lt;br /&gt;
	dxDrawText(&amp;quot;Tuna&amp;quot;, 5, 5, 100, 100, tunaColor)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientRender&amp;quot;, root, drawTuna)&lt;br /&gt;
&lt;br /&gt;
--This function handles the /tunaColor command, allowing players to set the color of tuna&lt;br /&gt;
local function tunaColorCommand(command, red, green, blue, alpha)&lt;br /&gt;
	red, green, blue, alpha = tonumber(red), tonumber(green), tonumber(blue), tonumber(alpha) -- Convert all the args to numbers. NOTE: tonumber will return false if the arg is not provided/is not valid.&lt;br /&gt;
	&lt;br /&gt;
	-- Remind the user of the proper syntax if they failed to provide all the args&lt;br /&gt;
	if not red or not green or not blue then&lt;br /&gt;
		outputChatBox(&amp;quot;* USAGE: /tunaColor [red] [green] [blue] [alpha]&amp;quot;, 255, 0, 0)&lt;br /&gt;
		return&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Make the alpha arg optional&lt;br /&gt;
	if not alpha then&lt;br /&gt;
		alpha = 255&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Update the color&lt;br /&gt;
	tunaColor = tocolor(red, green, blue, alpha)&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;tunaColor&amp;quot;, tunaColorCommand)&lt;br /&gt;
-- Example /setcoloroftuna 255 0 0 255 - for red.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Related functions==&lt;br /&gt;
&lt;br /&gt;
[[colorToRGBA]]&lt;br /&gt;
&lt;br /&gt;
[[RGBAToColor]]&lt;br /&gt;
&lt;br /&gt;
[[setColorRed]]&lt;br /&gt;
&lt;br /&gt;
[[setColorGreen]]&lt;br /&gt;
&lt;br /&gt;
[[setColorBlue]]&lt;br /&gt;
&lt;br /&gt;
[[setColorAlpha]]&lt;br /&gt;
&lt;br /&gt;
[[getColorRed]]&lt;br /&gt;
&lt;br /&gt;
[[getColorGreen]]&lt;br /&gt;
&lt;br /&gt;
[[getColorBlue]]&lt;br /&gt;
&lt;br /&gt;
[[getColorAlpha]]&lt;br /&gt;
&lt;br /&gt;
[[getResultingColor]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_utility_functions}}&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&amp;diff=34595</id>
		<title>Template:Useful Functions</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&amp;diff=34595"/>
		<updated>2013-01-23T06:58:22Z</updated>

		<summary type="html">&lt;p&gt;Guix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[callClientFunction]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to call any clientside function from the server's side.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[callServerFunction]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to call any server-side function from the client's side.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[centerWindow]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function center the window in any resolution.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[Check]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if it's arguments are of the right types and calls the error-function if one isn't.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[coroutine.resume]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Fix for hidden coroutine error messages&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[colorToRGBA]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function is the opposite of [http://wiki.multitheftauto.com/index.php?title=Tocolor tocolor].&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawColorText]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a dx text with #RRGGBB color codes support.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawEmptyRectangle]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Draws a rectangle that is empty. The thickness can be set.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawGifImage]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function simulates the effect of a GIF image by using image sprites.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawImage3D]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a 3D image.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawRectangle3D]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a 3D rectangle.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxGetFontSizeFromHeight]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function calculate a font size from given height for dxDraw.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxGetRealFontHeight]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Accurately measures the pixel height of a font.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[findRotation]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Takes two points and returns the direction from point A to point B.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[FormatDate]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Formats a date on the basis of a format string and returns it.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[GenerateString]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» With this function you can generate a random string with any characters.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAge]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function calculates the age of a birthday.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAlivePlayers (Client)|getAlivePlayers]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns all the alive players by a client side, so you can store them into a Gridlist or something like that, faster.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAlivePlayersInTeam]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of the alive players in a team.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getColorRed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to retrieve the Red component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getColorGreen]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to retrieve the Green component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getColorBlue]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to retrieve the Blue component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getColorAlpha]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to retrieve the Alpha component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getCursorMoveOn]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks in which way the cursor is currently moving.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getDistanceBetweenPointAndSegment2D]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Takes point coordinates and line (a segment) starting and ending coordinates. It returns the shortest distance between the point and the line.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getElementSpeed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to get element speed in kph or mph units.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getJetpackWeaponsEnabled]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of enabled weapons usable on a jetpack.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getOffsetFromXYZ]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to take an entity and a position and calculate the relative offset between them accounting for rotations.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getOnlineAdmins]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function will give the online admins.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getOnlineStaff]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Returns all online staff, names separated by two spaces.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayerFromNamePart]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to get player From his Name part.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayersInPhotograph]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function gets all the players in a photograph.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPointFromDistanceRotation]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Finds a point based on a starting point, direction and distance.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getResourceSettings]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of the resource settings.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getResultingColor]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns the resulting color of two overlapped colors.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getTimestamp]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» With this function you can get the UNIX timestamp.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getXMLNodes]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Returns all children of a node&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[guiComboBoxAdjustHeight]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Adjusts the combobox to have a correct height.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[guiEditSetActive]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Puts the caret of an editbox to the gived position.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[IfElse]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Returns one of two values based on a boolean expression.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementInPhotograph]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if an element was in the player's camera picture.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementInRange]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to check is the element's range to the main point is smaller than (or as big as) the maximum range.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[IsElementMoving]]&amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if an element is moving.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPedAiming]]&amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if a ped is aiming.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPlayerInTeam]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function check if the player in the team.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isLeapYear]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Checks if the given year is a leap year.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isVehicleOnRoof]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks whether vehicle is on roof.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[iterElements]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Returns an iterator for your for loops saving time typing ipairs( getElementsByType( type ) ), instead you type: iterElements( type ).&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[mapValue]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function maps a value from one range to another.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[math.round]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Rounds a number whereas the number of decimals to keep and the method may be set.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[multi_check]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks one element to many, handy and clean.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[onVehicleWeaponFire]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This code implements an event that is triggered when a player in a vehicle fires a vehicles weapon.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setColorRed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to change the Red component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setColorGreen]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to change the Green component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setColorBlue]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to change the Blue component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setColorAlpha]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to change the Alpha component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setElementSpeed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to set moving element speed in kph or mph units.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setTableProtected]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Protects a table and makes it read-only.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setVehicleGravityPoint]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This clientside function sets a vehicle's gravity in the direction of a 3 dimensional coordinate with the strength specified.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[smoothMoveCamera]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This clientside function allows you to create a cinematic camera flight.&lt;br /&gt;
*[[string.count]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function counts a text from a text.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[string.explode]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function splits a string at a given separator pattern and returns a table with the pieces.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[switch]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allow the value of a variable or expression to control the flow of program execution via a multiway branch.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.copy]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function copies a whole table and all the tables in that table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.condition]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function check if both tables is equal. &amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.empty]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function check is empty table or not.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.map]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function goes through a table and replaces every field with the return of the passed function, where the field's value is passed as first argument and optionally more arguments.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.random]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function retrieves a random variable from a table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.size]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Finds the absolute size of a table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[var dump]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function outputs information about one or more variables using outputConsole()&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[RGBAToColor]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function is equivalent to [[tocolor]], but can be used on both client and server.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[RGBToHex]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a string representing the color in hexadecimal.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[toHex]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts a decimal number to a hexadecimal number, as a fix to be used clientside.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[wavelengthToRGBA]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts a phisical wavelength of light to a RGBA color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[convertNumber]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts large numbers and adds commas to it. (Example: 100000 -&amp;gt; 100,000)&amp;lt;/span&amp;gt;&lt;br /&gt;
[[Category:Useful Functions]]&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&amp;diff=34591</id>
		<title>Template:Useful Functions</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&amp;diff=34591"/>
		<updated>2013-01-23T03:30:47Z</updated>

		<summary type="html">&lt;p&gt;Guix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[callClientFunction]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to call any clientside function from the server's side.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[callServerFunction]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to call any server-side function from the client's side.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[centerWindow]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function center the window in any resolution.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[Check]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if it's arguments are of the right types and calls the error-function if one isn't.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[coroutine.resume]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Fix for hidden coroutine error messages&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[colorToRGBA]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function is the opposite of [http://wiki.multitheftauto.com/index.php?title=Tocolor tocolor].&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawColorText]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a dx text with #RRGGBB color codes support.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawEmptyRectangle]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Draws a rectangle that is empty. The thickness can be set.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawGifImage]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function simulates the effect of a GIF image by using image sprites.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawImage3D]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a 3D image.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawRectangle3D]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a 3D rectangle.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxGetFontSizeFromHeight]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function calculate a font size from given height for dxDraw.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxGetRealFontHeight]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Accurately measures the pixel height of a font.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[findRotation]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Takes two points and returns the direction from point A to point B.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[FormatDate]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Formats a date on the basis of a format string and returns it.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[GenerateString]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» With this function you can generate a random string with any characters.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAge]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function calculates the age of a birthday.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAlivePlayers (Client)|getAlivePlayers]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns all the alive players by a client side, so you can store them into a Gridlist or something like that, faster.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAlivePlayersInTeam]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of the alive players in a team.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getColorRed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to retrieve the Red component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getColorGreen]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to retrieve the Green component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getColorBlue]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to retrieve the Blue component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getColorAlpha]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to retrieve the Alpha component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getCursorMoveOn]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks in which way the cursor is currently moving.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getDistanceBetweenPointAndSegment2D]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Takes point coordinates and line (a segment) starting and ending coordinates. It returns the shortest distance between the point and the line.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getElementSpeed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to get element speed in kph or mph units.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getJetpackWeaponsEnabled]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of enabled weapons usable on a jetpack.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getOffsetFromXYZ]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to take an entity and a position and calculate the relative offset between them accounting for rotations.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getOnlineAdmins]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function will give the online admins.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getOnlineStaff]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Returns all online staff, names separated by two spaces.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayerFromNamePart]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to get player From his Name part.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayersInPhotograph]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function gets all the players in a photograph.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPointFromDistanceRotation]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Finds a point based on a starting point, direction and distance.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getResourceSettings]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of the resource settings.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getResultingColor]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns the resulting color of two overlapped colors.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getTimestamp]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» With this function you can get the UNIX timestamp.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getXMLNodes]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Returns all children of a node&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[guiComboBoxAdjustHeight]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Adjusts the combobox to have a correct height.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[guiEditSetActive]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Puts the caret of an editbox to the gived position.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[IfElse]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Returns one of two values based on a boolean expression.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementInPhotograph]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if an element was in the player's camera picture.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementInRange]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to check is the element's range to the main point is smaller than (or as big as) the maximum range.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[IsElementMoving]]&amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if an element is moving.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPedAiming]]&amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if a ped is aiming.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPlayerInTeam]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function check if the player in the team.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isLeapYear]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Checks if the given year is a leap year.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isVehicleOnRoof]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks whether vehicle is on roof.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[iterElements]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Returns an iterator for your for loops saving time typing ipairs( getElementsByType( type ) ), instead you type: iterElements( type ).&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[mapValue]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function maps a value from one range to another.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[math.round]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Rounds a number whereas the number of decimals to keep and the method may be set.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[multi_check]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks one element to many, handy and clean.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[onVehicleWeaponFire]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This code implements an event that is triggered when a player in a vehicle fires a vehicles weapon.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setColorRed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to change the Red component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setColorGreen]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to change the Green component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setColorBlue]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to change the Blue component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setColorAlpha]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to change the Alpha component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setElementSpeed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to set moving element speed in kph or mph units.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setTableProtected]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Protects a table and makes it read-only.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setVehicleGravityPoint]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This clientside function sets a vehicle's gravity in the direction of a 3 dimensional coordinate with the strength specified.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[smoothMoveCamera]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This clientside function allows you to create a cinematic camera flight.&lt;br /&gt;
*[[string.count]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function counts a text from a text.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[string.explode]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function splits a string at a given separator pattern and returns a table with the pieces.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[switch]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allow the value of a variable or expression to control the flow of program execution via a multiway branch.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.copy]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function copies a whole table and all the tables in that table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.condition]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function check if both tables is equal. &amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.empty]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function check is empty table or not.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.map]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function goes through a table and replaces every field with the return of the passed function, where the field's value is passed as first argument and optionally more arguments.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.random]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function retrieves a random variable from a table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.size]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Finds the absolute size of a table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[var dump]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function outputs information about one or more variables using outputConsole()&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[RGBToHex]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a string representing the color in hexadecimal.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[toHex]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts a decimal number to a hexadecimal number, as a fix to be used clientside.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[wavelengthToRGBA]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts a phisical wavelength of light to a RGBA color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[convertNumber]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts large numbers and adds commas to it. (Example: 100000 -&amp;gt; 100,000)&amp;lt;/span&amp;gt;&lt;br /&gt;
[[Category:Useful Functions]]&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&amp;diff=34572</id>
		<title>Template:Useful Functions</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&amp;diff=34572"/>
		<updated>2013-01-18T20:31:18Z</updated>

		<summary type="html">&lt;p&gt;Guix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[callClientFunction]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to call any clientside function from the server's side.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[callServerFunction]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to call any server-side function from the client's side.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[centerWindow]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function center the window in any resolution.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[Check]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if it's arguments are of the right types and calls the error-function if one isn't.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[coroutine.resume]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Fix for hidden coroutine error messages&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[colorToRGBA]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function is the opposite of [http://wiki.multitheftauto.com/index.php?title=Tocolor tocolor].&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawColorText]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a dx text with #RRGGBB color codes support.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawEmptyRectangle]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Draws a rectangle that is empty. The thickness can be set.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawGifImage]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function simulates the effect of a GIF image by using image sprites.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawImage3D]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a 3D image.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawRectangle3D]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a 3D rectangle.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxGetFontSizeFromHeight]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function calculate a font size from given height for dxDraw.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxGetRealFontHeight]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Accurately measures the pixel height of a font.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[findRotation]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Takes two points and returns the direction from point A to point B.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[FormatDate]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Formats a date on the basis of a format string and returns it.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[GenerateString]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» With this function you can generate a random string with any characters.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAge]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function calculates the age of a birthday.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAlivePlayers (Client)|getAlivePlayers]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns all the alive players by a client side, so you can store them into a Gridlist or something like that, faster.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAlivePlayersInTeam]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of the alive players in a team.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getColorRed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to retrieve the Red component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getColorGreen]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to retrieve the Green component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getColorBlue]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to retrieve the Blue component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getColorAlpha]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to retrieve the Alpha component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getCursorMoveOn]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks in which way the cursor is currently moving.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getDistanceBetweenPointAndSegment2D]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Takes point coordinates and line (a segment) starting and ending coordinates. It returns the shortest distance between the point and the line.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getElementSpeed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to get element speed in kph or mph units.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getJetpackWeaponsEnabled]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of enabled weapons usable on a jetpack.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getOffsetFromXYZ]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to take an entity and a position and calculate the relative offset between them accounting for rotations.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getOnlineAdmins]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function will give the online admins.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getOnlineStaff]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Returns all online staff, names separated by two spaces.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayerFromNamePart]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to get player From his Name part.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayersInPhotograph]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function gets all the players in a photograph.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPointFromDistanceRotation]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Finds a point based on a starting point, direction and distance.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getResourceSettings]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of the resource settings.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getTimestamp]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» With this function you can get the UNIX timestamp.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getXMLNodes]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Returns all children of a node&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[guiComboBoxAdjustHeight]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Adjusts the combobox to have a correct height.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[guiEditSetActive]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Puts the caret of an editbox to the gived position.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[IfElse]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Returns one of two values based on a boolean expression.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementInPhotograph]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if an element was in the player's camera picture.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementInRange]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to check is the element's range to the main point is smaller than (or as big as) the maximum range.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[IsElementMoving]]&amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if an element is moving.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPedAiming]]&amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if a ped is aiming.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPlayerInTeam]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function check if the player in the team.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isLeapYear]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Checks if the given year is a leap year.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isVehicleOnRoof]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks whether vehicle is on roof.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[iterElements]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Returns an iterator for your for loops saving time typing ipairs( getElementsByType( type ) ), instead you type: iterElements( type ).&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[mapValue]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function maps a value from one range to another.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[math.round]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Rounds a number whereas the number of decimals to keep and the method may be set.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[multi_check]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks one element to many, handy and clean.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[onVehicleWeaponFire]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This code implements an event that is triggered when a player in a vehicle fires a vehicles weapon.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setColorRed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to change the Red component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setColorGreen]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to change the Green component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setColorBlue]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to change the Blue component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setColorAlpha]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to change the Alpha component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setElementSpeed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to set moving element speed in kph or mph units.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setTableProtected]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Protects a table and makes it read-only.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setVehicleGravityPoint]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This clientside function sets a vehicle's gravity in the direction of a 3 dimensional coordinate with the strength specified.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[string.count]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function counts a text from a text.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[string.explode]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function splits a string at a given separator pattern and returns a table with the pieces.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[switch]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allow the value of a variable or expression to control the flow of program execution via a multiway branch.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.copy]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function copies a whole table and all the tables in that table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.condition]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function check if both tables is equal. &amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.empty]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function check is empty table or not.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.map]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function goes through a table and replaces every field with the return of the passed function, where the field's value is passed as first argument and optionally more arguments.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.random]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function retrieves a random variable from a table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.size]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Finds the absolute size of a table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[var dump]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function outputs information about one or more variables using outputConsole()&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[RGBToHex]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a string representing the color in hexadecimal.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[toHex]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts a decimal number to a hexadecimal number, as a fix to be used clientside.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[wavelengthToRGBA]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts a phisical wavelength of light to a RGBA color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[convertNumber]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts large numbers and adds commas to it. (Example: 100000 -&amp;gt; 100,000)&amp;lt;/span&amp;gt;&lt;br /&gt;
[[Category:Useful Functions]]&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&amp;diff=34565</id>
		<title>Template:Useful Functions</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&amp;diff=34565"/>
		<updated>2013-01-17T21:42:43Z</updated>

		<summary type="html">&lt;p&gt;Guix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[callClientFunction]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to call any clientside function from the server's side.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[callServerFunction]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to call any server-side function from the client's side.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[centerWindow]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function center the window in any resolution.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[Check]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if it's arguments are of the right types and calls the error-function if one isn't.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[coroutine.resume]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Fix for hidden coroutine error messages&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[colorToRGBA]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function is the opposite of [http://wiki.multitheftauto.com/index.php?title=Tocolor tocolor].&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawColorText]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a dx text with #RRGGBB color codes support.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawGifImage]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function simulates the effect of a GIF image by using image sprites.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawImage3D]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a 3D image.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawRectangle3D]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a 3D rectangle.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxGetFontSizeFromHeight]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function calculate a font size from given height for dxDraw.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxGetRealFontHeight]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Accurately measures the pixel height of a font.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[findRotation]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Takes two points and returns the direction from point A to point B.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[FormatDate]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Formats a date on the basis of a format string and returns it.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[GenerateString]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» With this function you can generate a random string with any characters.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAge]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function calculates the age of a birthday.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAlivePlayers (Client)|getAlivePlayers]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns all the alive players by a client side, so you can store them into a Gridlist or something like that, faster.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAlivePlayersInTeam]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of the alive players in a team.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getColorRed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to retrieve the Red component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getColorGreen]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to retrieve the Green component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getColorBlue]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to retrieve the Blue component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getColorAlpha]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to retrieve the Alpha component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getCursorMoveOn]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks in which way the cursor is currently moving.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getDistanceBetweenPointAndSegment2D]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Takes point coordinates and line (a segment) starting and ending coordinates. It returns the shortest distance between the point and the line.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getElementSpeed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to get element speed in kph or mph units.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getJetpackWeaponsEnabled]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of enabled weapons usable on a jetpack.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getOffsetFromXYZ]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to take an entity and a position and calculate the relative offset between them accounting for rotations.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getOnlineAdmins]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function will give the online admins.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getOnlineStaff]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Returns all online staff, names separated by two spaces.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayerFromNamePart]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to get player From his Name part.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayersInPhotograph]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function gets all the players in a photograph.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPointFromDistanceRotation]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Finds a point based on a starting point, direction and distance.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getResourceSettings]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of the resource settings.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getTimestamp]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» With this function you can get the UNIX timestamp.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getXMLNodes]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Returns all children of a node&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[guiComboBoxAdjustHeight]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Adjusts the combobox to have a correct height.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[guiEditSetActive]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Puts the caret of an editbox to the gived position.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[IfElse]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Returns one of two values based on a boolean expression.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementInPhotograph]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if an element was in the player's camera picture.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementInRange]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to check is the element's range to the main point is smaller than (or as big as) the maximum range.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[IsElementMoving]]&amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if an element is moving.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPedAiming]]&amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if a ped is aiming.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPlayerInTeam]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function check if the player in the team.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isLeapYear]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Checks if the given year is a leap year.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isVehicleOnRoof]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks whether vehicle is on roof.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[iterElements]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Returns an iterator for your for loops saving time typing ipairs( getElementsByType( type ) ), instead you type: iterElements( type ).&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[mapValue]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function maps a value from one range to another.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[math.round]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Rounds a number whereas the number of decimals to keep and the method may be set.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[multi_check]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks one element to many, handy and clean.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[onVehicleWeaponFire]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This code implements an event that is triggered when a player in a vehicle fires a vehicles weapon.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setColorRed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to change the Red component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setColorGreen]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to change the Green component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setColorBlue]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to change the Blue component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setColorAlpha]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to change the Alpha component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setElementSpeed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to set moving element speed in kph or mph units.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setTableProtected]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Protects a table and makes it read-only.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setVehicleGravityPoint]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This clientside function sets a vehicle's gravity in the direction of a 3 dimensional coordinate with the strength specified.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[string.count]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function counts a text from a text.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[string.explode]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function splits a string at a given separator pattern and returns a table with the pieces.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[switch]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allow the value of a variable or expression to control the flow of program execution via a multiway branch.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.copy]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function copies a whole table and all the tables in that table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.condition]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function check if both tables is equal. &amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.empty]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function check is empty table or not.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.map]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function goes through a table and replaces every field with the return of the passed function, where the field's value is passed as first argument and optionally more arguments.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.random]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function retrieves a random variable from a table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.size]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Finds the absolute size of a table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[var dump]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function outputs information about one or more variables using outputConsole()&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[RGBToHex]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a string representing the color in hexadecimal.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[toHex]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts a decimal number to a hexadecimal number, as a fix to be used clientside.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[wavelengthToRGBA]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts a phisical wavelength of light to a RGBA color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[convertNumber]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts large numbers and adds commas to it. (Example: 100000 -&amp;gt; 100,000)&amp;lt;/span&amp;gt;&lt;br /&gt;
[[Category:Useful Functions]]&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Tocolor&amp;diff=34555</id>
		<title>Tocolor</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Tocolor&amp;diff=34555"/>
		<updated>2013-01-16T23:50:43Z</updated>

		<summary type="html">&lt;p&gt;Guix: /* Related functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}} &lt;br /&gt;
This function retrieves the hex number of a specified color, useful for the dx functions.&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 tocolor ( int red, int green, int blue [, int alpha = 255] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
* '''red:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space red] in the color (0-255).&lt;br /&gt;
* '''green:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space green] in the color (0-255).&lt;br /&gt;
* '''blue:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space blue] in the color (0-255).&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
* '''alpha:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space alpha] in the color (0-255).&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a single value representing the color.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example displays the text &amp;quot;Tuna&amp;quot; in small at the top left side of your screen. The color of this text can be changed using the command /tunaColor.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local tunaColor = tocolor(255, 0, 0, 255) -- Default color&lt;br /&gt;
&lt;br /&gt;
-- This function draws the text&lt;br /&gt;
local function drawTuna()&lt;br /&gt;
	dxDrawText(&amp;quot;Tuna&amp;quot;, 5, 5, 100, 100, tunaColor)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientRender&amp;quot;, root, drawTuna)&lt;br /&gt;
&lt;br /&gt;
--This function handles the /tunaColor command, allowing players to set the color of tuna&lt;br /&gt;
local function tunaColorCommand(command, red, green, blue, alpha)&lt;br /&gt;
	red, green, blue, alpha = tonumber(red), tonumber(green), tonumber(blue), tonumber(alpha) -- Convert all the args to numbers. NOTE: tonumber will return false if the arg is not provided/is not valid.&lt;br /&gt;
	&lt;br /&gt;
	-- Remind the user of the proper syntax if they failed to provide all the args&lt;br /&gt;
	if not red or not green or not blue then&lt;br /&gt;
		outputChatBox(&amp;quot;* USAGE: /tunaColor [red] [green] [blue] [alpha]&amp;quot;, 255, 0, 0)&lt;br /&gt;
		return&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Make the alpha arg optional&lt;br /&gt;
	if not alpha then&lt;br /&gt;
		alpha = 255&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Update the color&lt;br /&gt;
	tunaColor = tocolor(red, green, blue, alpha)&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;tunaColor&amp;quot;, tunaColorCommand)&lt;br /&gt;
-- Example /setcoloroftuna 255 0 0 255 - for red.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Related functions==&lt;br /&gt;
&lt;br /&gt;
[http://wiki.multitheftauto.com/wiki/ColorToRGBA colorToRGBA]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.multitheftauto.com/wiki/SetColorRed setColorRed]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.multitheftauto.com/wiki/SetColorGreen setColorGreen]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.multitheftauto.com/wiki/SetColorBlue setColorBlue]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.multitheftauto.com/wiki/SetColorAlpha setColorAlpha]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.multitheftauto.com/wiki/GetColorRed getColorRed]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.multitheftauto.com/wiki/GetColorGreen getColorGreen]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.multitheftauto.com/wiki/GetColorBlue getColorBlue]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.multitheftauto.com/wiki/GetColorAlpha getColorAlpha]&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_utility_functions}}&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Tocolor&amp;diff=34554</id>
		<title>Tocolor</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Tocolor&amp;diff=34554"/>
		<updated>2013-01-16T23:50:08Z</updated>

		<summary type="html">&lt;p&gt;Guix: /* Related functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}} &lt;br /&gt;
This function retrieves the hex number of a specified color, useful for the dx functions.&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 tocolor ( int red, int green, int blue [, int alpha = 255] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
* '''red:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space red] in the color (0-255).&lt;br /&gt;
* '''green:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space green] in the color (0-255).&lt;br /&gt;
* '''blue:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space blue] in the color (0-255).&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
* '''alpha:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space alpha] in the color (0-255).&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a single value representing the color.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example displays the text &amp;quot;Tuna&amp;quot; in small at the top left side of your screen. The color of this text can be changed using the command /tunaColor.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local tunaColor = tocolor(255, 0, 0, 255) -- Default color&lt;br /&gt;
&lt;br /&gt;
-- This function draws the text&lt;br /&gt;
local function drawTuna()&lt;br /&gt;
	dxDrawText(&amp;quot;Tuna&amp;quot;, 5, 5, 100, 100, tunaColor)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientRender&amp;quot;, root, drawTuna)&lt;br /&gt;
&lt;br /&gt;
--This function handles the /tunaColor command, allowing players to set the color of tuna&lt;br /&gt;
local function tunaColorCommand(command, red, green, blue, alpha)&lt;br /&gt;
	red, green, blue, alpha = tonumber(red), tonumber(green), tonumber(blue), tonumber(alpha) -- Convert all the args to numbers. NOTE: tonumber will return false if the arg is not provided/is not valid.&lt;br /&gt;
	&lt;br /&gt;
	-- Remind the user of the proper syntax if they failed to provide all the args&lt;br /&gt;
	if not red or not green or not blue then&lt;br /&gt;
		outputChatBox(&amp;quot;* USAGE: /tunaColor [red] [green] [blue] [alpha]&amp;quot;, 255, 0, 0)&lt;br /&gt;
		return&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Make the alpha arg optional&lt;br /&gt;
	if not alpha then&lt;br /&gt;
		alpha = 255&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Update the color&lt;br /&gt;
	tunaColor = tocolor(red, green, blue, alpha)&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;tunaColor&amp;quot;, tunaColorCommand)&lt;br /&gt;
-- Example /setcoloroftuna 255 0 0 255 - for red.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Related functions==&lt;br /&gt;
&lt;br /&gt;
[http://wiki.multitheftauto.com/index.php?title=ColorToRGBA colorToRGBA]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.multitheftauto.com/wiki/SetColorRed setColorRed]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.multitheftauto.com/wiki/SetColorGreen setColorGreen]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.multitheftauto.com/wiki/SetColorBlue setColorBlue]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.multitheftauto.com/wiki/SetColorAlpha setColorAlpha]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.multitheftauto.com/wiki/GetColorRed getColorRed]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.multitheftauto.com/wiki/GetColorGreen getColorGreen]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.multitheftauto.com/wiki/GetColorBlue getColorBlue]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.multitheftauto.com/wiki/GetColorAlpha getColorAlpha]&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_utility_functions}}&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&amp;diff=34543</id>
		<title>Template:Useful Functions</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&amp;diff=34543"/>
		<updated>2013-01-16T23:14:04Z</updated>

		<summary type="html">&lt;p&gt;Guix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[callClientFunction]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to call any clientside function from the server's side.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[callServerFunction]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to call any server-side function from the client's side.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[centerWindow]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function center the window in any resolution.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[Check]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if it's arguments are of the right types and calls the error-function if one isn't.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[coroutine.resume]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Fix for hidden coroutine error messages&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[colorToRGBA]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function is the opposite of [http://wiki.multitheftauto.com/index.php?title=Tocolor tocolor].&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawColorText]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a dx text with #RRGGBB color codes support.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawGifImage]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function simulates the effect of a GIF image by using image sprites.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawImage3D]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a 3D image.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawRectangle3D]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a 3D rectangle.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxGetFontSizeFromHeight]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function calculate a font size from given height for dxDraw.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxGetRealFontHeight]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Accurately measures the pixel height of a font.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[findRotation]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Takes two points and returns the direction from point A to point B.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[FormatDate]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Formats a date on the basis of a format string and returns it.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[GenerateString]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» With this function you can generate a random string with any characters.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAge]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function calculates the age of a birthday.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAlivePlayers (Client)|getAlivePlayers]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns all the alive players by a client side, so you can store them into a Gridlist or something like that, faster.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAlivePlayersInTeam]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of the alive players in a team.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getColorRed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to retrieve the Red component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getColorGreen]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to retrieve the Green component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getColorBlue]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to retrieve the Blue component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getColorAlpha]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to retrieve the Alpha component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getCursorMoveOn]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks in which way the cursor is currently moving.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getDistanceBetweenPointAndSegment2D]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Takes point coordinates and line (a segment) starting and ending coordinates. It returns the shortest distance between the point and the line.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getElementSpeed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to get element speed in kph or mph units.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getJetpackWeaponsEnabled]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of enabled weapons usable on a jetpack.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getOffsetFromXYZ]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to take an entity and a position and calculate the relative offset between them accounting for rotations.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getOnlineAdmins]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function will give the online admins.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getOnlineStaff]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Returns all online staff, names separated by two spaces.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayerFromNamePart]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to get player From his Name part.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayersInPhotograph]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function gets all the players in a photograph.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPointFromDistanceRotation]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Finds a point based on a starting point, direction and distance.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getResourceSettings]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of the resource settings.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getTimestamp]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» With this function you can get the UNIX timestamp.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getXMLNodes]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Returns all children of a node&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[guiComboBoxAdjustHeight]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Adjusts the combobox to have a correct height.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[guiEditSetActive]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Puts the caret of an editbox to the gived position.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[IfElse]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Returns one of two values based on a boolean expression.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementInPhotograph]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if an element was in the player's camera picture.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementInRange]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to check is the element's range to the main point is smaller than (or as big as) the maximum range.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[IsElementMoving]]&amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if an element is moving.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPedAiming]]&amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if a ped is aiming.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPlayerInTeam]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function check if the player in the team.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isLeapYear]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Checks if the given year is a leap year.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isVehicleOnRoof]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks whether vehicle is on roof.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[iterElements]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Returns an iterator for your for loops saving time typing ipairs( getElementsByType( type ) ), instead you type: iterElements( type ).&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[math.round]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Rounds a number whereas the number of decimals to keep and the method may be set.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[multi_check]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks one element to many, handy and clean.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[onVehicleWeaponFire]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This code implements an event that is triggered when a player in a vehicle fires a vehicles weapon.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setColorRed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to change the Red component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setColorGreen]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to change the Green component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setColorBlue]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to change the Blue component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setColorAlpha]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to change the Alpha component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setElementSpeed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to set moving element speed in kph or mph units.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setTableProtected]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Protects a table and makes it read-only.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setVehicleGravityPoint]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This clientside function sets a vehicle's gravity in the direction of a 3 dimensional coordinate with the strength specified.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[string.count]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function counts a text from a text.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[string.explode]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function splits a string at a given separator pattern and returns a table with the pieces.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[switch]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allow the value of a variable or expression to control the flow of program execution via a multiway branch.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.copy]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function copies a whole table and all the tables in that table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.condition]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function check if both tables is equal. &amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.empty]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function check is empty table or not.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.map]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function goes through a table and replaces every field with the return of the passed function, where the field's value is passed as first argument and optionally more arguments.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.random]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function retrieves a random variable from a table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.size]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Finds the absolute size of a table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[var dump]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function outputs information about one or more variables using outputConsole()&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[RGBToHex]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a string representing the color in hexadecimal.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[toHex]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts a decimal number to a hexadecimal number, as a fix to be used clientside.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[wavelengthToRGBA]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts a phisical wavelength of light to a RGBA color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[convertNumber]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts large numbers and adds commas to it. (Example: 100000 -&amp;gt; 100,000)&amp;lt;/span&amp;gt;&lt;br /&gt;
[[Category:Useful Functions]]&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Tocolor&amp;diff=34538</id>
		<title>Tocolor</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Tocolor&amp;diff=34538"/>
		<updated>2013-01-16T21:54:57Z</updated>

		<summary type="html">&lt;p&gt;Guix: /* Related functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}} &lt;br /&gt;
This function retrieves the hex number of a specified color, useful for the dx functions.&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 tocolor ( int red, int green, int blue [, int alpha = 255] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
* '''red:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space red] in the color (0-255).&lt;br /&gt;
* '''green:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space green] in the color (0-255).&lt;br /&gt;
* '''blue:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space blue] in the color (0-255).&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
* '''alpha:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space alpha] in the color (0-255).&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a single value representing the color.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example displays the text &amp;quot;Tuna&amp;quot; in small at the top left side of your screen. The color of this text can be changed using the command /tunaColor.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local tunaColor = tocolor(255, 0, 0, 255) -- Default color&lt;br /&gt;
&lt;br /&gt;
-- This function draws the text&lt;br /&gt;
local function drawTuna()&lt;br /&gt;
	dxDrawText(&amp;quot;Tuna&amp;quot;, 5, 5, 100, 100, tunaColor)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientRender&amp;quot;, root, drawTuna)&lt;br /&gt;
&lt;br /&gt;
--This function handles the /tunaColor command, allowing players to set the color of tuna&lt;br /&gt;
local function tunaColorCommand(command, red, green, blue, alpha)&lt;br /&gt;
	red, green, blue, alpha = tonumber(red), tonumber(green), tonumber(blue), tonumber(alpha) -- Convert all the args to numbers. NOTE: tonumber will return false if the arg is not provided/is not valid.&lt;br /&gt;
	&lt;br /&gt;
	-- Remind the user of the proper syntax if they failed to provide all the args&lt;br /&gt;
	if not red or not green or not blue then&lt;br /&gt;
		outputChatBox(&amp;quot;* USAGE: /tunaColor [red] [green] [blue] [alpha]&amp;quot;, 255, 0, 0)&lt;br /&gt;
		return&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Make the alpha arg optional&lt;br /&gt;
	if not alpha then&lt;br /&gt;
		alpha = 255&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Update the color&lt;br /&gt;
	tunaColor = tocolor(red, green, blue, alpha)&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;tunaColor&amp;quot;, tunaColorCommand)&lt;br /&gt;
-- Example /setcoloroftuna 255 0 0 255 - for red.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Related functions==&lt;br /&gt;
&lt;br /&gt;
[http://wiki.multitheftauto.com/index.php?title=ColorToRGBA colorToRGBA]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.multitheftauto.com/wiki/SetColorRed setColorRed]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.multitheftauto.com/wiki/SetColorGreen setColorGreen]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.multitheftauto.com/wiki/SetColorBlue setColorBlue]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.multitheftauto.com/wiki/SetColorAlpha setColorAlpha]&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_utility_functions}}&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=WavelengthToRGBA&amp;diff=34537</id>
		<title>WavelengthToRGBA</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=WavelengthToRGBA&amp;diff=34537"/>
		<updated>2013-01-16T21:51:24Z</updated>

		<summary type="html">&lt;p&gt;Guix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Useful Function}}&lt;br /&gt;
&amp;lt;lowercasetitle&amp;gt;&amp;lt;/lowercasetitle&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function retrieves the RGBA components of a wavelenght.&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, int, int, int wavelengthToRGBA ( int length )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
* '''length :''' The wavelength of the light in nanometers.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns four color components in RGBA format.&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Function source&amp;quot; class=&amp;quot;both&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function wavelengthToRGBA (length)&lt;br /&gt;
	local r, g, b, factor&lt;br /&gt;
	if (length &amp;gt;= 380 and length &amp;lt; 440) then&lt;br /&gt;
		r, g, b = -(length - 440)/(440 - 380), 0, 1&lt;br /&gt;
	elseif (length &amp;lt; 489) then&lt;br /&gt;
		r, g, b = 0, (length - 440)/(490 - 440), 1&lt;br /&gt;
	elseif (length &amp;lt; 510) then&lt;br /&gt;
		r, g, b = 0, 1, -(length - 510)/(510 - 490)&lt;br /&gt;
	elseif (length &amp;lt; 580) then&lt;br /&gt;
		r, g, b = (length - 510)/(580 - 510), 1, 0&lt;br /&gt;
	elseif (length &amp;lt; 645) then&lt;br /&gt;
		r, g, b = 1, -(length - 645)/(645 - 580), 0&lt;br /&gt;
	elseif (length &amp;lt; 780) then&lt;br /&gt;
		r, g, b = 1, 0, 0&lt;br /&gt;
	else&lt;br /&gt;
		r, g, b = 0, 0, 0&lt;br /&gt;
	end&lt;br /&gt;
	if (length &amp;gt;= 380 and length &amp;lt; 420) then&lt;br /&gt;
		factor = 0.3 + 0.7*(length - 380)/(420 - 380)&lt;br /&gt;
	elseif (length &amp;lt; 701) then&lt;br /&gt;
		factor = 1&lt;br /&gt;
	elseif (length &amp;lt; 780) then&lt;br /&gt;
		factor = 0.3 + 0.7*(780 - length)/(780 - 700)&lt;br /&gt;
	else&lt;br /&gt;
		factor = 0&lt;br /&gt;
	end&lt;br /&gt;
	return r*255, g*255, b*255, factor*255&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Author: Lex128&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Tocolor&amp;diff=34531</id>
		<title>Tocolor</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Tocolor&amp;diff=34531"/>
		<updated>2013-01-16T21:41:15Z</updated>

		<summary type="html">&lt;p&gt;Guix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}} &lt;br /&gt;
This function retrieves the hex number of a specified color, useful for the dx functions.&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 tocolor ( int red, int green, int blue [, int alpha = 255] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
* '''red:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space red] in the color (0-255).&lt;br /&gt;
* '''green:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space green] in the color (0-255).&lt;br /&gt;
* '''blue:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space blue] in the color (0-255).&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
* '''alpha:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space alpha] in the color (0-255).&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a single value representing the color.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example displays the text &amp;quot;Tuna&amp;quot; in small at the top left side of your screen. The color of this text can be changed using the command /tunaColor.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local tunaColor = tocolor(255, 0, 0, 255) -- Default color&lt;br /&gt;
&lt;br /&gt;
-- This function draws the text&lt;br /&gt;
local function drawTuna()&lt;br /&gt;
	dxDrawText(&amp;quot;Tuna&amp;quot;, 5, 5, 100, 100, tunaColor)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientRender&amp;quot;, root, drawTuna)&lt;br /&gt;
&lt;br /&gt;
--This function handles the /tunaColor command, allowing players to set the color of tuna&lt;br /&gt;
local function tunaColorCommand(command, red, green, blue, alpha)&lt;br /&gt;
	red, green, blue, alpha = tonumber(red), tonumber(green), tonumber(blue), tonumber(alpha) -- Convert all the args to numbers. NOTE: tonumber will return false if the arg is not provided/is not valid.&lt;br /&gt;
	&lt;br /&gt;
	-- Remind the user of the proper syntax if they failed to provide all the args&lt;br /&gt;
	if not red or not green or not blue then&lt;br /&gt;
		outputChatBox(&amp;quot;* USAGE: /tunaColor [red] [green] [blue] [alpha]&amp;quot;, 255, 0, 0)&lt;br /&gt;
		return&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Make the alpha arg optional&lt;br /&gt;
	if not alpha then&lt;br /&gt;
		alpha = 255&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Update the color&lt;br /&gt;
	tunaColor = tocolor(red, green, blue, alpha)&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;tunaColor&amp;quot;, tunaColorCommand)&lt;br /&gt;
-- Example /setcoloroftuna 255 0 0 255 - for red.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Related functions==&lt;br /&gt;
&lt;br /&gt;
[http://wiki.multitheftauto.com/index.php?title=ColorToRGBA colorToRBGA]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.multitheftauto.com/wiki/SetColorRed setColorRed]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.multitheftauto.com/wiki/SetColorGreen setColorGreen]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.multitheftauto.com/wiki/SetColorBlue setColorBlue]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.multitheftauto.com/wiki/SetColorAlpha setColorAlpha]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_utility_functions}}&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Tocolor&amp;diff=34530</id>
		<title>Tocolor</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Tocolor&amp;diff=34530"/>
		<updated>2013-01-16T21:38:09Z</updated>

		<summary type="html">&lt;p&gt;Guix: /* The opposite function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}} &lt;br /&gt;
This function retrieves the hex number of a specified color, useful for the dx functions.&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 tocolor ( int red, int green, int blue [, int alpha = 255] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
* '''red:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space red] in the color (0-255).&lt;br /&gt;
* '''green:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space green] in the color (0-255).&lt;br /&gt;
* '''blue:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space blue] in the color (0-255).&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
* '''alpha:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space alpha] in the color (0-255).&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a single value representing the color.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example displays the text &amp;quot;Tuna&amp;quot; in small at the top left side of your screen. The color of this text can be changed using the command /tunaColor.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local tunaColor = tocolor(255, 0, 0, 255) -- Default color&lt;br /&gt;
&lt;br /&gt;
-- This function draws the text&lt;br /&gt;
local function drawTuna()&lt;br /&gt;
	dxDrawText(&amp;quot;Tuna&amp;quot;, 5, 5, 100, 100, tunaColor)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientRender&amp;quot;, root, drawTuna)&lt;br /&gt;
&lt;br /&gt;
--This function handles the /tunaColor command, allowing players to set the color of tuna&lt;br /&gt;
local function tunaColorCommand(command, red, green, blue, alpha)&lt;br /&gt;
	red, green, blue, alpha = tonumber(red), tonumber(green), tonumber(blue), tonumber(alpha) -- Convert all the args to numbers. NOTE: tonumber will return false if the arg is not provided/is not valid.&lt;br /&gt;
	&lt;br /&gt;
	-- Remind the user of the proper syntax if they failed to provide all the args&lt;br /&gt;
	if not red or not green or not blue then&lt;br /&gt;
		outputChatBox(&amp;quot;* USAGE: /tunaColor [red] [green] [blue] [alpha]&amp;quot;, 255, 0, 0)&lt;br /&gt;
		return&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Make the alpha arg optional&lt;br /&gt;
	if not alpha then&lt;br /&gt;
		alpha = 255&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Update the color&lt;br /&gt;
	tunaColor = tocolor(red, green, blue, alpha)&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;tunaColor&amp;quot;, tunaColorCommand)&lt;br /&gt;
-- Example /setcoloroftuna 255 0 0 255 - for red.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The opposite function==&lt;br /&gt;
&lt;br /&gt;
See [http://wiki.multitheftauto.com/index.php?title=ColorToRGBA colorToRBGA]&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_utility_functions}}&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Talk:Tocolor&amp;diff=34529</id>
		<title>Talk:Tocolor</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Talk:Tocolor&amp;diff=34529"/>
		<updated>2013-01-16T21:34:32Z</updated>

		<summary type="html">&lt;p&gt;Guix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This opposite function, shoudn't that be an useful function? I suggest moving it to there.&lt;br /&gt;
--[[User:Remi-X|Remi-X]] 17:29, 16 January 2013 (UTC)&lt;br /&gt;
&lt;br /&gt;
Done :)&lt;br /&gt;
--[[User:Guix|Guix]] 21:34, 16 January 2013 (UTC)&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&amp;diff=34522</id>
		<title>Template:Useful Functions</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&amp;diff=34522"/>
		<updated>2013-01-16T21:19:41Z</updated>

		<summary type="html">&lt;p&gt;Guix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[callClientFunction]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to call any clientside function from the server's side.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[callServerFunction]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to call any server-side function from the client's side.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[centerWindow]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function center the window in any resolution.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[Check]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if it's arguments are of the right types and calls the error-function if one isn't.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[coroutine.resume]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Fix for hidden coroutine error messages&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[colorToRGBA]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function is the opposite of [http://wiki.multitheftauto.com/index.php?title=Tocolor tocolor].&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawColorText]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a dx text with #RRGGBB color codes support.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawGifImage]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function simulates the effect of a GIF image by using image sprites.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawImage3D]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a 3D image.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawRectangle3D]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a 3D rectangle.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxGetFontSizeFromHeight]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function calculate a font size from given height for dxDraw.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxGetRealFontHeight]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Accurately measures the pixel height of a font.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[findRotation]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Takes two points and returns the direction from point A to point B.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[FormatDate]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Formats a date on the basis of a format string and returns it.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[GenerateString]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» With this function you can generate a random string with any characters.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAge]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function calculates the age of a birthday.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAlivePlayers (Client)|getAlivePlayers]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns all the alive players by a client side, so you can store them into a Gridlist or something like that, faster.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAlivePlayersInTeam]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of the alive players in a team.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getCursorMoveOn]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks in which way the cursor is currently moving.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getDistanceBetweenPointAndSegment2D]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Takes point coordinates and line (a segment) starting and ending coordinates. It returns the shortest distance between the point and the line.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getElementSpeed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to get element speed in kph or mph units.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getJetpackWeaponsEnabled]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of enabled weapons usable on a jetpack.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getOffsetFromXYZ]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to take an entity and a position and calculate the relative offset between them accounting for rotations.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getOnlineAdmins]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function will give the online admins.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getOnlineStaff]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Returns all online staff, names separated by two spaces.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayerFromNamePart]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to get player From his Name part.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayersInPhotograph]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function gets all the players in a photograph.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPointFromDistanceRotation]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Finds a point based on a starting point, direction and distance.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getResourceSettings]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of the resource settings.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getTimestamp]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» With this function you can get the UNIX timestamp.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getXMLNodes]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Returns all children of a node&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[guiComboBoxAdjustHeight]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Adjusts the combobox to have a correct height.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[guiEditSetActive]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Puts the caret of an editbox to the gived position.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[IfElse]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Returns one of two values based on a boolean expression.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementInPhotograph]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if an element was in the player's camera picture.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementInRange]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to check is the element's range to the main point is smaller than (or as big as) the maximum range.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[IsElementMoving]]&amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if an element is moving.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPedAiming]]&amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if a ped is aiming.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPlayerInTeam]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function check if the player in the team.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isLeapYear]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Checks if the given year is a leap year.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isVehicleOnRoof]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks whether vehicle is on roof.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[iterElements]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Returns an iterator for your for loops saving time typing ipairs( getElementsByType( type ) ), instead you type: iterElements( type ).&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[math.round]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Rounds a number whereas the number of decimals to keep and the method may be set.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[multi_check]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks one element to many, handy and clean.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[onVehicleWeaponFire]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This code implements an event that is triggered when a player in a vehicle fires a vehicles weapon.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setColorRed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to change the Red component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setColorGreen]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to change the Green component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setColorBlue]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to change the Blue component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setColorAlpha]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to change the Alpha component of a color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setElementSpeed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to set moving element speed in kph or mph units.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setTableProtected]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Protects a table and makes it read-only.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setVehicleGravityPoint]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This clientside function sets a vehicle's gravity in the direction of a 3 dimensional coordinate with the strength specified.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[string.count]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function counts a text from a text.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[string.explode]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function splits a string at a given separator pattern and returns a table with the pieces.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[switch]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allow the value of a variable or expression to control the flow of program execution via a multiway branch.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.copy]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function copies a whole table and all the tables in that table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.condition]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function check if both tables is equal. &amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.empty]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function check is empty table or not.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.map]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function goes through a table and replaces every field with the return of the passed function, where the field's value is passed as first argument and optionally more arguments.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.random]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function retrieves a random variable from a table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.size]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Finds the absolute size of a table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[var dump]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function outputs information about one or more variables using outputConsole()&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[RGBToHex]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a string representing the color in hexadecimal.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[toHex]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts a decimal number to a hexadecimal number, as a fix to be used clientside.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[wavelengthToRGBA]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts a phisical wavelength of light to a RGBA color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[convertNumber]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts large numbers and adds commas to it. (Example: 100000 -&amp;gt; 100,000)&amp;lt;/span&amp;gt;&lt;br /&gt;
[[Category:Useful Functions]]&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Tocolor&amp;diff=34511</id>
		<title>Tocolor</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Tocolor&amp;diff=34511"/>
		<updated>2013-01-16T10:32:10Z</updated>

		<summary type="html">&lt;p&gt;Guix: /* The opposite function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}} &lt;br /&gt;
This function retrieves the hex number of a specified color, useful for the dx functions.&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 tocolor ( int red, int green, int blue [, int alpha = 255] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
* '''red:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space red] in the color (0-255).&lt;br /&gt;
* '''green:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space green] in the color (0-255).&lt;br /&gt;
* '''blue:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space blue] in the color (0-255).&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
* '''alpha:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space alpha] in the color (0-255).&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a single value representing the color.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example displays the text &amp;quot;Tuna&amp;quot; in small at the top left side of your screen. The color of this text can be changed using the command /tunaColor.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local tunaColor = tocolor(255, 0, 0, 255) -- Default color&lt;br /&gt;
&lt;br /&gt;
-- This function draws the text&lt;br /&gt;
local function drawTuna()&lt;br /&gt;
	dxDrawText(&amp;quot;Tuna&amp;quot;, 5, 5, 100, 100, tunaColor)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientRender&amp;quot;, root, drawTuna)&lt;br /&gt;
&lt;br /&gt;
--This function handles the /tunaColor command, allowing players to set the color of tuna&lt;br /&gt;
local function tunaColorCommand(command, red, green, blue, alpha)&lt;br /&gt;
	red, green, blue, alpha = tonumber(red), tonumber(green), tonumber(blue), tonumber(alpha) -- Convert all the args to numbers. NOTE: tonumber will return false if the arg is not provided/is not valid.&lt;br /&gt;
	&lt;br /&gt;
	-- Remind the user of the proper syntax if they failed to provide all the args&lt;br /&gt;
	if not red or not green or not blue then&lt;br /&gt;
		outputChatBox(&amp;quot;* USAGE: /tunaColor [red] [green] [blue] [alpha]&amp;quot;, 255, 0, 0)&lt;br /&gt;
		return&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Make the alpha arg optional&lt;br /&gt;
	if not alpha then&lt;br /&gt;
		alpha = 255&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Update the color&lt;br /&gt;
	tunaColor = tocolor(red, green, blue, alpha)&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;tunaColor&amp;quot;, tunaColorCommand)&lt;br /&gt;
-- Example /setcoloroftuna 255 0 0 255 - for red.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The opposite function== &lt;br /&gt;
This function is the opposite of tocolor, it turns a color back into R, G, B, A components.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function colorToRGBA( color )&lt;br /&gt;
&lt;br /&gt;
	local str = string.format( &amp;quot;%x&amp;quot;, color )&lt;br /&gt;
	&lt;br /&gt;
	return&lt;br /&gt;
		tonumber( &amp;quot;0x&amp;quot; .. str:sub( 3, 4 ) ),&lt;br /&gt;
		tonumber( &amp;quot;0x&amp;quot; .. str:sub( 5, 6 ) ),&lt;br /&gt;
		tonumber( &amp;quot;0x&amp;quot; .. str:sub( 7, 8 ) ),&lt;br /&gt;
		tonumber( &amp;quot;0x&amp;quot; .. str:sub( 1, 2 ) )&lt;br /&gt;
		&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- or&lt;br /&gt;
&lt;br /&gt;
function colorToRGBA( color )&lt;br /&gt;
&lt;br /&gt;
	local a, r, g, b = getColorFromString( string.format( &amp;quot;#%x&amp;quot;, color ) )&lt;br /&gt;
	&lt;br /&gt;
	return r, g, b, a&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local myColor = tocolor( 110, 180, 230 )&lt;br /&gt;
&lt;br /&gt;
local R, G, B, A = colorToRGBA( myColor )&lt;br /&gt;
-- R is 110, G is 180, B is 230, A is 255&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_utility_functions}}&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Tocolor&amp;diff=34510</id>
		<title>Tocolor</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Tocolor&amp;diff=34510"/>
		<updated>2013-01-16T10:31:29Z</updated>

		<summary type="html">&lt;p&gt;Guix: /* The opposite function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}} &lt;br /&gt;
This function retrieves the hex number of a specified color, useful for the dx functions.&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 tocolor ( int red, int green, int blue [, int alpha = 255] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
* '''red:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space red] in the color (0-255).&lt;br /&gt;
* '''green:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space green] in the color (0-255).&lt;br /&gt;
* '''blue:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space blue] in the color (0-255).&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
* '''alpha:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space alpha] in the color (0-255).&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a single value representing the color.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example displays the text &amp;quot;Tuna&amp;quot; in small at the top left side of your screen. The color of this text can be changed using the command /tunaColor.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local tunaColor = tocolor(255, 0, 0, 255) -- Default color&lt;br /&gt;
&lt;br /&gt;
-- This function draws the text&lt;br /&gt;
local function drawTuna()&lt;br /&gt;
	dxDrawText(&amp;quot;Tuna&amp;quot;, 5, 5, 100, 100, tunaColor)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientRender&amp;quot;, root, drawTuna)&lt;br /&gt;
&lt;br /&gt;
--This function handles the /tunaColor command, allowing players to set the color of tuna&lt;br /&gt;
local function tunaColorCommand(command, red, green, blue, alpha)&lt;br /&gt;
	red, green, blue, alpha = tonumber(red), tonumber(green), tonumber(blue), tonumber(alpha) -- Convert all the args to numbers. NOTE: tonumber will return false if the arg is not provided/is not valid.&lt;br /&gt;
	&lt;br /&gt;
	-- Remind the user of the proper syntax if they failed to provide all the args&lt;br /&gt;
	if not red or not green or not blue then&lt;br /&gt;
		outputChatBox(&amp;quot;* USAGE: /tunaColor [red] [green] [blue] [alpha]&amp;quot;, 255, 0, 0)&lt;br /&gt;
		return&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Make the alpha arg optional&lt;br /&gt;
	if not alpha then&lt;br /&gt;
		alpha = 255&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Update the color&lt;br /&gt;
	tunaColor = tocolor(red, green, blue, alpha)&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;tunaColor&amp;quot;, tunaColorCommand)&lt;br /&gt;
-- Example /setcoloroftuna 255 0 0 255 - for red.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The opposite function== &lt;br /&gt;
This function is the opposite of tocolor, it turns a color back into R, G, B, A components.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function colorToRGBA( color )&lt;br /&gt;
&lt;br /&gt;
	local str = string.format( &amp;quot;%x&amp;quot;, color )&lt;br /&gt;
	&lt;br /&gt;
	return&lt;br /&gt;
		tonumber( &amp;quot;0x&amp;quot; .. str:sub( 3, 4 ) ),&lt;br /&gt;
		tonumber( &amp;quot;0x&amp;quot; .. str:sub( 5, 6 ) ),&lt;br /&gt;
		tonumber( &amp;quot;0x&amp;quot; .. str:sub( 7, 8 ) ),&lt;br /&gt;
		tonumber( &amp;quot;0x&amp;quot; .. str:sub( 1, 2 ) )&lt;br /&gt;
		&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- or&lt;br /&gt;
&lt;br /&gt;
function colorToRGBA( color )&lt;br /&gt;
&lt;br /&gt;
	local a, r, g, b = getColorFromString( string.format( &amp;quot;#%x&amp;quot;, color ) )&lt;br /&gt;
	return r, g, b, a&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local myColor = tocolor( 110, 180, 230 )&lt;br /&gt;
&lt;br /&gt;
local R, G, B, A = colorToRGBA( myColor )&lt;br /&gt;
-- R is 110, G is 180, B is 230, A is 255&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_utility_functions}}&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Tocolor&amp;diff=34509</id>
		<title>Tocolor</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Tocolor&amp;diff=34509"/>
		<updated>2013-01-16T10:21:44Z</updated>

		<summary type="html">&lt;p&gt;Guix: /* The opposite function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}} &lt;br /&gt;
This function retrieves the hex number of a specified color, useful for the dx functions.&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 tocolor ( int red, int green, int blue [, int alpha = 255] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
* '''red:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space red] in the color (0-255).&lt;br /&gt;
* '''green:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space green] in the color (0-255).&lt;br /&gt;
* '''blue:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space blue] in the color (0-255).&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
* '''alpha:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space alpha] in the color (0-255).&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a single value representing the color.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example displays the text &amp;quot;Tuna&amp;quot; in small at the top left side of your screen. The color of this text can be changed using the command /tunaColor.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local tunaColor = tocolor(255, 0, 0, 255) -- Default color&lt;br /&gt;
&lt;br /&gt;
-- This function draws the text&lt;br /&gt;
local function drawTuna()&lt;br /&gt;
	dxDrawText(&amp;quot;Tuna&amp;quot;, 5, 5, 100, 100, tunaColor)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientRender&amp;quot;, root, drawTuna)&lt;br /&gt;
&lt;br /&gt;
--This function handles the /tunaColor command, allowing players to set the color of tuna&lt;br /&gt;
local function tunaColorCommand(command, red, green, blue, alpha)&lt;br /&gt;
	red, green, blue, alpha = tonumber(red), tonumber(green), tonumber(blue), tonumber(alpha) -- Convert all the args to numbers. NOTE: tonumber will return false if the arg is not provided/is not valid.&lt;br /&gt;
	&lt;br /&gt;
	-- Remind the user of the proper syntax if they failed to provide all the args&lt;br /&gt;
	if not red or not green or not blue then&lt;br /&gt;
		outputChatBox(&amp;quot;* USAGE: /tunaColor [red] [green] [blue] [alpha]&amp;quot;, 255, 0, 0)&lt;br /&gt;
		return&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Make the alpha arg optional&lt;br /&gt;
	if not alpha then&lt;br /&gt;
		alpha = 255&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Update the color&lt;br /&gt;
	tunaColor = tocolor(red, green, blue, alpha)&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;tunaColor&amp;quot;, tunaColorCommand)&lt;br /&gt;
-- Example /setcoloroftuna 255 0 0 255 - for red.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The opposite function== &lt;br /&gt;
This function is the opposite of tocolor, it turns a color back into R, G, B, A components.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local myColor = tocolor( 110, 180, 230 )&lt;br /&gt;
&lt;br /&gt;
function colorToRGBA( color )&lt;br /&gt;
&lt;br /&gt;
	local str = string.format( &amp;quot;%x&amp;quot;, color )&lt;br /&gt;
	&lt;br /&gt;
	return&lt;br /&gt;
		tonumber( &amp;quot;0x&amp;quot; .. str:sub( 3, 4 ) ),&lt;br /&gt;
		tonumber( &amp;quot;0x&amp;quot; .. str:sub( 5, 6 ) ),&lt;br /&gt;
		tonumber( &amp;quot;0x&amp;quot; .. str:sub( 7, 8 ) ),&lt;br /&gt;
		tonumber( &amp;quot;0x&amp;quot; .. str:sub( 1, 2 ) )&lt;br /&gt;
		&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local R, G, B, A = colorToRGBA( myColor )&lt;br /&gt;
-- R is 110, G is 180, B is 230, A is 255&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_utility_functions}}&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Tocolor&amp;diff=34508</id>
		<title>Tocolor</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Tocolor&amp;diff=34508"/>
		<updated>2013-01-16T10:13:22Z</updated>

		<summary type="html">&lt;p&gt;Guix: /* The opposite function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}} &lt;br /&gt;
This function retrieves the hex number of a specified color, useful for the dx functions.&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 tocolor ( int red, int green, int blue [, int alpha = 255] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
* '''red:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space red] in the color (0-255).&lt;br /&gt;
* '''green:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space green] in the color (0-255).&lt;br /&gt;
* '''blue:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space blue] in the color (0-255).&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
* '''alpha:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space alpha] in the color (0-255).&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a single value representing the color.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example displays the text &amp;quot;Tuna&amp;quot; in small at the top left side of your screen. The color of this text can be changed using the command /tunaColor.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local tunaColor = tocolor(255, 0, 0, 255) -- Default color&lt;br /&gt;
&lt;br /&gt;
-- This function draws the text&lt;br /&gt;
local function drawTuna()&lt;br /&gt;
	dxDrawText(&amp;quot;Tuna&amp;quot;, 5, 5, 100, 100, tunaColor)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientRender&amp;quot;, root, drawTuna)&lt;br /&gt;
&lt;br /&gt;
--This function handles the /tunaColor command, allowing players to set the color of tuna&lt;br /&gt;
local function tunaColorCommand(command, red, green, blue, alpha)&lt;br /&gt;
	red, green, blue, alpha = tonumber(red), tonumber(green), tonumber(blue), tonumber(alpha) -- Convert all the args to numbers. NOTE: tonumber will return false if the arg is not provided/is not valid.&lt;br /&gt;
	&lt;br /&gt;
	-- Remind the user of the proper syntax if they failed to provide all the args&lt;br /&gt;
	if not red or not green or not blue then&lt;br /&gt;
		outputChatBox(&amp;quot;* USAGE: /tunaColor [red] [green] [blue] [alpha]&amp;quot;, 255, 0, 0)&lt;br /&gt;
		return&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Make the alpha arg optional&lt;br /&gt;
	if not alpha then&lt;br /&gt;
		alpha = 255&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Update the color&lt;br /&gt;
	tunaColor = tocolor(red, green, blue, alpha)&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;tunaColor&amp;quot;, tunaColorCommand)&lt;br /&gt;
-- Example /setcoloroftuna 255 0 0 255 - for red.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The opposite function== &lt;br /&gt;
This function is the opposite of tocolor, it turns a color back into R, G, B, A components.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local myColor = tocolor( 110, 180, 230 )&lt;br /&gt;
&lt;br /&gt;
function fromColor( color )&lt;br /&gt;
&lt;br /&gt;
	local str = string.format( &amp;quot;%x&amp;quot;, color )&lt;br /&gt;
	&lt;br /&gt;
	return&lt;br /&gt;
		tonumber( &amp;quot;0x&amp;quot; .. str:sub( 3, 4 ) ),&lt;br /&gt;
		tonumber( &amp;quot;0x&amp;quot; .. str:sub( 5, 6 ) ),&lt;br /&gt;
		tonumber( &amp;quot;0x&amp;quot; .. str:sub( 7, 8 ) ),&lt;br /&gt;
		tonumber( &amp;quot;0x&amp;quot; .. str:sub( 1, 2 ) )&lt;br /&gt;
		&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local R, G, B, A = fromColor( myColor )&lt;br /&gt;
-- R is 110, G is 180, B is 230, A is 255&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_utility_functions}}&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Tocolor&amp;diff=34506</id>
		<title>Tocolor</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Tocolor&amp;diff=34506"/>
		<updated>2013-01-15T23:33:58Z</updated>

		<summary type="html">&lt;p&gt;Guix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}} &lt;br /&gt;
This function retrieves the hex number of a specified color, useful for the dx functions.&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 tocolor ( int red, int green, int blue [, int alpha = 255] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
* '''red:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space red] in the color (0-255).&lt;br /&gt;
* '''green:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space green] in the color (0-255).&lt;br /&gt;
* '''blue:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space blue] in the color (0-255).&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
* '''alpha:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space alpha] in the color (0-255).&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a single value representing the color.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example displays the text &amp;quot;Tuna&amp;quot; in small at the top left side of your screen. The color of this text can be changed using the command /tunaColor.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local tunaColor = tocolor(255, 0, 0, 255) -- Default color&lt;br /&gt;
&lt;br /&gt;
-- This function draws the text&lt;br /&gt;
local function drawTuna()&lt;br /&gt;
	dxDrawText(&amp;quot;Tuna&amp;quot;, 5, 5, 100, 100, tunaColor)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientRender&amp;quot;, root, drawTuna)&lt;br /&gt;
&lt;br /&gt;
--This function handles the /tunaColor command, allowing players to set the color of tuna&lt;br /&gt;
local function tunaColorCommand(command, red, green, blue, alpha)&lt;br /&gt;
	red, green, blue, alpha = tonumber(red), tonumber(green), tonumber(blue), tonumber(alpha) -- Convert all the args to numbers. NOTE: tonumber will return false if the arg is not provided/is not valid.&lt;br /&gt;
	&lt;br /&gt;
	-- Remind the user of the proper syntax if they failed to provide all the args&lt;br /&gt;
	if not red or not green or not blue then&lt;br /&gt;
		outputChatBox(&amp;quot;* USAGE: /tunaColor [red] [green] [blue] [alpha]&amp;quot;, 255, 0, 0)&lt;br /&gt;
		return&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Make the alpha arg optional&lt;br /&gt;
	if not alpha then&lt;br /&gt;
		alpha = 255&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Update the color&lt;br /&gt;
	tunaColor = tocolor(red, green, blue, alpha)&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;tunaColor&amp;quot;, tunaColorCommand)&lt;br /&gt;
-- Example /setcoloroftuna 255 0 0 255 - for red.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The opposite function== &lt;br /&gt;
This function is the opposite of tocolor, it turns a color back into R, G, B, A components.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local myColor = tocolor( 110, 180, 230 )&lt;br /&gt;
&lt;br /&gt;
function fromColor( color )&lt;br /&gt;
	&lt;br /&gt;
	return&lt;br /&gt;
		math.floor( color / 65536 ) % 256,&lt;br /&gt;
		math.floor( color / 256 ) % 256,&lt;br /&gt;
		color % 256,&lt;br /&gt;
		math.floor( color / 16777216 ) % 256&lt;br /&gt;
	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local R, G, B, A = fromColor( myColor )&lt;br /&gt;
-- R is 110, G is 180, B is 230, A is 255&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_utility_functions}}&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Tocolor&amp;diff=34505</id>
		<title>Tocolor</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Tocolor&amp;diff=34505"/>
		<updated>2013-01-15T22:38:59Z</updated>

		<summary type="html">&lt;p&gt;Guix: /* The opposite function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}} &lt;br /&gt;
This function retrieves the hex number of a specified color, useful for the dx functions.&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 tocolor ( int red, int green, int blue [, int alpha = 255] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
* '''red:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space red] in the color (0-255).&lt;br /&gt;
* '''green:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space green] in the color (0-255).&lt;br /&gt;
* '''blue:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space blue] in the color (0-255).&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
* '''alpha:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space alpha] in the color (0-255).&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a single value representing the color.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example displays the text &amp;quot;Tuna&amp;quot; in small at the top left side of your screen. The color of this text can be changed using the command /tunaColor.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local tunaColor = tocolor(255, 0, 0, 255) -- Default color&lt;br /&gt;
&lt;br /&gt;
-- This function draws the text&lt;br /&gt;
local function drawTuna()&lt;br /&gt;
	dxDrawText(&amp;quot;Tuna&amp;quot;, 5, 5, 100, 100, tunaColor)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientRender&amp;quot;, root, drawTuna)&lt;br /&gt;
&lt;br /&gt;
--This function handles the /tunaColor command, allowing players to set the color of tuna&lt;br /&gt;
local function tunaColorCommand(command, red, green, blue, alpha)&lt;br /&gt;
	red, green, blue, alpha = tonumber(red), tonumber(green), tonumber(blue), tonumber(alpha) -- Convert all the args to numbers. NOTE: tonumber will return false if the arg is not provided/is not valid.&lt;br /&gt;
	&lt;br /&gt;
	-- Remind the user of the proper syntax if they failed to provide all the args&lt;br /&gt;
	if not red or not green or not blue then&lt;br /&gt;
		outputChatBox(&amp;quot;* USAGE: /tunaColor [red] [green] [blue] [alpha]&amp;quot;, 255, 0, 0)&lt;br /&gt;
		return&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Make the alpha arg optional&lt;br /&gt;
	if not alpha then&lt;br /&gt;
		alpha = 255&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Update the color&lt;br /&gt;
	tunaColor = tocolor(red, green, blue, alpha)&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;tunaColor&amp;quot;, tunaColorCommand)&lt;br /&gt;
-- Example /setcoloroftuna 255 0 0 255 - for red.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The opposite function== &lt;br /&gt;
This function is the opposite of toColor, it turns a color back into R, G, B, A components.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local myColor = tocolor( 110, 180, 230 )&lt;br /&gt;
&lt;br /&gt;
function fromColor( color )&lt;br /&gt;
	&lt;br /&gt;
	return&lt;br /&gt;
		math.floor( color / 65536 ) % 256,&lt;br /&gt;
		math.floor( color / 256 ) % 256,&lt;br /&gt;
		color % 256,&lt;br /&gt;
		math.floor( color / 16777216 ) % 256&lt;br /&gt;
	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local R, G, B, A = fromColor( myColor )&lt;br /&gt;
-- R is 110, G is 180, B is 230, A is 255&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_utility_functions}}&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Tocolor&amp;diff=34504</id>
		<title>Tocolor</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Tocolor&amp;diff=34504"/>
		<updated>2013-01-15T22:36:56Z</updated>

		<summary type="html">&lt;p&gt;Guix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}} &lt;br /&gt;
This function retrieves the hex number of a specified color, useful for the dx functions.&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 tocolor ( int red, int green, int blue [, int alpha = 255] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
* '''red:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space red] in the color (0-255).&lt;br /&gt;
* '''green:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space green] in the color (0-255).&lt;br /&gt;
* '''blue:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space blue] in the color (0-255).&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
* '''alpha:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space alpha] in the color (0-255).&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a single value representing the color.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example displays the text &amp;quot;Tuna&amp;quot; in small at the top left side of your screen. The color of this text can be changed using the command /tunaColor.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local tunaColor = tocolor(255, 0, 0, 255) -- Default color&lt;br /&gt;
&lt;br /&gt;
-- This function draws the text&lt;br /&gt;
local function drawTuna()&lt;br /&gt;
	dxDrawText(&amp;quot;Tuna&amp;quot;, 5, 5, 100, 100, tunaColor)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientRender&amp;quot;, root, drawTuna)&lt;br /&gt;
&lt;br /&gt;
--This function handles the /tunaColor command, allowing players to set the color of tuna&lt;br /&gt;
local function tunaColorCommand(command, red, green, blue, alpha)&lt;br /&gt;
	red, green, blue, alpha = tonumber(red), tonumber(green), tonumber(blue), tonumber(alpha) -- Convert all the args to numbers. NOTE: tonumber will return false if the arg is not provided/is not valid.&lt;br /&gt;
	&lt;br /&gt;
	-- Remind the user of the proper syntax if they failed to provide all the args&lt;br /&gt;
	if not red or not green or not blue then&lt;br /&gt;
		outputChatBox(&amp;quot;* USAGE: /tunaColor [red] [green] [blue] [alpha]&amp;quot;, 255, 0, 0)&lt;br /&gt;
		return&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Make the alpha arg optional&lt;br /&gt;
	if not alpha then&lt;br /&gt;
		alpha = 255&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Update the color&lt;br /&gt;
	tunaColor = tocolor(red, green, blue, alpha)&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;tunaColor&amp;quot;, tunaColorCommand)&lt;br /&gt;
-- Example /setcoloroftuna 255 0 0 255 - for red.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The opposite function== &lt;br /&gt;
This function is the opposite of toColor, it turns a color back into R, G, B, A components.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local myColor = tocolor( 110, 180, 230 )&lt;br /&gt;
&lt;br /&gt;
function fromColor( color )&lt;br /&gt;
	&lt;br /&gt;
	return&lt;br /&gt;
		math.floor( color / 65536 % 256 ),&lt;br /&gt;
		math.floor( color / 256 % 256 ),&lt;br /&gt;
		color % 256,&lt;br /&gt;
		math.floor( color / 16777216 % 256 )&lt;br /&gt;
	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local R, G, B, A = fromColor( myColor )&lt;br /&gt;
-- R is 110, G is 180, B is 230, A is 255&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_utility_functions}}&lt;/div&gt;</summary>
		<author><name>Guix</name></author>
	</entry>
</feed>