<?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=MrFredo</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=MrFredo"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/MrFredo"/>
	<updated>2026-05-23T13:06:02Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&amp;diff=25304</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=25304"/>
		<updated>2011-02-01T09:42:10Z</updated>

		<summary type="html">&lt;p&gt;MrFredo: &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;
&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;
&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;
&lt;br /&gt;
*[[doForAllElements]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function can be used to execute a specified function for all elements of a specified type.&amp;lt;/span&amp;gt;&lt;br /&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;
&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;
&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;
&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;
&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;
&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 [http://en.wikipedia.org/wiki/Unix_time UNIX timestamp].&amp;lt;/span&amp;gt;&lt;br /&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;
&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;
&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;
&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;
&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;
&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;
&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;
&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;
&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;
&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;
&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;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Useful Functions]]&lt;/div&gt;</summary>
		<author><name>MrFredo</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=RGBToHex&amp;diff=25303</id>
		<title>RGBToHex</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=RGBToHex&amp;diff=25303"/>
		<updated>2011-02-01T09:38:45Z</updated>

		<summary type="html">&lt;p&gt;MrFredo: Created page with &amp;quot;{{Useful Function}} &amp;lt;lowercasetitle&amp;gt;&amp;lt;/lowercasetitle&amp;gt; __NOTOC__ This function retrieves the hex string of a specified color.  ==Syntax== &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; string RGBToHex ( int red, ...&amp;quot;&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 hex string of a specified color.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
string RGBToHex ( 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 string representing the color in hexadecimal.&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 RGBToHex(red, green, blue, alpha)&lt;br /&gt;
	if((red &amp;lt; 0 or red &amp;gt; 255 or green &amp;lt; 0 or green &amp;gt; 255 or blue &amp;lt; 0 or blue &amp;gt; 255) or (alpha and (alpha &amp;lt; 0 or alpha &amp;gt; 255))) then&lt;br /&gt;
		return nil&lt;br /&gt;
	end&lt;br /&gt;
	if(alpha) then&lt;br /&gt;
		return string.format(&amp;quot;#%.2X%.2X%.2X%.2X&amp;quot;, red,green,blue,alpha)&lt;br /&gt;
	else&lt;br /&gt;
		return string.format(&amp;quot;#%.2X%.2X%.2X&amp;quot;, red,green,blue)&lt;br /&gt;
	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;
==See Also==&lt;br /&gt;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>MrFredo</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:Player_events&amp;diff=25290</id>
		<title>Template:Player events</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Template:Player_events&amp;diff=25290"/>
		<updated>2011-01-31T14:20:29Z</updated>

		<summary type="html">&lt;p&gt;MrFredo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[onPlayerBan]]&lt;br /&gt;
*[[onPlayerChat]]&lt;br /&gt;
*[[onPlayerPrivateMessage]]&lt;br /&gt;
*[[onPlayerConnect]]&lt;br /&gt;
*[[onPlayerChangeNick]]&lt;br /&gt;
*[[onPlayerLogin]]&lt;br /&gt;
*[[onPlayerLogout]]&lt;br /&gt;
*[[onPlayerDamage]]&lt;br /&gt;
*[[onPlayerJoin]]&lt;br /&gt;
*[[onPlayerQuit]]&lt;br /&gt;
*[[onPlayerSpawn]]&lt;br /&gt;
*[[onPlayerWasted]]&lt;br /&gt;
*[[onPlayerTarget]]&lt;br /&gt;
*[[onPlayerVehicleEnter]]&lt;br /&gt;
*[[onPlayerVehicleExit]]&lt;br /&gt;
*[[onPlayerWeaponSwitch]]&lt;br /&gt;
*[[onPlayerMarkerHit]]&lt;br /&gt;
*[[onPlayerMarkerLeave]]&lt;br /&gt;
*[[onPlayerPickupHit]]&lt;br /&gt;
*[[onPlayerPickupUse]]&lt;br /&gt;
*[[onPlayerClick]]&lt;br /&gt;
*[[onPlayerContact]]&lt;br /&gt;
*[[onPlayerStealthKill]]&lt;br /&gt;
{{New feature|3.0110|1.1|&lt;br /&gt;
*[[onPlayerMute]]&lt;br /&gt;
*[[onPlayerUnmute]]&lt;br /&gt;
*[[onPlayerCommand]]&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>MrFredo</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnPlayerCommand&amp;diff=25289</id>
		<title>OnPlayerCommand</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnPlayerCommand&amp;diff=25289"/>
		<updated>2011-01-31T14:18:57Z</updated>

		<summary type="html">&lt;p&gt;MrFredo: Created page with &amp;quot;__NOTOC__ {{Server event}} This event is triggered when a player chats inside the chat box.  '''''Note:''' This event triggers regardless of whether the command exists or not. Al...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server event}}&lt;br /&gt;
This event is triggered when a player chats inside the chat box.&lt;br /&gt;
&lt;br /&gt;
'''''Note:''' This event triggers regardless of whether the command exists or not. Also, typing anything in chat will execute command &amp;quot;say&amp;quot;, so this event will be triggered on every chat message as well.&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
string command&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the [[player]] who tried to execute a command&lt;br /&gt;
&lt;br /&gt;
==Cancel effect==&lt;br /&gt;
The command will not be executed&lt;br /&gt;
&lt;br /&gt;
{{See also/Server event|Player events}}&lt;/div&gt;</summary>
		<author><name>MrFredo</name></author>
	</entry>
</feed>