<?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=TopAz</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=TopAz"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/TopAz"/>
	<updated>2026-05-22T07:05:39Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Switch&amp;diff=29840</id>
		<title>Switch</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Switch&amp;diff=29840"/>
		<updated>2012-04-02T06:27:12Z</updated>

		<summary type="html">&lt;p&gt;TopAz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Useful Function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function allow the value of a variable or expression to control the flow of program execution via a multiway branch.&lt;br /&gt;
&lt;br /&gt;
''Note: This function is basically on the wiki to enable using it in other useful functions.''&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;var switch( arg )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''arg''': The expression to compare.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns false if failed.&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server- and/or clientside Script&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 switch(arg)&lt;br /&gt;
        if(type(arg)~=&amp;quot;table&amp;quot;)then return switch end&lt;br /&gt;
        local switching, default, done; --Default is nil&lt;br /&gt;
        if(tostring(arg[1]):len()&amp;lt;=2)and(tostring(arg[2]):len()&amp;lt;=2)then switching=arg[1] end&lt;br /&gt;
        table.remove(arg, 1);&lt;br /&gt;
        for i=1, #arg do&lt;br /&gt;
                if(tostring(arg[i]):len()&amp;lt;=3)and(arg[i]==switching)then&lt;br /&gt;
                        if(type(arg[i+1])==&amp;quot;function&amp;quot;)then&lt;br /&gt;
                                pcall(arg[i+1])&lt;br /&gt;
                                done=true;&lt;br /&gt;
                                break&lt;br /&gt;
                        else&lt;br /&gt;
                                break&lt;br /&gt;
                        end&lt;br /&gt;
                end&lt;br /&gt;
                if(arg[i]==nil)and(arg[i]==switching)and(type(arg[i+1])==&amp;quot;function&amp;quot;)then pcall(arg[i+1]) end&lt;br /&gt;
        end&lt;br /&gt;
        if(not done)then print(&amp;quot;No action.&amp;quot;) end&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;
==Example==&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 compares a variable value and print out the result.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
Player = 0 -- The variable to compare&lt;br /&gt;
switch -- Using the function&lt;br /&gt;
{ -- Using curly braces as it's a table&lt;br /&gt;
Player; -- Put the expression to compare in here and don't forget to end it with a semi-colon&lt;br /&gt;
	0, function() print(&amp;quot;It's 0&amp;quot;) end, -- [ compare the value, do the function ] The first argument compares the value and the second execute the command inside the function if that compare is true.&lt;br /&gt;
	1, function() print(&amp;quot;It's 1&amp;quot;) end,&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Author: TopAz&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>TopAz</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Switch&amp;diff=29839</id>
		<title>Switch</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Switch&amp;diff=29839"/>
		<updated>2012-04-02T06:09:50Z</updated>

		<summary type="html">&lt;p&gt;TopAz: Created page with &amp;quot;{{Useful Function}} __NOTOC__ This function allow the value of a variable or expression to control the flow of program execution via a multiway branch.  ''Note: This function is ...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Useful Function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function allow the value of a variable or expression to control the flow of program execution via a multiway branch.&lt;br /&gt;
&lt;br /&gt;
''Note: This function is basically on the wiki to enable using it in other useful functions.''&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;var switch( arg )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''arg''': The expression to compare.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns false if failed.&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server- and/or clientside Script&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 table.size(tab)&lt;br /&gt;
        if(not type(tab)==&amp;quot;table&amp;quot;)then return end&lt;br /&gt;
        local ret_size = 0;&lt;br /&gt;
        for _,_ in pairs(tab) do ret_size=ret_size+1; end&lt;br /&gt;
        return ret_size&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function switch(arg)&lt;br /&gt;
        if(type(arg)~=&amp;quot;table&amp;quot;)then return switch end&lt;br /&gt;
        local switching, default, done; --Default is nil&lt;br /&gt;
        if(tostring(arg[1]):len()&amp;lt;=2)and(tostring(arg[2]):len()&amp;lt;=2)then switching=arg[1] end&lt;br /&gt;
        table.remove(arg, 1);&lt;br /&gt;
        for i=1, table.size(arg) do&lt;br /&gt;
                if(tostring(arg[i]):len()&amp;lt;=3)and(arg[i]==switching)then&lt;br /&gt;
                        if(type(arg[i+1])==&amp;quot;function&amp;quot;)then&lt;br /&gt;
                                pcall(arg[i+1])&lt;br /&gt;
                                done=true;&lt;br /&gt;
                                break&lt;br /&gt;
                        else&lt;br /&gt;
                                break&lt;br /&gt;
                        end&lt;br /&gt;
                end&lt;br /&gt;
                if(arg[i]==nil)and(arg[i]==switching)and(type(arg[i+1])==&amp;quot;function&amp;quot;)then pcall(arg[i+1]) end&lt;br /&gt;
        end&lt;br /&gt;
        if(not done)then print(&amp;quot;No action.&amp;quot;) end&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;
==Example==&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 compares a variable value and print out the result.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
Player = 0 -- The variable to compare&lt;br /&gt;
switch -- Using the function&lt;br /&gt;
{ -- Using curly braces as it's a table&lt;br /&gt;
Player; -- Put the expression to compare in here and don't forget to end it with a semi-colon&lt;br /&gt;
	0, function() print(&amp;quot;It's 0&amp;quot;) end, -- [ compare the value, do the function ] The first argument compares the value and the second execute the command inside the function if that compare is true.&lt;br /&gt;
	1, function() print(&amp;quot;It's 1&amp;quot;) end,&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Author: TopAz&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>TopAz</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=User:TopAz&amp;diff=27536</id>
		<title>User:TopAz</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=User:TopAz&amp;diff=27536"/>
		<updated>2011-11-01T09:58:21Z</updated>

		<summary type="html">&lt;p&gt;TopAz: Created page with &amp;quot;__TOC__   == Game Modes == N/A  == Maps == N/A  == Scripts == N/A  == Shaders == [http://community.mtasa.com/index.php?p=resources&amp;amp;s=details&amp;amp;id=3139| Black White] - Black and Whi...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Game Modes ==&lt;br /&gt;
N/A&lt;br /&gt;
&lt;br /&gt;
== Maps ==&lt;br /&gt;
N/A&lt;br /&gt;
&lt;br /&gt;
== Scripts ==&lt;br /&gt;
N/A&lt;br /&gt;
&lt;br /&gt;
== Shaders ==&lt;br /&gt;
[http://community.mtasa.com/index.php?p=resources&amp;amp;s=details&amp;amp;id=3139| Black White] - Black and White Shader Effect which will change the graphics to Black and White. View the screenshot for clear detail.&lt;/div&gt;</summary>
		<author><name>TopAz</name></author>
	</entry>
</feed>