<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/wiki/RU/guiCreateLabel?action=history&amp;feed=atom</id>
	<title>RU/guiCreateLabel - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/wiki/RU/guiCreateLabel?action=history&amp;feed=atom"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=RU/guiCreateLabel&amp;action=history"/>
	<updated>2026-05-12T16:33:31Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=RU/guiCreateLabel&amp;diff=46251&amp;oldid=prev</id>
		<title>Fabervox: Необязательные параметры, пример</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=RU/guiCreateLabel&amp;diff=46251&amp;oldid=prev"/>
		<updated>2015-12-21T17:43:11Z</updated>

		<summary type="html">&lt;p&gt;Необязательные параметры, пример&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}}&lt;br /&gt;
[[Image:gui-label.png|frame|Пример метки.]]&lt;br /&gt;
&amp;lt;table&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td valign=top height=100&amp;gt;&lt;br /&gt;
Эта функция создает новую текстовую метку. Метка является просто текстом, без возможности редактирования её пользователем. Если вы хотите установить больший текст, измените шрифт.&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&lt;br /&gt;
==Синтаксис== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
element guiCreateLabel ( float x, float y, float width, float height, string text, bool relative, [element parent = nil] )&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 GUI label 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 GUI label on a player's screen. This is affected by the ''relative'' argument.&lt;br /&gt;
*'''width:''' A float of the width of the GUI label. This is affected by the ''relative'' argument.&lt;br /&gt;
*'''height:''' A float of the height of the GUI label. This is affected by the ''relative'' argument.&lt;br /&gt;
*'''text:''' A string of the text that will be displayed by the label.&lt;br /&gt;
*'''relative:''' This is whether sizes and positioning are relative.  If this is ''true'', then all x,y,width,height floats must be between 0 and 1, representing sizes relative to the parent.&lt;br /&gt;
===Обязательные аргументы=== &lt;br /&gt;
[[Image:gui-window.png|frame|Пример окна.]]&lt;br /&gt;
*'''x:''' Позиция метки по оси X на экране игрока. Зависит от аргумента ''relative''.&lt;br /&gt;
*'''y:''' Позиция метки по оси Y на экране игрока. Зависит от аргумента ''relative''.&lt;br /&gt;
*'''width:''' Ширина метки. Зависит от аргумента ''relative''.&lt;br /&gt;
*'''height:''' Высота метки. Зависит от аргумента ''relative''.&lt;br /&gt;
*'''titleBarText:''' Строка с текстом который будет выведен как метка.&lt;br /&gt;
*'''relative:''' Определяет, относительны ли позиция и размер. Если указано ''true'', то значения аргументов ''x, y, width'' и ''height'' должны быть между 0 и 1, относительны к размеру родителя.&lt;br /&gt;
&lt;br /&gt;
===Необязательные параметры=== &lt;br /&gt;
{{OptionalArg}} &lt;br /&gt;
*'''parent:''' Родительский элемент к которому будет прикреплена.  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;
&lt;br /&gt;
===Возвращает===&lt;br /&gt;
Возвращает [[GUI_widgets|элемент]] в случае успешного создания, ''false'' в противном случае.&lt;br /&gt;
&lt;br /&gt;
==Пример== &lt;br /&gt;
'''Example 1:''' This example creates a information window and adds two tabs to a &amp;quot;tabPanel&amp;quot; tabpanel, and adds some gui labels to each tab.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local myWindow = guiCreateWindow ( 0, 0, 0.5, 0.4, &amp;quot;Information&amp;quot;, true )--create a window which has &amp;quot;Information&amp;quot; in the title bar.&lt;br /&gt;
local tabPanel = guiCreateTabPanel ( 0, 0.1, 1, 1, true, myWindow ) --create a tab panel which fills the whole window&lt;br /&gt;
local tabMap = guiCreateTab( &amp;quot;Map Information&amp;quot;, tabPanel ) -- create a tab named &amp;quot;Map Information&amp;quot; on 'tabPanel'&lt;br /&gt;
local tabHelp = guiCreateTab( &amp;quot;Help&amp;quot;, tabPanel ) -- create another tab named &amp;quot;Help&amp;quot; on 'tabPanel'&lt;br /&gt;
&lt;br /&gt;
-- adds a label (text) to each tab&lt;br /&gt;
guiCreateLabel(0.02,0.04,0.94,0.2,&amp;quot;This is information about the current map&amp;quot;,true,tabMap)&lt;br /&gt;
guiCreateLabel(0.02,0.04,0.94,0.92,&amp;quot;This is help text.&amp;quot;,true,tabHelp)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Example 2:''' This example creates a label.  When an element is clicked, the label displays in the position of the element telling you what kind of element you have clicked.  It hides after 5 seconds.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local myLabel = guiCreateLabel  ( 0, 0, 1, 1, &amp;quot;&amp;quot;, true )&lt;br /&gt;
&lt;br /&gt;
function addLabelOnClick ( button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement )&lt;br /&gt;
        --if an element was clicked on screen&lt;br /&gt;
        if ( clickedElement ) then&lt;br /&gt;
                --retreive the element type&lt;br /&gt;
                local elementType = getElementType ( clickedElement )&lt;br /&gt;
                --change the label text to that element type&lt;br /&gt;
                guiSetText ( myLabel, elementType )&lt;br /&gt;
                --and place it in the position of where the element is&lt;br /&gt;
                guiSetPosition ( myLabel, absoluteX, absoluteY, false )&lt;br /&gt;
                --hide the text by passing an empty string 5 seconds later&lt;br /&gt;
                setTimer ( guiSetText, 5000, 1, myLabel, &amp;quot;&amp;quot; )&lt;br /&gt;
        end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onClientClick&amp;quot;, getRootElement(), addLabelOnClick )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Смотрите также==&lt;br /&gt;
{{RU/GUI_functions}}&lt;br /&gt;
[[en:guiCreateLabel]]&lt;/div&gt;</summary>
		<author><name>Fabervox</name></author>
	</entry>
</feed>