<?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=MrDadosz</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=MrDadosz"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/MrDadosz"/>
	<updated>2026-04-29T12:36:36Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DxCreateFont&amp;diff=78780</id>
		<title>DxCreateFont</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DxCreateFont&amp;diff=78780"/>
		<updated>2024-01-21T12:26:02Z</updated>

		<summary type="html">&lt;p&gt;MrDadosz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{Note|The size can't be less than 5 or more than 150. Use this function after onClientResourceStart, otherwise some characters may be displayed incorrectly.}}&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
This function creates a [[DX font]] element that can be used in [[dxDrawText]]. Successful font creation is not guaranteed, and may fail due to hardware or memory limitations.&lt;br /&gt;
&lt;br /&gt;
To see if creation is likely to fail, use [[dxGetStatus]]. (When '''VideoMemoryFreeForMTA''' is zero, failure ''is'' guaranteed.)&lt;br /&gt;
=====It is highly recommended that [[dxSetTestMode]] is used when writing and testing scripts using dxCreateFont.=====&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
element dxCreateFont ( string filepath[, int size=9, bool bold=false, string quality=&amp;quot;proof&amp;quot; ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[DX_font|DxFont]]}}&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''filepath:''' the name of the file containing the font&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''size:''' size of the font&lt;br /&gt;
*'''bold:''' flag to indicate if the font should be bold&lt;br /&gt;
*'''quality:''' the font quality&lt;br /&gt;
** &amp;quot;default&amp;quot;: not the actual default&lt;br /&gt;
** &amp;quot;draft&amp;quot;&lt;br /&gt;
** &amp;quot;proof&amp;quot;: the default &lt;br /&gt;
** &amp;quot;nonantialiased&amp;quot;&lt;br /&gt;
** &amp;quot;antialiased&amp;quot;&lt;br /&gt;
** &amp;quot;cleartype&amp;quot;&lt;br /&gt;
** &amp;quot;cleartype_natural&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a [[DX font]] element if successful, ''false'' if invalid arguments were passed to the function, or there is insufficient resources available.&lt;br /&gt;
&lt;br /&gt;
'''You should always check to see if this function has returned false.'''&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local font = dxCreateFont('myfont.ttf', 20, false, 'proof') or 'default' -- fallback to default&lt;br /&gt;
&lt;br /&gt;
addEventHandler('onClientRender', root, function()&lt;br /&gt;
    dxDrawText('Example Text', 100, 350, 300, 350, tocolor(255, 255, 0), 1, font)&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Drawing_functions}}&lt;br /&gt;
&lt;br /&gt;
[[hu:dxCreateFont]]&lt;/div&gt;</summary>
		<author><name>MrDadosz</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientPlayerVoiceStart&amp;diff=63976</id>
		<title>OnClientPlayerVoiceStart</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientPlayerVoiceStart&amp;diff=63976"/>
		<updated>2019-08-31T09:37:26Z</updated>

		<summary type="html">&lt;p&gt;MrDadosz: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client event}}&lt;br /&gt;
__NOTOC__ &lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px dotted blue; background: #00CC66;padding:4px;margin-bottom:2px;&amp;quot;&amp;gt;'''Note''':  This event should only be used as a low-level function for advanced users.  For typical Voice scripting, please see the [[Resource:Voice|Voice Resource]]&amp;lt;/div&amp;gt;&lt;br /&gt;
This event is triggered when a player starts talking through voice chat.&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
No parameters.&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the player [[element]] that just started talking through voice chat.&lt;br /&gt;
&lt;br /&gt;
==Cancel effect==&lt;br /&gt;
* If the [[event system#Event source|source]] is the local player, the local player will not broadcast his voice chat to the server&lt;br /&gt;
* If the [[event system#Event source|source]] is a remote player, the player who started talking will not be heard.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example outputs to the console the player that started talking.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;addEventHandler(&amp;quot;onClientPlayerVoiceStart&amp;quot;,root,function()&lt;br /&gt;
	outputConsole(getPlayerName(source)..&amp;quot; has started talking.&amp;quot;)&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_player_events}}&lt;/div&gt;</summary>
		<author><name>MrDadosz</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientVehicleExplode&amp;diff=57147</id>
		<title>OnClientVehicleExplode</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientVehicleExplode&amp;diff=57147"/>
		<updated>2018-07-29T18:32:22Z</updated>

		<summary type="html">&lt;p&gt;MrDadosz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client event}}&lt;br /&gt;
__NOTOC__ &lt;br /&gt;
This event is triggered when a vehicle explodes.&lt;br /&gt;
{{Note|Remember, this event can not be canceled.}}&lt;br /&gt;
&lt;br /&gt;
==Parameters== &lt;br /&gt;
This event has no parameters.&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The source of this event is the vehicle that exploded.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example will output some text to chat on vehicle explosion&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onClientVehicleExplode&amp;quot;, getRootElement(), function()&lt;br /&gt;
  local modelname = getVehicleName(source)&lt;br /&gt;
  outputChatBox(modelname..&amp;quot; just exploded!&amp;quot;)&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
===Client vehicle events===&lt;br /&gt;
{{Client_vehicle_events}}&lt;br /&gt;
===Client event functions===&lt;br /&gt;
{{Client_event_functions}}&lt;br /&gt;
[[es:onClientVehicleExplode]]&lt;/div&gt;</summary>
		<author><name>MrDadosz</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GuiStaticImageLoadImage&amp;diff=55435</id>
		<title>GuiStaticImageLoadImage</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GuiStaticImageLoadImage&amp;diff=55435"/>
		<updated>2018-06-23T12:15:40Z</updated>

		<summary type="html">&lt;p&gt;MrDadosz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function allows you to change the image in GUI static image element to another one. You have to use [[setElementCallPropagationEnabled]] if you want to change only parent image.&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 guiStaticImageLoadImage ( element theElement, string filename )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theElement:''' The static image element to be changed.&lt;br /&gt;
*'''filename:''' A string specifying the [[filepath]] of the image file being loaded in current resource. &lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the the image in the static image element was successfully changed, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example creates a static image (myimage.png) and replaces it with other image (otherimage.png) 10 seconds after creation.&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client-side script (example.lua)&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;
[lua]&lt;br /&gt;
local myImage = guiCreateStaticImage ( 0.45, 0.48, 0.2, 0.5, &amp;quot;myimage.png&amp;quot;, true )&lt;br /&gt;
setTimer ( guiStaticImageLoadImage, 10000, 1, myImage, &amp;quot;otherimage.png&amp;quot; )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;meta.xml&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
In this example meta.xml is used to tell the server which files it will be using.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
&amp;lt;info author=&amp;quot;Yourname&amp;quot; version=&amp;quot;1.0&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;example.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;file src=&amp;quot;myimage.png&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;file src=&amp;quot;otherimage.png&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&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;
{{GUI_functions}}&lt;br /&gt;
{{GUI_events}}&lt;/div&gt;</summary>
		<author><name>MrDadosz</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetVehicleOccupants&amp;diff=54804</id>
		<title>GetVehicleOccupants</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetVehicleOccupants&amp;diff=54804"/>
		<updated>2018-04-25T01:02:14Z</updated>

		<summary type="html">&lt;p&gt;MrDadosz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&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;
{{OOP||[[vehicle]]:getOccupants|occupants}}&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 seat ID as an index and the occupant as an element like this: table[seat] = occupant&lt;br /&gt;
&lt;br /&gt;
Returns ''false'' if an invalid vehicle was passed or if the vehicle has no seats (like a trailer)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style='font-weight: bold;background:blue;color:white;padding:2px; padding-left:8px;'&amp;gt;COUNTING PLAYERS IN A VEHICLE&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style='border: 2px solid blue;padding: 5px;'&amp;gt;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. You can simply use #table to get occupants count.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local counter = 0&lt;br /&gt;
&lt;br /&gt;
for seat, player in pairs(getVehicleOccupants(pseudoVehicle)) do&lt;br /&gt;
    counter = counter + 1&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
outputDebugString(&amp;quot;Players in your vehicle: &amp;quot;.. counter)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&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;
    -- Make sure they're in a vehicle&lt;br /&gt;
    if (not isPedInVehicle(player)) then&lt;br /&gt;
        outputConsole(&amp;quot;You're not in a vehicle.&amp;quot;, player)&lt;br /&gt;
        return false&lt;br /&gt;
    end&lt;br /&gt;
    outputConsole(&amp;quot;------------------------------------&amp;quot;, player) -- Print a separator for easier reading&lt;br /&gt;
    local vehicle = getPedOccupiedVehicle(player)&lt;br /&gt;
    local occupants = getVehicleOccupants(vehicle) or {} -- In case it returned false, loop an empty table.&lt;br /&gt;
    for seat, occupant in pairs(occupants) do -- Loop through the array&lt;br /&gt;
        if (occupant and getElementType(occupant) == &amp;quot;player&amp;quot;) then -- Make sure the occupant is a player&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 separator&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>MrDadosz</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetElementDimension&amp;diff=54644</id>
		<title>SetElementDimension</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetElementDimension&amp;diff=54644"/>
		<updated>2018-04-08T01:54:41Z</updated>

		<summary type="html">&lt;p&gt;MrDadosz: /* Required Arguments */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function allows you to set the [[dimension]] of any element. The dimension determines what/who the element is visible to.&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 setElementDimension ( element theElement, int dimension )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[element]]:setDimension|dimension|getElementDimension}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''theElement:''' The element in which you'd like to set the dimension of.&lt;br /&gt;
*'''dimension:''' An integer representing the dimension ID. {{New feature/item|3.0154|1.5.3|11199|You can also use '''-1''' to make the element visible in all dimensions (only valid to objects).}} Valid values are 0 to 65535.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if '''theElement''' and '''dimension''' are valid, ''false'' otherwise.&lt;br /&gt;
Also returns false if '''theElement''' is a player and it's not alive.&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;
In this example the player's dimension is set to ID 1 when they enter a vehicle, and set back to dimension 0 when they exit the vehicle.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onPlayerEnterVehicle ( theVehicle, seat, jacked )&lt;br /&gt;
      if ( getElementDimension ( source ) == 0 ) then    -- if the player is in dimension 0&lt;br /&gt;
            setElementDimension ( source, 1 )            -- set his dimension to 1&lt;br /&gt;
            setElementDimension ( theVehicle, 1 )        -- set his vehicle's dimension to 1 as well&lt;br /&gt;
      end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerVehicleEnter&amp;quot;, root, onPlayerEnterVehicle )&lt;br /&gt;
&lt;br /&gt;
function onPlayerExitVehicle ( theVehicle, seat, jacker )&lt;br /&gt;
      if ( getElementDimension ( source ) == 1 ) then    -- if the player is in dimension 1&lt;br /&gt;
            setElementDimension ( source, 0 )            -- set his dimension back to 0&lt;br /&gt;
            setElementDimension ( theVehicle, 0 )        -- set his vehicle's dimension back to 0 as well&lt;br /&gt;
      end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerVehicleExit&amp;quot;, root, onPlayerExitVehicle )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
==Requirements==&lt;br /&gt;
If you want to use the -1 dimension parameter.&lt;br /&gt;
{{Requirements|1.5.4|1.5.4|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Element functions}}&lt;br /&gt;
&lt;br /&gt;
[[de:setElementDimension]]&lt;/div&gt;</summary>
		<author><name>MrDadosz</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetElementPosition&amp;diff=53136</id>
		<title>SetElementPosition</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetElementPosition&amp;diff=53136"/>
		<updated>2017-12-16T18:00:09Z</updated>

		<summary type="html">&lt;p&gt;MrDadosz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Shared function}}&lt;br /&gt;
This function sets the position of an element to the specified coordinates.&lt;br /&gt;
{{Warning|Do not use this function to spawn a [[player]]. It will cause problems with other functions like [[warpPedIntoVehicle]]. Use [[spawnPlayer]] instead. MTA freezes player by itself so it is not recommended to use [[setElementFrozen]] after changing element's position.}}&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 setElementPosition ( element theElement, float x, float y, float z [, bool warp = true ] )  &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[element]]:setPosition|position|getElementPosition}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theElement:''' A valid [[element]] to be moved.&lt;br /&gt;
*'''x:''' The x coordinate of the destination.&lt;br /&gt;
*'''y:''' The y coordinate of the destination.&lt;br /&gt;
*'''z:''' The z coordinate of the destination.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''warp:''' teleports players, resetting any animations they were doing. Setting this to ''false'' preserves the current animation.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the function was successful, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 1&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example adds a &amp;quot;setpos&amp;quot; command to console, which allows setting of a player's position.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function consoleSetPlayerPosition ( source, commandName, posX, posY, posZ )&lt;br /&gt;
	setElementPosition ( source, posX, posY, posZ )&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;setpos&amp;quot;, consoleSetPlayerPosition  )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 2&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
This example adds a &amp;quot;setpos&amp;quot; command to console, which allows setting of the local player's position.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function consoleSetPlayerPosition ( commandName, posX, posY, posZ )&lt;br /&gt;
	setElementPosition ( localPlayer, posX, posY, posZ )&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;setpos&amp;quot;, consoleSetPlayerPosition  )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 3&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
This example enables a player to type /warpto &amp;lt;playername&amp;gt; to warp to them. If the player being warped to is in a vehicle with a free passenger seat, it will warp into the vehicle.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function consoleWarpTo ( sourcePlayer, commandName, player2nick )&lt;br /&gt;
	-- Make sure required parameters are set&lt;br /&gt;
	if ( not sourcePlayer or not player2nick ) then return end&lt;br /&gt;
	-- Setup the variables we will be using for teleportation&lt;br /&gt;
	local x, y, z, r, d = 0, 0, 0, 0, 2.5&lt;br /&gt;
	-- Grab the element identifier of the player we are trying to warp to&lt;br /&gt;
	local player2 = getPlayerFromNick ( player2nick )&lt;br /&gt;
	-- Make sure it exists!&lt;br /&gt;
	if ( player2 ) then&lt;br /&gt;
		-- Is the player we're warping to in a vehicle?&lt;br /&gt;
		if ( isPlayerInVehicle ( player2 ) ) then&lt;br /&gt;
			-- Indeed they are, let's get the vehicle information such as the vehicle element itself, and the seats it's got.&lt;br /&gt;
			local player2vehicle = getPlayerOccupiedVehicle ( player2 )&lt;br /&gt;
			local numseats = getVehicleMaxPassengers ( player2vehicle )&lt;br /&gt;
			local i = 0&lt;br /&gt;
			-- Loop over the seats to see if there's a free one&lt;br /&gt;
			while ( i &amp;lt; numseats ) do&lt;br /&gt;
				if ( getVehicleOccupant ( player2vehicle, i ) ) then&lt;br /&gt;
					-- This seat isn't free, go ahead and check the next one&lt;br /&gt;
					i = i + 1&lt;br /&gt;
				else&lt;br /&gt;
					-- This seat is free, get out of the loop&lt;br /&gt;
					break&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			-- Check if 'i' is lower than the number of seats. If it is, it means it's the number of a free seat&lt;br /&gt;
			if ( i &amp;lt; numseats ) then&lt;br /&gt;
				-- Teleport the player into the seat&lt;br /&gt;
				warpPlayerIntoVehicle ( sourcePlayer, player2vehicle, i )&lt;br /&gt;
			else&lt;br /&gt;
				-- There are no free seats, tell the player that.&lt;br /&gt;
				outputChatBox ( &amp;quot;Sorry, the player's vehicle is full (&amp;quot; .. getVehicleName ( player2vehicle ) .. &amp;quot; &amp;quot; .. i .. &amp;quot;/&amp;quot; .. numseats .. &amp;quot;)&amp;quot;, sourcePlayer )&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			-- The player isn't in a vehicle, let's get the player's position and warp to them.&lt;br /&gt;
			x, y, z = getElementPosition ( player2 )&lt;br /&gt;
			r = getPlayerRotation ( player2 )&lt;br /&gt;
			-- Make sure we get interior data, they might be inside one!&lt;br /&gt;
			interior = getElementInterior ( player2 )&lt;br /&gt;
			dimension = getElementDimension ( player2 )&lt;br /&gt;
			-- Do some funky math to make sure that we dont teleport inside of them (get us both stuck inside each other)&lt;br /&gt;
			x = x - ( ( math.cos ( math.rad ( r + 90 ) ) ) * d )&lt;br /&gt;
			y = y - ( ( math.sin ( math.rad ( r + 90 ) ) ) * d )&lt;br /&gt;
			-- Set a few timers for setting interiors, dimensions and positions&lt;br /&gt;
			setTimer ( setElementInterior, 800, 1, sourcePlayer, interior )&lt;br /&gt;
			setTimer ( setElementDimension, 900, 1, sourcePlayer, dimension )&lt;br /&gt;
			setTimer ( setElementPosition, 1000, 1, sourcePlayer, x, y, z )&lt;br /&gt;
			setTimer ( setPlayerRotation, 1000, 1, sourcePlayer, r )&lt;br /&gt;
			-- Fade the camera to make it look nicer&lt;br /&gt;
			fadeCamera ( sourcePlayer, false, 1, 0, 0, 0 )&lt;br /&gt;
			-- Fade it back once it's all complete!&lt;br /&gt;
			setTimer ( fadeCamera, 1000, 1, sourcePlayer, true, 1 )&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		-- No player by the specified name was found, tell the warper this.&lt;br /&gt;
		outputChatBox ( &amp;quot;No such player.&amp;quot;, sourcePlayer )&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;warpto&amp;quot;, consoleWarpTo )&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;
{{Element functions}}&lt;br /&gt;
[[ru:setElementPosition]]&lt;/div&gt;</summary>
		<author><name>MrDadosz</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=PL/getRadioChannelName&amp;diff=39245</id>
		<title>PL/getRadioChannelName</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=PL/getRadioChannelName&amp;diff=39245"/>
		<updated>2014-04-04T16:17:07Z</updated>

		<summary type="html">&lt;p&gt;MrDadosz: /* Wymagane argumenty */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}}&lt;br /&gt;
Funkcja pobiera nazwę radia o podanym przez nas ID.&lt;br /&gt;
&lt;br /&gt;
==Składnia== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
string getRadioChannelName ( int id )             &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Wymagane argumenty=== &lt;br /&gt;
*'''id:''' Liczba od 0 do 12. ID radia, którego nazwę chcemy pobrać.&lt;br /&gt;
{{SoundID}}&lt;br /&gt;
&lt;br /&gt;
===Zwracanie===&lt;br /&gt;
Jeżeli uda się pobrać nazwę stacji jest ona zwraca, jeśli nie uda to zwracany jest fałsz - ''false''.&lt;br /&gt;
&lt;br /&gt;
==Przykład==&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;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addCommandHandler(&amp;quot;getradio&amp;quot;,&lt;br /&gt;
    function()&lt;br /&gt;
        outputChatBox(&amp;quot;W tym momencie sluchasz: &amp;quot;..getRadioChannelName(getRadioChannel())..&amp;quot;!&amp;quot;)&lt;br /&gt;
    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;
==Zobacz także==&lt;br /&gt;
&lt;br /&gt;
{{Client_audio_functions}}&lt;/div&gt;</summary>
		<author><name>MrDadosz</name></author>
	</entry>
</feed>