<?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=Funstein</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=Funstein"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/Funstein"/>
	<updated>2026-04-26T10:22:21Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetElementVisibleTo&amp;diff=36969</id>
		<title>SetElementVisibleTo</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetElementVisibleTo&amp;diff=36969"/>
		<updated>2013-08-26T07:42:42Z</updated>

		<summary type="html">&lt;p&gt;Funstein: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
This function can change an [[element]]'s [[visibility]]. This does not work with all entities - [[vehicle]]s, [[player]]s and [[object]]s are exempt. This is because these objects are required for accurate sync (they're physical objects). This function is particularly useful for changing the visibility of markers, radar blips and radar areas.&lt;br /&gt;
&lt;br /&gt;
Visibility settings of lower elements in the element tree override higher ones - if visibility for root is set to false and for a player is set to true, it will be visible to the player.&lt;br /&gt;
&lt;br /&gt;
If you want to clear all visibility settings of an object, try [[clearElementVisibleTo]]&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 setElementVisibleTo ( element theElement, element visibleTo, bool visible )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theElement:''' The element you want to control the visibility of.&lt;br /&gt;
*'''visibleTo:''' The element you wish the element to be visible or invisible to. Any child elements that are players will also be able to see the element. See [[visibility]].&lt;br /&gt;
*'''visible:''' Whether you are making it visible or invisible to the player.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the element's visibility was changed successfully, ''false'' otherwise, for example if you are trying to change the visibility of a vehicle, player or object.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example creates a marker and makes it only visibile to the player called 'someguy'.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Find the player called someguy&lt;br /&gt;
local someguy = getPlayerFromName ( &amp;quot;someguy&amp;quot; )&lt;br /&gt;
-- If the player was found then&lt;br /&gt;
if ( someguy ) then&lt;br /&gt;
	-- Get the player's position into the variables x, y and z&lt;br /&gt;
	x, y, z = getElementPosition ( someguy )&lt;br /&gt;
	-- Create a marker at the player's position&lt;br /&gt;
	myMarker = createMarker ( x, y, z )&lt;br /&gt;
	-- Set marker visibility to true for someguy&lt;br /&gt;
	setElementVisibleTo ( myMarker, someguy, true )&lt;br /&gt;
	-- Then make the marker invisible to the whole dimension&lt;br /&gt;
	setElementVisibleTo ( myMarker, root, false )&lt;br /&gt;
	&lt;br /&gt;
	-- The order in which you do the visibility changes does not matter, but ideally trues should be set before falses in order to prevent a momentary flicker.&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following example shows how to make the marker visible to everyone except anotherguy&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Find the player called someguy&lt;br /&gt;
local someguy = getPlayerFromName ( &amp;quot;someguy&amp;quot; )&lt;br /&gt;
local anotherguy = getPlayerFromName ( &amp;quot;anotherguy&amp;quot; )&lt;br /&gt;
-- If the player was found then&lt;br /&gt;
if ( someguy ) then&lt;br /&gt;
	-- Get the player's position into the variables x, y and z&lt;br /&gt;
	x, y, z = getElementPosition ( someguy )&lt;br /&gt;
	-- Create a marker at the player's position&lt;br /&gt;
	myMarker = createMarker ( x, y, z )&lt;br /&gt;
	attachElements(myMarker, someguy)&lt;br /&gt;
&lt;br /&gt;
	-- First make sure everyone is able to see the marker, this line is unnecessary in this case as root visibility is set to true by default behaviour&lt;br /&gt;
	setElementVisibleTo ( myMarker, root, true )&lt;br /&gt;
&lt;br /&gt;
	-- Then hide it from anotherguy&lt;br /&gt;
	setElementVisibleTo ( myMarker, anotherguy, false )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Element_functions}}&lt;/div&gt;</summary>
		<author><name>Funstein</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetVehicleOccupants&amp;diff=36834</id>
		<title>GetVehicleOccupants</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetVehicleOccupants&amp;diff=36834"/>
		<updated>2013-08-06T20:23:00Z</updated>

		<summary type="html">&lt;p&gt;Funstein: Made example prettier&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function gets all players sitting in the specified vehicle.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
table getVehicleOccupants ( vehicle theVehicle )            &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theVehicle:''' The vehicle of which you wish to retrieve the occupants.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a [[table]] with contents...&lt;br /&gt;
&lt;br /&gt;
table[seat] = occupant&lt;br /&gt;
&lt;br /&gt;
... if successful. Returns ''false'' in the case of failure.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' Don't use an ipairs loop with the table returned by this function. It will skip the driver, as ipairs starts at 1 and the driver seat is ID 0. And if there's an empty seat, ipairs will stop looping. You should use a pairs loop instead.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example prints all vehicle occupants into the F8 console if &amp;quot;/occupants&amp;quot; is typed:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function outputOccupants(player)&lt;br /&gt;
    if isPedInVehicle(player) then -- If he is actually in a vehicle...&lt;br /&gt;
        outputConsole(&amp;quot;------------------------------------&amp;quot;, player) -- Print a seprerator for easier reading&lt;br /&gt;
        for seat, occupant in pairs(getVehicleOccupants(getPedOccupiedVehicle(player))) do -- Loop through the array&lt;br /&gt;
            if getElementType(occupant) == &amp;quot;player&amp;quot; then&lt;br /&gt;
                outputConsole(&amp;quot;Seat &amp;quot; .. seat .. &amp;quot;: &amp;quot; .. getPlayerName(occupant), player) -- Print who's in the seat&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
        outputConsole(&amp;quot;------------------------------------&amp;quot;,player) -- Print another seprerator&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;occupants&amp;quot;,outputOccupants) -- Add a command &amp;quot;/occupants&amp;quot; which triggers outputOccupants&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Vehicle_functions}}&lt;/div&gt;</summary>
		<author><name>Funstein</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetElementZoneName&amp;diff=34902</id>
		<title>GetElementZoneName</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetElementZoneName&amp;diff=34902"/>
		<updated>2013-02-16T11:56:02Z</updated>

		<summary type="html">&lt;p&gt;Funstein: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function allows you to retrieve the zone name of an element (eg. Verdant Bluffs or Ocean Docks)&lt;br /&gt;
&lt;br /&gt;
The same can be achieved client side by getting element coordinates and using [[GetZoneName]].&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 getElementZoneName ( element theElement, [bool citiesonly=false] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''theElement:''' The element which you'd like to retrieve the zone name from&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
{{OptionalArg}}&lt;br /&gt;
*'''citiesonly''': An optional argument to choose if you want to return the city name (eg Las Venturas)&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the string of the elements zone name.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example shows you how to return your own location by doing /loc in the chatbox or just loc in console&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function playerloc ( source )&lt;br /&gt;
    local playername = getPlayerName ( source )&lt;br /&gt;
    local location = getElementZoneName ( source )&lt;br /&gt;
    outputChatBox ( &amp;quot;* &amp;quot; .. playername .. &amp;quot;'s Location: &amp;quot; .. location, getRootElement(), 0, 255, 255 ) -- Output the player's name and zone name&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;loc&amp;quot;, playerloc )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Element functions}}&lt;/div&gt;</summary>
		<author><name>Funstein</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&amp;diff=34423</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=34423"/>
		<updated>2013-01-08T16:48:54Z</updated>

		<summary type="html">&lt;p&gt;Funstein: &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;
*[[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>Funstein</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=IsPedAiming&amp;diff=34422</id>
		<title>IsPedAiming</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=IsPedAiming&amp;diff=34422"/>
		<updated>2013-01-08T16:46:45Z</updated>

		<summary type="html">&lt;p&gt;Funstein: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Useful Function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function checks if a ped is aiming. Returns true if yes and false if not.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''Important : ONLY WORKS CLIENT SIDE.'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool isPedAiming ( ped thePedToCheck )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''thePedToCheck''': The ped element.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns true if ped is aiming a weapon, false if not.&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Clientside script&amp;quot; class=&amp;quot;client&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 isPedAiming ( thePedToCheck )&lt;br /&gt;
	if isElement(thePedToCheck) then&lt;br /&gt;
		if getElementType(thePedToCheck) == &amp;quot;player&amp;quot; or getElementType(thePedToCheck) == &amp;quot;ped&amp;quot; then&lt;br /&gt;
			if getPedTask(thePedToCheck, &amp;quot;secondary&amp;quot;, 0) == &amp;quot;TASK_SIMPLE_USE_GUN&amp;quot; then&lt;br /&gt;
				return true&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return false&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;
The example outputs if the player is aiming a gun when the player presses b.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function checkAim()&lt;br /&gt;
	if isPedAiming(localPlayer) then&lt;br /&gt;
		outputChatBox(&amp;quot;Aiming&amp;quot;)&lt;br /&gt;
	else&lt;br /&gt;
		outputChatBox(&amp;quot;Not aiming&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
bindKey(&amp;quot;b&amp;quot;, &amp;quot;down&amp;quot;, checkAim)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>Funstein</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=IsPedAiming&amp;diff=34421</id>
		<title>IsPedAiming</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=IsPedAiming&amp;diff=34421"/>
		<updated>2013-01-08T16:39:11Z</updated>

		<summary type="html">&lt;p&gt;Funstein: Created page with &amp;quot;{{Useful Function}} __NOTOC__ This function checks if a ped is aiming. Returns true if yes and false if not. &amp;lt;br&amp;gt; '''ONLY WORKS CLIENT SIDE''' &amp;lt;br&amp;gt;  ==Syntax== &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool ...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Useful Function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function checks if a ped is aiming. Returns true if yes and false if not.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''ONLY WORKS CLIENT SIDE'''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool isPedAiming ( ped thePedToCheck )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''thePedToCheck''': The ped element.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns true if ped is aiming a weapon, false if not.&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Clientside script&amp;quot; class=&amp;quot;client&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 isPedAiming ( thePedToCheck )&lt;br /&gt;
	if isElement(thePedToCheck) then&lt;br /&gt;
		if getElementType(thePedToCheck) == &amp;quot;player&amp;quot; or getElementType(thePedToCheck) == &amp;quot;ped&amp;quot; then&lt;br /&gt;
			if getPedTask(thePedToCheck, &amp;quot;secondary&amp;quot;, 0) == &amp;quot;TASK_SIMPLE_USE_GUN&amp;quot; then&lt;br /&gt;
				return true&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return false&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;
No example &amp;gt;:(&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>Funstein</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:Client_input_functions&amp;diff=34420</id>
		<title>Template:Client input functions</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Template:Client_input_functions&amp;diff=34420"/>
		<updated>2013-01-07T19:01:20Z</updated>

		<summary type="html">&lt;p&gt;Funstein: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[bindKey]]&lt;br /&gt;
*[[unbindKey]]&lt;br /&gt;
*[[getKeyState]]&lt;br /&gt;
{{New items|3.0004|1.0.4|&lt;br /&gt;
*[[getCommandsBoundToKey]]&lt;br /&gt;
*[[getFunctionsBoundToKey]]&lt;br /&gt;
*[[getKeyBoundToCommand]]&lt;br /&gt;
*[[getKeyBoundToFunction]]&lt;br /&gt;
}}&lt;br /&gt;
*[[getControlState]]&lt;br /&gt;
*[[isControlEnabled]]&lt;br /&gt;
*[[setControlState]]&lt;br /&gt;
*[[toggleControl]]&lt;br /&gt;
*[[toggleAllControls]]&lt;br /&gt;
*[[getCursorPosition]]&lt;br /&gt;
*[[addCommandHandler]]&lt;br /&gt;
*[[removeCommandHandler]]&lt;br /&gt;
*[[executeCommandHandler]]&lt;br /&gt;
*[[getBoundKeys]]&lt;br /&gt;
*[[getAnalogControlState]]&lt;br /&gt;
&amp;lt;noinclude&amp;gt;[[Category:Functions templates]]&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Funstein</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetCursorPosition&amp;diff=34419</id>
		<title>GetCursorPosition</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetCursorPosition&amp;diff=34419"/>
		<updated>2013-01-07T19:01:00Z</updated>

		<summary type="html">&lt;p&gt;Funstein: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function gets the current position of the mouse cursor. Note that for performance reasons, the world position returned is always 300 units away. If you want the exact world point (similar to [[onClientClick]]), use [[processLineOfSight]] between the camera position and the worldX/Y/Z result of this function. (See example below)&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 float float float float getCursorPosition ( )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns 5 values: ''cursorX'', ''cursorY'', ''worldX'', ''worldY'', ''worldZ''. The first two values are the 2D relative screen coordinates of the cursor: ''cursorX'' goes from 0 (left side of the screen) to 1 (right side), ''cursorY'' goes from 0 (top) to 1 (bottom). The 3 values that follow are the 3D world map coordinates that the cursor points at. If the cursor isn't showing, returns ''false'' as the first value.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example prints your cursors current world coordinates and relative screen coordinates to chatbox after typing ''cursorpos''.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function cursorInfo()&lt;br /&gt;
   local showing = isCursorShowing ()&lt;br /&gt;
   if showing then -- if the cursor is showing&lt;br /&gt;
      local screenx, screeny, worldx, worldy, worldz = getCursorPosition()&lt;br /&gt;
&lt;br /&gt;
      outputChatBox( string.format( &amp;quot;Cursor screen position (relative): X=%.4f Y=%.4f&amp;quot;, screenx, screeny ) ) -- make the accuracy of floats 4 decimals&lt;br /&gt;
      outputChatBox( string.format( &amp;quot;Cursor world position: X=%.4f Y=%.4f Z=%.4f&amp;quot;, worldx, worldy, worldz ) ) -- make the accuracy of floats 4 decimals accurate&lt;br /&gt;
   else&lt;br /&gt;
      outputChatBox( &amp;quot;Your cursor is not showing.&amp;quot; )&lt;br /&gt;
   end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler( &amp;quot;cursorpos&amp;quot;, cursorInfo )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This (untested) example uses [[processLineOfSight]] to calculate the exact world location:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler( &amp;quot;onClientRender&amp;quot;, root,&lt;br /&gt;
    function()&lt;br /&gt;
        if isCursorShowing() then&lt;br /&gt;
            local screenx, screeny, worldx, worldy, worldz = getCursorPosition()&lt;br /&gt;
            local px, py, pz = getCameraMatrix()&lt;br /&gt;
            local hit, x, y, z, elementHit = processLineOfSight ( px, py, pz, worldx, worldy, worldz )&lt;br /&gt;
&lt;br /&gt;
            if hit then&lt;br /&gt;
                dxDrawText( &amp;quot;Cursor at &amp;quot; .. x .. &amp;quot; &amp;quot; .. y .. &amp;quot; &amp;quot; ..  z, 200, 200 )&lt;br /&gt;
                if elementHit then&lt;br /&gt;
                    dxDrawText( &amp;quot;Hit element &amp;quot; .. getElementType(elementHit), 200, 220 )&lt;br /&gt;
                end&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_cursor_functions}}&lt;/div&gt;</summary>
		<author><name>Funstein</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:Client_cursor_functions&amp;diff=34418</id>
		<title>Template:Client cursor functions</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Template:Client_cursor_functions&amp;diff=34418"/>
		<updated>2013-01-07T19:00:11Z</updated>

		<summary type="html">&lt;p&gt;Funstein: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[getCursorPosition]]&lt;br /&gt;
*[[setCursorPosition]]&lt;br /&gt;
*[[isCursorShowing]]&lt;br /&gt;
*[[showCursor]]&lt;/div&gt;</summary>
		<author><name>Funstein</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetVehicleOccupants&amp;diff=34360</id>
		<title>GetVehicleOccupants</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetVehicleOccupants&amp;diff=34360"/>
		<updated>2012-12-30T13:40:11Z</updated>

		<summary type="html">&lt;p&gt;Funstein: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function gets all players sitting in the specified vehicle.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
table getVehicleOccupants ( vehicle theVehicle )            &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theVehicle:''' The vehicle of which you wish to retrieve the occupants.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a [[table]] with contents...&lt;br /&gt;
&lt;br /&gt;
table[seat] = occupant&lt;br /&gt;
&lt;br /&gt;
... if successful. Returns ''false'' in the case of failure.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' Don't use an ipairs loop with the table returned by this function. It will skip the driver, as ipairs starts at 1 and the driver seat is ID 0. And if there's an empty seat, ipairs will stop looping. You should use a pairs loop instead.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example prints all vehicle occupants into the F8 console if &amp;quot;/occupants&amp;quot; is typed:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;function outputOccupants(player)&lt;br /&gt;
    if isPedInVehicle(player) then -- If he is actually in a vehicle...&lt;br /&gt;
	local veh = getPedOccupiedVehicle(player) -- Get the vehicle the player is in&lt;br /&gt;
        local occupants = getVehicleOccupants(veh) -- Get all vehicle occupants&lt;br /&gt;
 &lt;br /&gt;
        outputConsole(&amp;quot;------------------------------------&amp;quot;,player) -- Print a seprerator for easier reading&lt;br /&gt;
 &lt;br /&gt;
        for seat, occupant in pairs(occupants) do -- Loop through the array&lt;br /&gt;
            if getElementType(occupant)==&amp;quot;player&amp;quot; then -- If the seat is occupied by a player...&lt;br /&gt;
                occupant = getPlayerName(occupant) -- ... get his/her name&lt;br /&gt;
            elseif getElementType(occupant)==&amp;quot;ped&amp;quot; then -- If the seat is occupied by a ped...&lt;br /&gt;
                occupant = &amp;quot;&amp;lt;ped&amp;gt;&amp;quot; -- ... clear up there's a ped in the seat&lt;br /&gt;
            end&lt;br /&gt;
 &lt;br /&gt;
            outputConsole(&amp;quot;Seat &amp;quot;..seat..&amp;quot;: &amp;quot;..occupant,player) -- Print who's in the seat&lt;br /&gt;
        end&lt;br /&gt;
 &lt;br /&gt;
        outputConsole(&amp;quot;------------------------------------&amp;quot;,player) -- Print another seprerator&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;occupants&amp;quot;,outputOccupants) -- Add a command &amp;quot;/occupants&amp;quot; which triggers outputOccupants&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Vehicle_functions}}&lt;/div&gt;</summary>
		<author><name>Funstein</name></author>
	</entry>
</feed>