<?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=Dmi7ry</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=Dmi7ry"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/Dmi7ry"/>
	<updated>2026-05-14T16:22:23Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=TakePlayerScreenShot&amp;diff=77051</id>
		<title>TakePlayerScreenShot</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=TakePlayerScreenShot&amp;diff=77051"/>
		<updated>2023-06-17T06:38:03Z</updated>

		<summary type="html">&lt;p&gt;Dmi7ry: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server function}}&lt;br /&gt;
This function forces a client to capture the current screen output and send it back to the server. The image will contain the GTA HUD and the output of any dxDraw functions that are not flagged as 'post GUI'. The image specifically excludes the chat box and all GUI (including the client console). The result is received with the event [[onPlayerScreenShot]].&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 takePlayerScreenShot ( player thePlayer, int width, int height [, string tag = &amp;quot;&amp;quot;, int quality = 30, int maxBandwidth = 5000, int maxPacketSize = 500 ] )         &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[player]]:takeScreenShot||}}&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''thePlayer:''' the player to get the screen capture from.&lt;br /&gt;
*'''width:''' the width of the capture image.&lt;br /&gt;
*'''height:''' the height of the capture image.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
*'''tag:''' A string to help identify the screen capture. The string is passed to the matching [[onPlayerScreenShot]] event for your personal convenience.&lt;br /&gt;
*'''quality:''' Quality of the final JPEG image from 0 to 100. A lower value can reduce the memory used by the image considerably which will result in faster and less intrusive uploads.&lt;br /&gt;
*'''maxBandwidth:''' The amount of client upload bandwidth to use (in bytes per second) when sending the image.&lt;br /&gt;
*'''maxPacketSize: ''' The maximum size of one packet.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the function was successfully, ''false'' if invalid arguments are specified.&lt;br /&gt;
&lt;br /&gt;
==Example==  &lt;br /&gt;
===Example 1===&lt;br /&gt;
This example will take a player screenshot whenever a player takes a picture with the camera weapon and then send the picture to all clients, which will render the latest screenshot in the bottom right corner of their screen.&lt;br /&gt;
&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;
local screenSizeX,screenSizeY = guiGetScreenSize() -- save the current screen dimensions&lt;br /&gt;
local imgtexture&lt;br /&gt;
local takenBy&lt;br /&gt;
&lt;br /&gt;
function wepFire(weapon)&lt;br /&gt;
	if weapon == 43 then -- if the weapon the player just fired is the camera&lt;br /&gt;
		triggerServerEvent(&amp;quot;onPlayerTakesPhoto&amp;quot;,getLocalPlayer())&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientPlayerWeaponFire&amp;quot;,getLocalPlayer(),wepFire)&lt;br /&gt;
&lt;br /&gt;
function updateLatestPhoto(img)&lt;br /&gt;
	if imgtexture then -- clean up the old dxTextrue if there is one&lt;br /&gt;
		destroyElement(imgtexture)&lt;br /&gt;
	end&lt;br /&gt;
	imgtexture = dxCreateTexture(img) -- create a new dxTexture from the image data so that we can render it using dxDrawImage&lt;br /&gt;
	takenBy = &amp;quot;taken by &amp;quot;..getPlayerName(source) -- let's also credit the photographer&lt;br /&gt;
end&lt;br /&gt;
addEvent(&amp;quot;updatePhoto&amp;quot;,true)&lt;br /&gt;
addEventHandler(&amp;quot;updatePhoto&amp;quot;,getRootElement(),updateLatestPhoto)&lt;br /&gt;
&lt;br /&gt;
function renderPhoto()&lt;br /&gt;
	if imgtexture then&lt;br /&gt;
		local sizeX, sizeY = 320, 240&lt;br /&gt;
		dxDrawImage(screenSizeX-sizeX,screenSizeY-sizeY,sizeX,sizeY,imgtexture) -- render the picture as well as the name of the photographer in the bottom right corner of the screen&lt;br /&gt;
		dxDrawText(takenBy,screenSizeX-sizeX,screenSizeY-sizeY,screenSizeX,screenSizeY,tocolor(0,0,0))&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientRender&amp;quot;,getRootElement(),renderPhoto)&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;Server&amp;quot; class=&amp;quot;server&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 requestScreenshot()&lt;br /&gt;
	takePlayerScreenShot(source,320,240,&amp;quot;cameraphoto&amp;quot;,50) -- the player just took a picture with the camera, let's request a screenshot to see what they took a photo of&lt;br /&gt;
end&lt;br /&gt;
addEvent(&amp;quot;onPlayerTakesPhoto&amp;quot;,true)&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerTakesPhoto&amp;quot;,getRootElement(),requestScreenshot)&lt;br /&gt;
&lt;br /&gt;
function incomingPlayerScreenshot(res,status,img,timestamp,tag)&lt;br /&gt;
	if status == &amp;quot;ok&amp;quot; and tag == &amp;quot;cameraphoto&amp;quot; then -- make sure a picture was taken successfully and that we're the ones who requested this screenshot&lt;br /&gt;
		triggerClientEvent(&amp;quot;updatePhoto&amp;quot;,source,img)  -- trigger a client event to share the image with everyone on the server&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerScreenShot&amp;quot;,getRootElement(),incomingPlayerScreenshot)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|1.3|n/a|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Player functions}}&lt;/div&gt;</summary>
		<author><name>Dmi7ry</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DxDrawPrimitive&amp;diff=77050</id>
		<title>DxDrawPrimitive</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DxDrawPrimitive&amp;diff=77050"/>
		<updated>2023-06-17T06:32:46Z</updated>

		<summary type="html">&lt;p&gt;Dmi7ry: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}} &lt;br /&gt;
{{New feature/item|3.0157|1.5.6|14370|This function draws a 2D primitive shape across the screen - rendered for one frame. This should be used in conjunction with [[onClientRender]] in order to display continuously.}}&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 dxDrawPrimitive ( string pType, bool postGUI, table vertex1 [, table vertex2, ...] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
* '''pType:''' Type of primitive to be drawn.&lt;br /&gt;
* '''postGUI:''' A bool representing whether the line should be drawn on top of or behind any ingame GUI (rendered by CEGUI).&lt;br /&gt;
* '''vertices:''' Tables representing each primitive vertex, required amount of them is determined by primitive type.&lt;br /&gt;
&lt;br /&gt;
==Allowed types==&lt;br /&gt;
[[Image:MTAsa_primitives.png|thumb|240px|Available primitive types.]]&lt;br /&gt;
More info on primitives may be found on [https://msdn.microsoft.com/en-us/library/windows/desktop/bb147291(v=vs.85).aspx this MSDN site] &lt;br /&gt;
* '''pointlist:''' Renders the vertices as a collection of isolated points.&lt;br /&gt;
* '''linelist:''' Renders the vertices as a list of isolated straight line segments.&lt;br /&gt;
* '''linestrip:''' Renders the vertices as a single polyline.&lt;br /&gt;
* '''trianglelist:''' Renders the specified vertices as a sequence of isolated triangles. Each group of three vertices defines a separate triangle.&lt;br /&gt;
* '''trianglestrip:''' Renders the vertices as a triangle strip.&lt;br /&gt;
* '''trianglefan:''' Renders the vertices as a triangle fan.&lt;br /&gt;
&lt;br /&gt;
==Vertices format==&lt;br /&gt;
* '''posX:''' An float representing the absolute X position of the vertex, represented by pixels on the screen.&lt;br /&gt;
* '''posY:''' An float representing the absolute Y position of the vertex, represented by pixels on the screen.&lt;br /&gt;
* '''color (optional):''' An integer of the hex color, produced using [[tocolor]] or 0xAARRGGBB (AA = alpha, RR = red, GG = green, BB = blue). If it's not specified, white color is used.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a ''true'' if the operation 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;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This is a small example that creates trianglefan primitive with vertices in places that user clicks. It assigns every vertex random color.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local vertices = {}&lt;br /&gt;
function onClick(btn, state, x, y)&lt;br /&gt;
	if btn ~= &amp;quot;left&amp;quot; then return end&lt;br /&gt;
	if state ~= &amp;quot;up&amp;quot; then return end&lt;br /&gt;
	local vertex = {x, y, tocolor(math.random(255), math.random(255), math.random(255))}&lt;br /&gt;
	table.insert(vertices, vertex)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientClick&amp;quot;, root, onClick)&lt;br /&gt;
&lt;br /&gt;
function draw()&lt;br /&gt;
	dxDrawPrimitive(&amp;quot;trianglefan&amp;quot;, true, unpack(vertices))&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientPreRender&amp;quot;, root, draw)&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;true&amp;quot;&amp;gt;&lt;br /&gt;
This example draws one complete oscillation of a sine wave starting in the center of the players screen using a linestrip type primitive.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local screenSizeX,screenSizeY = guiGetScreenSize() -- save the current screen dimensions&lt;br /&gt;
local sinCoords = {}&lt;br /&gt;
&lt;br /&gt;
function resStart() -- do all this once during &amp;quot;onClientResourceStart&amp;quot;, rather than every frame&lt;br /&gt;
	local range = math.pi * 2 -- to get 1 complete oscillation of the sine wave we need the range from 0 to 2pi&lt;br /&gt;
	local resolution = 100 -- resolution in this example means in how many steps we draw the linestrip, higher resolution means smoother curve at the expense of longer computation time and higher memory usage&lt;br /&gt;
	local scale = 50&lt;br /&gt;
	for i=0,range,range/resolution do -- &amp;quot;loop through this [resolution] times, starting at 0 and ending at [range]&amp;quot;&lt;br /&gt;
		local x = screenSizeX * 0.5 + i * scale -- start at the center of the screen and go from there&lt;br /&gt;
		local y = screenSizeY * 0.5 - math.sin(i) * scale -- subtract rather than add because greater y value means lower on the screen, which is the opposite of what we're used to seeing in graphs&lt;br /&gt;
		table.insert(sinCoords,{x,y})&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientResourceStart&amp;quot;,getResourceRootElement(getThisResource()), resStart)&lt;br /&gt;
&lt;br /&gt;
function exampleRender()&lt;br /&gt;
	dxDrawPrimitive(&amp;quot;linestrip&amp;quot;,true,unpack(sinCoords)) -- render a linestrip type primitive with the coordinates we calculated earlier to draw our sine wave&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientRender&amp;quot;,getRootElement(),exampleRender)&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;client&amp;quot; show=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
Modifying the previous example, we can also use it to draw a &amp;quot;loading circle&amp;quot;-symbol similar to what some modern games like using to indicate loading or cloud saving in progress.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local screenSizeX,screenSizeY = guiGetScreenSize() -- save the current screen dimensions&lt;br /&gt;
local circleCoords = {}&lt;br /&gt;
local resolution = 100 -- resolution in this example means in how many steps we draw the linestrip, higher resolution means smoother curve at the expense of longer computation time and higher memory usage&lt;br /&gt;
local scale = 20&lt;br /&gt;
local maxSegmentPercentage = 0.75 -- this means the largest our line will get is 3/4 of the full circle&lt;br /&gt;
local startPointRevolution = 2000 -- one full revolution around the circle for our starting point after this amount of milliseconds passed&lt;br /&gt;
local endPointOscillation = 3000 -- one full oscillation of our endpoint after this amount of milliseconds passed&lt;br /&gt;
&lt;br /&gt;
function resStart() -- do all this once during &amp;quot;onClientResourceStart&amp;quot;, rather than every frame&lt;br /&gt;
	local range = math.pi * 2 -- to complete a circle we need the range from 0 to 2pi&lt;br /&gt;
	for i=0,range,range/resolution do -- &amp;quot;loop through this [resolution] times, starting at 0 and ending at [range]&amp;quot;&lt;br /&gt;
		local x = screenSizeX * 0.5 + math.sin(i) * scale -- for a circle we get our x coordiante from sine and the y coordinate from cosine or vice versa&lt;br /&gt;
		local y = screenSizeY * 0.5 - math.cos(i) * scale -- subtract will later result in a clockwise spin, add in a counter clockwise one&lt;br /&gt;
		table.insert(circleCoords,{x,y})&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientResourceStart&amp;quot;,getResourceRootElement(getThisResource()), resStart)&lt;br /&gt;
&lt;br /&gt;
function exampleRender()&lt;br /&gt;
	local tick = getTickCount() -- get the current time in milliseconds, then use it in a few clever ways to animate our circle&lt;br /&gt;
	local firstPoint = math.ceil( ((tick/startPointRevolution) % 1)*resolution ) -- firstly dividing it and using %1 (modulo 1) to repeatedly get a slowly, linearly increasing value from 0 to 1. This is our starting point&lt;br /&gt;
	local secondPoint = math.ceil( firstPoint + (math.sin(tick/endPointOscillation)) * resolution*maxSegmentPercentage ) -- secondly figuring out where we want our end point to be, using sine to get a pleasant looking pulse for the line growth&lt;br /&gt;
	&lt;br /&gt;
	if firstPoint &amp;gt; secondPoint then -- because of how we calculate our end point, half the time it will be smaller than the start point. for unpack() to give us the range we want we need to provide the smaller value first&lt;br /&gt;
		firstPoint, secondPoint = secondPoint, firstPoint&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if secondPoint &amp;gt; resolution then -- sometimes we'll wrap around the origin point of our circle, those cases need to be taken care of, so we'll draw the linestrip in two parts for those.&lt;br /&gt;
		dxDrawPrimitive(&amp;quot;linestrip&amp;quot;,true,unpack(circleCoords,firstPoint,resolution)) -- [secondPoint] is overshooting, so first let's complete the circle from [firstPoint]&lt;br /&gt;
		dxDrawPrimitive(&amp;quot;linestrip&amp;quot;,true,circleCoords[resolution],unpack(circleCoords,1,secondPoint%resolution)) -- and then draw the remaining extra segments from the start of the circle to however many segments [secondPoint] went past [resolution]&lt;br /&gt;
	elseif firstPoint &amp;lt; 1 then -- lua tables start at an index of 1, so 0 and anything into the negatives needs to be handled&lt;br /&gt;
		dxDrawPrimitive(&amp;quot;linestrip&amp;quot;,true,unpack(circleCoords,resolution+firstPoint,resolution)) -- &amp;quot;how many segments before [resolution] do we have to start? Either way we complete it at [resolution]!&amp;quot;&lt;br /&gt;
		dxDrawPrimitive(&amp;quot;linestrip&amp;quot;,true,circleCoords[resolution],unpack(circleCoords,1,secondPoint)) -- draw the remaining segments from 1 all the way to [secondPoint]&lt;br /&gt;
	else&lt;br /&gt;
		dxDrawPrimitive(&amp;quot;linestrip&amp;quot;,true,unpack(circleCoords,firstPoint,secondPoint)) -- the line isn't currently crossing the origin point of the circle at the top, so drawing this one is straight forwards&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientRender&amp;quot;,getRootElement(),exampleRender)&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;
{{Drawing_functions}}&lt;br /&gt;
&lt;br /&gt;
[[hu:dxDrawPrimitive]]&lt;/div&gt;</summary>
		<author><name>Dmi7ry</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DxDrawMaterialPrimitive3D&amp;diff=77049</id>
		<title>DxDrawMaterialPrimitive3D</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DxDrawMaterialPrimitive3D&amp;diff=77049"/>
		<updated>2023-06-17T06:31:10Z</updated>

		<summary type="html">&lt;p&gt;Dmi7ry: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}} &lt;br /&gt;
This function draws a 3D primitive shape with material applied to it in the 3D world - rendered for one frame. This should be used in conjunction with [[onClientRender]] in order to display continuously.&lt;br /&gt;
If image file is used, it should ideally have dimensions that are a power of two, to prevent possible blurring.&lt;br /&gt;
Power of two: 2px, 4px, 8px, 16px, 32px, 64px, 128px, 256px, 512px, 1024px...&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 dxDrawMaterialPrimitive3D ( primitiveType pType, mixed material, bool postGUI, table vertex1 [, table vertex2, ...] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
* '''pType:''' Type of primitive to be drawn.&lt;br /&gt;
* '''image:''' Either a [[material]] element or a [[filepath]] of the image which is going to be drawn. (.dds images are also supported). Image files should ideally have dimensions that are a power of two, to prevent possible blurring. Use a texture created with [[dxCreateTexture]] to '''speed up drawing'''.&lt;br /&gt;
* '''postGUI:''' A bool representing whether the line should be drawn on top of or behind any ingame GUI (rendered by CEGUI).&lt;br /&gt;
* '''vertices:''' Tables representing each primitive vertex, required amount of them is determined by primitive type.&lt;br /&gt;
&lt;br /&gt;
==Allowed types==&lt;br /&gt;
[[Image:MTAsa_primitives.png|thumb|240px|Available primitive types.]]&lt;br /&gt;
More info on primitives may be found on [https://msdn.microsoft.com/en-us/library/windows/desktop/bb147291(v=vs.85).aspx this MSDN site] &lt;br /&gt;
* '''pointlist:''' Renders the vertices as a collection of isolated points.&lt;br /&gt;
* '''linelist:''' Renders the vertices as a list of isolated straight line segments.&lt;br /&gt;
* '''linestrip:''' Renders the vertices as a single polyline.&lt;br /&gt;
* '''trianglelist:''' Renders the specified vertices as a sequence of isolated triangles. Each group of three vertices defines a separate triangle.&lt;br /&gt;
* '''trianglestrip:''' Renders the vertices as a triangle strip.&lt;br /&gt;
* '''trianglefan:''' Renders the vertices as a triangle fan.&lt;br /&gt;
&lt;br /&gt;
==Vertices format==&lt;br /&gt;
* '''posX:''' An float representing the X position of the vertex in the GTA world.&lt;br /&gt;
* '''posY:''' An float representing the Y position of the vertex in the GTA world.&lt;br /&gt;
* '''posZ:''' An float representing the Z position of the vertex in the GTA world.&lt;br /&gt;
* '''color (optional):''' An integer of the hex color, produced using [[tocolor]] or 0xAARRGGBB (AA = alpha, RR = red, GG = green, BB = blue). If it's not specified, white color is used.&lt;br /&gt;
* '''u:''' An float representing  the relative X coordinate of the top left corner of the material which should be drawn from image&lt;br /&gt;
* '''v:''' An float representing  the relative Y coordinate of the top left corner of the material which should be drawn from image&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a ''true'' if the operation was successful, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Remarks==&lt;br /&gt;
When a 3D draw call is issued by any such material MTA function then the principle to [https://github.com/multitheftauto/mtasa-blue/blob/16769b8d1c94e2b9fe6323dcba46d1305f87a190/Client/core/Graphics/CMaterialPrimitive3DBatcher.cpp#L42 push it directly to the 3D adapter] does apply. To achieve this there is '''no software-side 3D clipping mathematics''' being performed. This way the vertex data is always being pushed to the vertex shader, leaving the entire freedom to the developer on how to interpret this vertex data in the shader. For example, even though this function does imply an use in 3D world space, the vertex coordinates could be translated directly into Direct3D 9 screen space instead, effectively discarding any multiplication with the camera projection matrix. The mathematical model for translation into valid Direct3D 9 screen-space coordinates is described [https://docs.microsoft.com/en-us/windows/win32/direct3d9/viewports-and-clipping here]. Let's assume that you are drawing the rectangle on a classic sheet of paper with a mathematical 2D X,Y coordinate system.&lt;br /&gt;
&lt;br /&gt;
[[File:D3d9_screen_space_transformation.png|frameless|center|Direct3D 9 screen-space transformation]]&lt;br /&gt;
&lt;br /&gt;
To transform the coordinates you first have to flip the Y coordinate using negation and then apply the Direct3D 9 screen-space rasterization cross-hair by using the screen dimensions (sw, sh). Since linear shapes are being preserved across linear translations, you can simplify each vertex-based figure into it's set of vertices for the purpose shown above. By using this function in such a way it can perform all the operations in the same quality such as the simpler [[dxDrawMaterialPrimitive]] function.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example draws the picture with the file name 'test.png' on the ground of Grove Street and adds a /flip command to flip it. The 'test.png' file needs to be included in the [[meta.xml]] in order for this example to work.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local picture = &amp;quot;test.png&amp;quot;&lt;br /&gt;
local worldRenderPositions = { -- create a table with all the world positions&lt;br /&gt;
    &lt;br /&gt;
    { 2483, -1663, 12.4, 0, 0 }, -- top left&lt;br /&gt;
    { 2493, -1663, 12.4, 1, 0 }, -- top right&lt;br /&gt;
    { 2483, -1673, 12.4, 0, 1 }, -- bottom left&lt;br /&gt;
    { 2493, -1673, 12.4, 1, 1 }, -- bottom right&lt;br /&gt;
    &lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
function renderPicture()&lt;br /&gt;
    dxDrawMaterialPrimitive3D( &amp;quot;trianglestrip&amp;quot;, picture, false, unpack(worldRenderPositions) ) -- use unpack() to separate the points&lt;br /&gt;
end&lt;br /&gt;
addEventHandler( &amp;quot;onClientRender&amp;quot;, root, renderPicture )&lt;br /&gt;
&lt;br /&gt;
function flipPicture()&lt;br /&gt;
    for index, point in ipairs(worldRenderPositions) do&lt;br /&gt;
        if point[4] == 1 then&lt;br /&gt;
            point[4] = 0&lt;br /&gt;
        else&lt;br /&gt;
            point[4] = 1&lt;br /&gt;
        end&lt;br /&gt;
        if point[5] == 1 then&lt;br /&gt;
            point[5] = 0&lt;br /&gt;
        else&lt;br /&gt;
            point[5] = 1&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler( &amp;quot;flip&amp;quot;, flipPicture )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This function can be used to draw billboards in the game world. You have to [https://forum.mtasa.com/topic/133065-naruto-jutsus-help-me/?do=findComment&amp;amp;comment=1003073 understand the mathematical models about the human vision] to calculate the proper vertices.&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.5.7-9.19626|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Drawing_functions}}&lt;/div&gt;</summary>
		<author><name>Dmi7ry</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DxDrawMaterialPrimitive&amp;diff=77048</id>
		<title>DxDrawMaterialPrimitive</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DxDrawMaterialPrimitive&amp;diff=77048"/>
		<updated>2023-06-17T06:29:47Z</updated>

		<summary type="html">&lt;p&gt;Dmi7ry: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}} &lt;br /&gt;
{{New feature/item|3.0157|1.5.6|14370|This function draws a 2D primitive shape with material applied to it across the screen - rendered for one frame. This should be used in conjunction with [[onClientRender]] in order to display continuously.&lt;br /&gt;
If image file is used, it should ideally have dimensions that are a power of two, to prevent possible blurring.&lt;br /&gt;
Power of two: 2px, 4px, 8px, 16px, 32px, 64px, 128px, 256px, 512px, 1024px...}}&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 dxDrawMaterialPrimitive ( primitiveType pType, mixed material, bool postGUI, table vertex1 [, table vertex2, ...] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
* '''pType:''' Type of primitive to be drawn.&lt;br /&gt;
* '''image:''' Either a [[material]] element or a [[filepath]] of the image which is going to be drawn. (.dds images are also supported). Image files should ideally have dimensions that are a power of two, to prevent possible blurring. Use a texture created with [[dxCreateTexture]] to '''speed up drawing'''.&lt;br /&gt;
* '''postGUI:''' A bool representing whether the line should be drawn on top of or behind any ingame GUI (rendered by CEGUI).&lt;br /&gt;
* '''vertices:''' Tables representing each primitive vertex, required amount of them is determined by primitive type.&lt;br /&gt;
&lt;br /&gt;
==Allowed types==&lt;br /&gt;
[[Image:MTAsa_primitives.png|thumb|240px|Available primitive types.]]&lt;br /&gt;
More info on primitives may be found on [https://msdn.microsoft.com/en-us/library/windows/desktop/bb147291(v=vs.85).aspx this MSDN site] &lt;br /&gt;
* '''pointlist:''' Renders the vertices as a collection of isolated points.&lt;br /&gt;
* '''linelist:''' Renders the vertices as a list of isolated straight line segments.&lt;br /&gt;
* '''linestrip:''' Renders the vertices as a single polyline.&lt;br /&gt;
* '''trianglelist:''' Renders the specified vertices as a sequence of isolated triangles. Each group of three vertices defines a separate triangle.&lt;br /&gt;
* '''trianglestrip:''' Renders the vertices as a triangle strip.&lt;br /&gt;
* '''trianglefan:''' Renders the vertices as a triangle fan.&lt;br /&gt;
&lt;br /&gt;
==Vertices format==&lt;br /&gt;
* '''posX:''' An float representing the absolute X position of the vertex, represented by pixels on the screen.&lt;br /&gt;
* '''posY:''' An float representing the absolute Y position of the vertex, represented by pixels on the screen.&lt;br /&gt;
* '''color (optional):''' An integer of the hex color, produced using [[tocolor]] or 0xAARRGGBB (AA = alpha, RR = red, GG = green, BB = blue). If it's not specified, white color is used.&lt;br /&gt;
* '''u:''' An float representing  the relative X coordinate of the top left corner of the material which should be drawn from image&lt;br /&gt;
* '''v:''' An float representing  the relative Y coordinate of the top left corner of the material which should be drawn from image&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a ''true'' if the operation was successful, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
{{Example}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Drawing_functions}}&lt;br /&gt;
&lt;br /&gt;
[[hu:dxDrawMaterialPrimitive]]&lt;/div&gt;</summary>
		<author><name>Dmi7ry</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetVehicleLandingGearDown&amp;diff=77047</id>
		<title>GetVehicleLandingGearDown</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetVehicleLandingGearDown&amp;diff=77047"/>
		<updated>2023-06-17T06:24:44Z</updated>

		<summary type="html">&lt;p&gt;Dmi7ry: /* Syntax */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function is used to check whether a vehicle's landing gear is down or not. Only planes can be used with this function.&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 getVehicleLandingGearDown ( vehicle theVehicle )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[vehicle]]:getLandingGearDown|landingGearDown|setVehicleLandingGearDown}}&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theVehicle:''' the [[vehicle]] of which you wish to check the landing gear state.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if landing gear is down, ''false'' if the landing gear is up.&amp;lt;br /&amp;gt;&lt;br /&gt;
Returns ''nil'' if the vehicle has no landing gear, or is invalid.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This function tells you to pull up the landing gear if you're in a Hydra with its landing gear down.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function checkGear( thePlayer )&lt;br /&gt;
    local theVehicle = getPedOccupiedVehicle( thePlayer )    --Get the players vehicle&lt;br /&gt;
    if ( getElementModel(theVehicle) == 520 and getVehicleLandingGearDown( theVehicle ) == false ) then    --if the vehicle is a hydra, and the landing gear is up&lt;br /&gt;
        outputChatBox( &amp;quot;Pull up!&amp;quot;, thePlayer )    --tell the player to pull up.&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Vehicle functions}}&lt;br /&gt;
[[ru:getVehicleLandingGearDown ]]&lt;/div&gt;</summary>
		<author><name>Dmi7ry</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Dgs-dxswitchbutton&amp;diff=65645</id>
		<title>Dgs-dxswitchbutton</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Dgs-dxswitchbutton&amp;diff=65645"/>
		<updated>2020-04-02T08:44:29Z</updated>

		<summary type="html">&lt;p&gt;Dmi7ry: Blanked the page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dmi7ry</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DgsCreateSwitchButton&amp;diff=65644</id>
		<title>DgsCreateSwitchButton</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DgsCreateSwitchButton&amp;diff=65644"/>
		<updated>2020-04-02T08:42:56Z</updated>

		<summary type="html">&lt;p&gt;Dmi7ry: Created page with &amp;quot;__NOTOC__  {{Client function}} This function allows creation of a DGS Switch Button, which is a clickable item as part of GUI.  '''Notice: This is a function exported by DGS!'...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}}&lt;br /&gt;
This function allows creation of a DGS Switch Button, which is a clickable item as part of GUI.&lt;br /&gt;
&lt;br /&gt;
'''Notice: This is a function exported by DGS!'''&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 dgsCreateSwitchButton( float x, float y, float sx, float sy, [ string textOn, string textOff, bool state = false, bool relative = false, element parent = nil, int textColor_t = 0x5AA0E6FF, int textColor_f = 0x3C3C3CFF, float scalex = 1, float scaley = 1 ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''x:''' A float of the 2D x position of the button on a player's screen.  This is affected by the ''relative'' argument.&lt;br /&gt;
*'''y:''' A float of the 2D y position of the button on a player's screen. This is affected by the ''relative'' argument.&lt;br /&gt;
*'''sx:'''&lt;br /&gt;
*'''sy:'''&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
{{OptionalArg}} &lt;br /&gt;
*'''textOn'''&lt;br /&gt;
*'''textOff'''&lt;br /&gt;
*'''state'''&lt;br /&gt;
*'''relative'''&lt;br /&gt;
*'''parent:''' This is the parent that the DGS button is attached to.  If the ''relative'' argument is true, sizes and positioning will be made relative to this parent. If the ''relative'' argument is false, positioning will be the number of offset pixels from the parent's origin. If no parent is passed, the parent will become the screen - causing positioning and sizing according to screen positioning.&lt;br /&gt;
*'''textColor_t:'''&lt;br /&gt;
*'''textColor_f'''&lt;br /&gt;
*'''scalex:''' A float of the 2D x scale of the text of the button.&lt;br /&gt;
*'''scaley:''' A float of the 2D y scale of the text of the button.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns an [[element]] of the created [[Element/DGS/SwitchButton|Switch Button]] if it was successfully created, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
==See Also==&lt;br /&gt;
{{DGSFUNCTIONS}}&lt;/div&gt;</summary>
		<author><name>Dmi7ry</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Dgs-dxswitchbutton&amp;diff=65643</id>
		<title>Dgs-dxswitchbutton</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Dgs-dxswitchbutton&amp;diff=65643"/>
		<updated>2020-04-02T08:41:08Z</updated>

		<summary type="html">&lt;p&gt;Dmi7ry: Drawt&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}}&lt;br /&gt;
This function allows creation of a DGS Switch Button, which is a clickable item as part of GUI.&lt;br /&gt;
&lt;br /&gt;
'''Notice: This is a function exported by DGS!'''&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 dgsCreateSwitchButton( float x, float y, float sx, float sy, [ string textOn, string textOff, bool state = false, bool relative = false, element parent = nil, int textColor_t = 0x5AA0E6FF, int textColor_f = 0x3C3C3CFF, float scalex = 1, float scaley = 1 ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''x:''' A float of the 2D x position of the button on a player's screen.  This is affected by the ''relative'' argument.&lt;br /&gt;
*'''y:''' A float of the 2D y position of the button on a player's screen. This is affected by the ''relative'' argument.&lt;br /&gt;
*'''sx:'''&lt;br /&gt;
*'''sy:'''&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
{{OptionalArg}} &lt;br /&gt;
*'''textOn'''&lt;br /&gt;
*'''textOff'''&lt;br /&gt;
*'''state'''&lt;br /&gt;
*'''relative'''&lt;br /&gt;
*'''parent:''' This is the parent that the DGS button is attached to.  If the ''relative'' argument is true, sizes and positioning will be made relative to this parent. If the ''relative'' argument is false, positioning will be the number of offset pixels from the parent's origin. If no parent is passed, the parent will become the screen - causing positioning and sizing according to screen positioning.&lt;br /&gt;
*'''textColor_t:'''&lt;br /&gt;
*'''textColor_f'''&lt;br /&gt;
*'''scalex:''' A float of the 2D x scale of the text of the button.&lt;br /&gt;
*'''scaley:''' A float of the 2D y scale of the text of the button.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns an [[element]] of the created [[Element/DGS/SwitchButton|Switch Button]] if it was successfully created, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
==See Also==&lt;br /&gt;
{{DGSFUNCTIONS}}&lt;/div&gt;</summary>
		<author><name>Dmi7ry</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=RU/Resources&amp;diff=54322</id>
		<title>RU/Resources</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=RU/Resources&amp;diff=54322"/>
		<updated>2018-04-02T07:27:49Z</updated>

		<summary type="html">&lt;p&gt;Dmi7ry: /* Хранение файлов */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ресурсы - ключевая часть MTA. По существу, ресурс - папка или zip-врхив, который содержит набор файлов, включающий в себя скриптовые файлы, плюс файл ''meta'', который описывает серверу, как ресурс должен быть загружен. Ресурс можно рассматривать в качестве частичного эквивалента программе, работающей на операционной системе - он может быть запущен и остановлен, и множество ресурсов могут быть запущенными одновременно. Но тем не менее следует помнить, что в отличие от программ на ОС, между ресурсами нет многозадачности.&lt;br /&gt;
&lt;br /&gt;
==Терминология==&lt;br /&gt;
* '''Resource''' - zip-архив или папка, содержащая файл meta.xml и некоторые другие составные части ресурсов. Они помещены в папке ''mods/deathmatch/resources'' в директории сервера.&lt;br /&gt;
* '''Составная часть''' - Файл, содержащийся внутри ресурса, на данный момент это могут быть карты, скрипты, картинки и т.д.&lt;br /&gt;
&lt;br /&gt;
==Файл Meta==&lt;br /&gt;
''Для подробностей читайте основную статью [[RU/Meta.xml|Meta.xml]]''&lt;br /&gt;
&lt;br /&gt;
Файл Meta - ядро каждого ресурса. Он в точности описывает, какие файлы должны использоваться в ресурсе и как. Далее следует пример, который покрывает все имеющиеся опции, ваши meta файлы могут иметь этих тегов столько, сколько вам потребуется:&lt;br /&gt;
&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;eAi&amp;quot; description=&amp;quot;This is a basic CTF script&amp;quot; version=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;include resource=&amp;quot;radarblips&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;include resource=&amp;quot;markermanagement&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;script src=&amp;quot;ctf.lua&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;flag.lua&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;ctf_client.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;file src=&amp;quot;model.dff&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;quitbutton.png&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;killed.png&amp;quot;  /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;html src=&amp;quot;test.htm&amp;quot; default=&amp;quot;true&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;html src=&amp;quot;logo.png&amp;quot; raw=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;export function=&amp;quot;multiply&amp;quot; http=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;export function=&amp;quot;getPlayerList&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;export function=&amp;quot;getElementOwner&amp;quot; type=&amp;quot;client&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;config src=&amp;quot;vehicle-list.xml&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;config src=&amp;quot;markerconfig.xml&amp;quot; type=&amp;quot;server&amp;quot;  /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;map src=&amp;quot;somestuff.map&amp;quot; dimension=&amp;quot;99&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
В то же время карта CTF может обладать meta.xml, выглядящим примерно так:&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;include resource=&amp;quot;ctf&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;map src=&amp;quot;myuberl33tctfmap.map&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;info author=&amp;quot;Tom&amp;quot; instructions=&amp;quot;this is uber l33t !!!!!1111111&amp;quot; type=&amp;quot;map&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Атрибуты Script/type, Config/type и File/type указывают, может ли скрипт/ресурс быть загружен на компьютер клиента, и по умолачнию установлены на &amp;quot;server&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Тэг include указывает на другие ресурсы, которые должны быть запущены перед запуском данного. Другими словами, если ваш ресурс зависит от другого, вы можете указать, чтобы этот другой запускался перед вашим,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Каждый ресурс обладает своей виртуальной машиной (VM). Она содержит каждый скрипт ресурса. Это значит, что переменные не являются общими с другими ресурсами. Лучший способ сообщаться с другими ресурсами - использовать тэг ''export'' и экспортировать функцию. Это позволит другим ресурсам ее вызывать с использованием скриптинговой функции [[call]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Скрипты, отправляемые клиенту, стартуют сразу по завершении им закачки всех скриптов.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Скрипты имеют права на чтение и запись внутрь папки своего ресурса через функции типа [[xmlCreateFile]] и [[fileCreate]]. Они также имеют права на чтение и запись внутри других ресурсов, но только если имеют на это [[RU/Access_Control_List|ACL]]-доступ. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Каждый ресурс может быть загружен только один раз, сервер это проконтролирует. Даже при указании ресурса в качестве include более одного раза, каждый раз будет использована одна и та же его копия.&lt;br /&gt;
&lt;br /&gt;
==Хранение файлов==&lt;br /&gt;
Файлы ресурса могут храниться либо в zip-архиве, либо в директории. Они располагаются в:&lt;br /&gt;
&lt;br /&gt;
server/mods/deathmatch/resources/ (если ваш сервер установлен вместе с клиентом)&lt;br /&gt;
&lt;br /&gt;
или&lt;br /&gt;
&lt;br /&gt;
mods/deathmatch/resources/ (для выделенных серверов)&lt;br /&gt;
&lt;br /&gt;
Каждый ресурс может являться zip-архивом, директорией, или и тем, и другим. В последнем случае директория будет приорететней zip-архива, так как в нее можно будет поместить файлы, которые перезапишут старые, что позволит тестировать и рарзрабатывать карты/скрипты &amp;quot;на лету&amp;quot;. Такое не было бы возможно при приоритетах, расставленных наоборот. А zip-архивы, в свою очередь, зачастую используются конечными пользователями.&lt;br /&gt;
&lt;br /&gt;
==Другие примечательные вещи==&lt;br /&gt;
*Названия ресурсов не могут содержать точек.&lt;br /&gt;
*Если ресурс сохраняет какие-нибудь файлы, используемые названия файлов не должны быть указаны в meta.xml&lt;br /&gt;
*Файлы, указанные в meta.xml, должны рассматриваться скриптами только как файлы для чтения. Не редактируйте их через xmlSaveFile, FileSave и т.д.&lt;br /&gt;
*При создании zip-архива вашего ресурса не включайте в него файлы, в которые будет вестись запись. Если ваш ресурс использует такие файлы, они должны быть созданы ресурсом по мере надобности.&lt;br /&gt;
*При создании zip-архива вашего ресурса включайте только те файлы, что описаны в meta.xml. Не включайте 'образцы' файлов, в которые будет вестись запись, это чревато последствиями.&lt;br /&gt;
*Мы рекомендуем избегать пробелов и экзотических символов в названиях ресурсов.&lt;br /&gt;
&lt;br /&gt;
==Функции скриптинга==&lt;br /&gt;
Система ресурсов может управляться скриптово. Вследствие этого, предоставляются следующие серверные функции скриптинга:&lt;br /&gt;
{{Resource functions}}&lt;br /&gt;
&lt;br /&gt;
Предоставляются также следующие события:&lt;br /&gt;
{{Resource_events}}&lt;br /&gt;
&lt;br /&gt;
[[en:Resources]]&lt;br /&gt;
[[it:Introduzione alle Risorse]]&lt;br /&gt;
[[pt-br:Recursos]]&lt;/div&gt;</summary>
		<author><name>Dmi7ry</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=RU/Event_system&amp;diff=54246</id>
		<title>RU/Event system</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=RU/Event_system&amp;diff=54246"/>
		<updated>2018-03-30T06:18:30Z</updated>

		<summary type="html">&lt;p&gt;Dmi7ry: /* Обработчики событий */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
Система событий лежит в основе MTA-скриптинга. События тесно связаны с [[RU/Element_tree|деревом элементов]]. События срабатывают, когда что-либо происходит: игрок встаёт на маркер, выбирается элемент и т.д. Каждое событие имеет исходный элемент, а именно элемент, который выполнил действие&lt;br /&gt;
&lt;br /&gt;
==Обработчики событий==&lt;br /&gt;
Чтобы использовать систему событий, Вы присоединяете обработчики событий к элементам в дереве элементов с помощью функции [[RU/addEventHandler|addEventHandler]]. Когда Вы это сделаете, Ваша функция будет активирована для всех событий, инициированных этим элементом, это родители (и их родители) и дети (и их дети). Таким образом, обработчик событий, прикрепленный к корневому элементу, запускается, когда событие происходит для любого элемента. Как правило, Вы должны обычно использовать специфичный обработчик, как можете. Если Вы хотите просто увидеть, когда игрок встаёт на определённый маркер, просто присоедините обработчик события к этому маркеру.&lt;br /&gt;
&lt;br /&gt;
Каждый обработчик событий имеет три &amp;quot;скрытые&amp;quot; переменные:&lt;br /&gt;
* '''source'''. Это элемент, от которого произошло событие.&lt;br /&gt;
* '''this'''. Это элемент, на который запускается обработчик (т.е. тот, к которому Вы привязывали его функцией addEventHandler).&lt;br /&gt;
* '''eventName'''. Это строка имени события, которое было вызвано (т.е имя, которое было добавлено функцией addEventHandler).&lt;br /&gt;
&lt;br /&gt;
Кроме того, серверная система событий также имеет ещё одну &amp;quot;скрытую&amp;quot; переменную:&lt;br /&gt;
* '''client''': Это клиент, который вызвал событие с помощью функции [[RU/triggerServerEvent|triggerServerEvent]].  Это значение не задано, если событие не было инициировано клиентом.&lt;br /&gt;
&lt;br /&gt;
Исходная переменная является наиболее важной для большинства обработчиков. Вы почти всегда захотите ссылаться на эту переменную, чтобы сообщить, какой элемент вызвал событие. Эта переменная используется для обеспечения того, чтобы событие было вызвано элементом, к которому присоединён обработчик.&lt;br /&gt;
&lt;br /&gt;
Важно отметить, что события следуют за иерархией элементов. Все события изначально запускаются в элементе ''source'', за которым следуют все родительские и дочерние элементы. Это имеет несколько важных последствий:&lt;br /&gt;
&lt;br /&gt;
* Событие, инициированное на корневом элементе, будет инициировано для каждого элемента в дереве элементов. Этого следует избегать, когда это возможно.&lt;br /&gt;
* Все события в любом месте дерева элементов будут инициированы на корневом элементе. Это означает, что вы можете легко поймать каждое событие типа, связав обработчик с корневым элементом. Это следует делать только в том случае, если действительно требуется любое событие этого типа, иначе же прикрепите его к более специфичному элементу дерева элементов.&lt;br /&gt;
* Вы можете прикрепить обработчик события к корневому элементу вашего ресурса, чтобы получить все события, инициированные элементами, содержащими Ваш ресурс.&lt;br /&gt;
* Вы можете создавать фиктивные элементы для захвата событий из группы дочерних элементов.&lt;br /&gt;
* Вы можете использовать фиктивные элементы, указанные в файле ''.map'' (например, ''&amp;lt;flag&amp;gt;'') и создать для них реальные представления (например, объекты), и сделать эти реальные элементы дочерними элементами фиктивного элемента. Обработчики событий затем могут быть прикреплены к фиктивному элементу и будут получать все события реальных элементов. Это полезно, когда один ресурс управляет представлением элемента (например, создавая объекты), а другой хочет обрабатывать специальные события. Это может быть ресурс карты, который хочет обработать флаг, захваченный определенным образом. Ресурс карты, как правило, не будет знать о том, как представлен флаг. Это не имеет значения, поскольку он может просто привязывать обработчики к своему фиктивному элементу флага, в то время как другой ресурс игрового режима может обрабатывать представление.&lt;br /&gt;
&lt;br /&gt;
Функция, которую Вы привязали к событию, вызывается и передает множество аргументов. Эти аргументы специфичны для событий. Каждое событие имеет определенные параметры, например [[RU/onClientGUIClick|onClientGUIClick]] имеет 4 параметра.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;string button, string state, int absoluteX, int absoluteY&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Функция, которую Вы привязали к этому событию, будет передана этими параметрами в качестве аргументов. Вы должны помнить, что каждое событие имеет разные параметры.&lt;br /&gt;
&lt;br /&gt;
==Встроенные события==&lt;br /&gt;
MTA имеет ряд встроенных событий. Они перечислены на страницах &amp;quot;[[RU/Client Scripting Events|Клиентские события скриптинга]]&amp;quot; и &amp;quot;[[RU/Scripting Events|Скриптинговые события]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==Пользовательские события==&lt;br /&gt;
Вы можете создавать свои собственные события, которые могут запускаться во всех ресурсах. Это важный способ связаться с другими ресурсами и позволить им подключиться к вашему коду. Чтобы добавить свое собственное событие, просто вызовите функцию [[RU/addEvent|addEvent]]. Затем Вы можете использовать функцию [[RU/triggerEvent|triggerEvent]] для запуска этого события в любое время: либо с использованием таймера, либо на основе более общего события.&lt;br /&gt;
&lt;br /&gt;
Например, Вы можете сделать игровой режим ''Capture the Flag'' и вызвать событие, когда игрок фиксирует флаг. Вы можете сделать это, связав обработчик события со стандартным событием MTA [[RU/onMarkerHit|onMarkerHit]] и проверив, что игрок, входящий в маркер, имеет флаг. Если Вы сделаете это, Вы можете затем запустить своё более специфическое событие ''onFlagCaptured'', и другие ресурсы смогут справиться с этим, как им заблагорассудится.&lt;br /&gt;
&lt;br /&gt;
==Отмена событий==&lt;br /&gt;
События могут быть отменены с помощью функции [[RU/cancelEvent|cancelEvent]]. Это может иметь множество последствий, но в целом это означает, что сервер не будет выполнять никаких действий, которые обычно выполняются. Например, отмена события [[RU/onPickupUse|onPickupUse]] не позволит игроку использовать пикап, отмена события [[RU/onVehicleStartEnter|onVehicleStartEnter]] помешает игроку войти в транспорт. Вы можете проверить, было ли отменено текущее активное событие, используя функцию [[RU/wasEventCanceled|wasEventCanceled]]. Важно отметить, что событие отмены не предотвращает запуск других обработчиков событий.&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripting Concepts]]&lt;br /&gt;
[[en:Event system]]&lt;br /&gt;
[[es:Sistema de eventos]]&lt;br /&gt;
[[pt-br:Sistema de eventos]]&lt;/div&gt;</summary>
		<author><name>Dmi7ry</name></author>
	</entry>
</feed>