<?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=Morozzzko</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=Morozzzko"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/Morozzzko"/>
	<updated>2026-04-12T22:35:27Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=RU/Meta.xml&amp;diff=22036</id>
		<title>RU/Meta.xml</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=RU/Meta.xml&amp;diff=22036"/>
		<updated>2009-12-13T19:25:25Z</updated>

		<summary type="html">&lt;p&gt;Morozzzko: /* Возможные тэги */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{translate}}&lt;br /&gt;
Этот файл имеет очень важное содержание, которое позволяет загрузить ресурс/режим/карту. Вам нужно указать имена файлов, которые ваш скрипт/режим e (resource) будет использовать в файле '''meta.xml'''. Если вы хотите отображать изображение на экране клиента, клиент должен сначала загрузить его. Чтобы сервер знал, что вы хотите использовать изображение, нужно прописать имя файла в meta.xml. Если вам нужно использовать какие-то настройки для скрипта в качестве переменных, вы можете прописать их в тэге &amp;lt;settings&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Примечание: Вы можете опробывать простой генератор meta.xml, созданный 50p: http://forum.mtasa.com/viewtopic.php?f=91&amp;amp;t=22247&lt;br /&gt;
&lt;br /&gt;
== Возможные тэги ==&lt;br /&gt;
Тэги в .xml такие же, как в . html. Файл meta.xml имеет множество тэгов, необходимых и опциональных. У них есть свои атрибуты.&lt;br /&gt;
Язык XML не умеет формировать тэги, он служит как простой способ хранения данных. Интерпретацией тэгов занимаются скрипты, то есть '''вы можете определять новые тэги в XML'''. Однако, MTA определяет несколько тэгов самостоятельно, они приведены ниже:&lt;br /&gt;
&lt;br /&gt;
*'''&amp;lt;info /&amp;gt;''' Информация о данном ресурсе, possible parameters include (any arbitrary parameters can be used and read using [[getResourceInfo]]):&lt;br /&gt;
** '''author:''' Автор&lt;br /&gt;
** '''version:''' Версия&lt;br /&gt;
** '''name:''' Название&lt;br /&gt;
** '''description:''' Описание&lt;br /&gt;
** '''type:''' Тип ресурса, может быть &amp;quot;gamemode&amp;quot;, &amp;quot;script&amp;quot;, &amp;quot;map&amp;quot; or &amp;quot;misc&amp;quot;.&lt;br /&gt;
*'''&amp;lt;script /&amp;gt;''' Source code for this resource, possible parameters are:&lt;br /&gt;
** '''src:''' The file name of the source code&lt;br /&gt;
** '''type:''' The type of source code: &amp;quot;client&amp;quot; or &amp;quot;server&amp;quot;&lt;br /&gt;
*'''&amp;lt;map /&amp;gt;''' The map for a gamemode, possible parameters are:&lt;br /&gt;
**'''src:''' .map file name (can be path too eg. &amp;quot;maps/filename.map&amp;quot;)&lt;br /&gt;
**'''dimension:''' Dimension in which the map will be loaded (optional)&lt;br /&gt;
*'''&amp;lt;file /&amp;gt;''' A client-side file. Generally these are images, .txd, .col, .dff or .xml files. They'll be downloaded by clients when the resources is started (or on join)&lt;br /&gt;
**'''src:''' client-side file name (can be path too eg. &amp;quot;images/image.png&amp;quot;)&lt;br /&gt;
*'''&amp;lt;include /&amp;gt;''' Include resources that this resource will use&lt;br /&gt;
**'''resource:''' Resource name that you want to start with this resource&lt;br /&gt;
**'''minversion:''' Minimum version that '''resource''' needs to be (optional)&lt;br /&gt;
**'''maxversion:''' Maximum version that '''resource''' needs to be (optional)&lt;br /&gt;
*'''&amp;lt;config /&amp;gt;''' Config file (.xml) can be accessed by resource, possible parameters are:&lt;br /&gt;
**'''src:''' The file name of the config file&lt;br /&gt;
**'''type:''' The type of the config file: &amp;quot;client&amp;quot; or &amp;quot;server&amp;quot;&lt;br /&gt;
*'''&amp;lt;export /&amp;gt;''' This exports functions from this resource, so other resources can use them with [[call]]&lt;br /&gt;
**'''function:''' The function name&lt;br /&gt;
**'''type''' Whether function is exported server-side or client-side (valid values are: &amp;quot;server&amp;quot; and &amp;quot;client&amp;quot;)&lt;br /&gt;
**'''http:''' Can the function be called via HTTP (true/false)&lt;br /&gt;
*'''&amp;lt;html /&amp;gt;'''&lt;br /&gt;
**'''src:''' The filename for the HTTP file (can be a path)&lt;br /&gt;
**'''default:''' The html file is one that is shown by default when visiting /resourceName/ on the server. Only one html can be default, the rest are ignored. (true/false)&lt;br /&gt;
**'''raw:''' The html file is not parsed by the LUA interpreter and is treated as binary data. Must be used for binary files (images mainly) (true/false)&lt;br /&gt;
*'''&amp;lt;settings&amp;gt; &amp;lt;setting name=&amp;quot;&amp;quot; value=&amp;quot;&amp;quot;/&amp;gt; &amp;lt;/settings&amp;gt;:''' Most gamemodes use [[settings system]] to let server admins to configure it how they like. For instance you could set round time and then use [[get]] and [[set]] to get the value or change it, respectively.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
Heres an example of a meta file using some of the tags mentioned:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot; lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info author=&amp;quot;Slothman&amp;quot; type=&amp;quot;gamemode&amp;quot; name=&amp;quot;Stealth&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;config src=&amp;quot;help.xml&amp;quot; type=&amp;quot;client&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;script src=&amp;quot;stealthmain_server.lua&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;noiseblip.lua&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;mission_timer.lua&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;gadgets_server.lua&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;gadgets_client.lua&amp;quot; type=&amp;quot;client&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;stealthmain_client.lua&amp;quot; type=&amp;quot;client&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;noisebar.lua&amp;quot; type=&amp;quot;client&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;spycam.lua&amp;quot; type=&amp;quot;client&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;file src=&amp;quot;riot_shield.txd&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;riot_shield.dff&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;riot_shield.col&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;armor.png&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;camera.png&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;cloak.png&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;goggles.png&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;mine.png&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;radar.png&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;shield.png&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;include resource=&amp;quot;scoreboard&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;include resource=&amp;quot;killmessages&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;include resource=&amp;quot;maplimits&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;settings&amp;gt;&lt;br /&gt;
         &amp;lt;setting name=&amp;quot;roundlimit&amp;quot; value=&amp;quot;[6]&amp;quot; /&amp;gt; &amp;lt;!-- round length in minutes --&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;teamdamage&amp;quot; value=&amp;quot;[1]&amp;quot; /&amp;gt; &amp;lt;!-- 0 for team protection off, 1 for team protection on --&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;teambalance&amp;quot; value=&amp;quot;[1]&amp;quot; /&amp;gt; &amp;lt;!--  difference limit of amount of players between teams --&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;spazammo&amp;quot; value=&amp;quot;[25]&amp;quot; /&amp;gt; &amp;lt;!-- ammo amounts --&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;m4ammo&amp;quot; value=&amp;quot;[100]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;shotgunammo&amp;quot; value=&amp;quot;[25]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;sniperammo&amp;quot; value=&amp;quot;[20]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;ak47ammo&amp;quot; value=&amp;quot;[120]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;rifleammo&amp;quot; value=&amp;quot;[40]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;deserteagleammo&amp;quot; value=&amp;quot;[45]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;pistolammo&amp;quot; value=&amp;quot;[132]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;uziammo&amp;quot; value=&amp;quot;[150]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;tec9ammo&amp;quot; value=&amp;quot;[150]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;silencedammo&amp;quot; value=&amp;quot;[65]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;grenadeammo&amp;quot; value=&amp;quot;[4]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;satchelammo&amp;quot; value=&amp;quot;[4]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;teargasammo&amp;quot; value=&amp;quot;[4]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;molatovammo&amp;quot; value=&amp;quot;[4]&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;/settings&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Category:Scripting Concepts]]&lt;br /&gt;
[[Category:Incomplete]]&lt;br /&gt;
[[en:Meta.xml]]&lt;/div&gt;</summary>
		<author><name>Morozzzko</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=%D0%92%D0%B2%D0%B5%D0%B4%D0%B5%D0%BD%D0%B8%D0%B5_%D0%B2_%D1%81%D0%BA%D1%80%D0%B8%D0%BF%D1%82%D0%B8%D0%BD%D0%B3_GUI&amp;diff=22030</id>
		<title>Введение в скриптинг GUI</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=%D0%92%D0%B2%D0%B5%D0%B4%D0%B5%D0%BD%D0%B8%D0%B5_%D0%B2_%D1%81%D0%BA%D1%80%D0%B8%D0%BF%D1%82%D0%B8%D0%BD%D0%B3_GUI&amp;diff=22030"/>
		<updated>2009-12-09T17:52:36Z</updated>

		<summary type="html">&lt;p&gt;Morozzzko: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- place holder --&amp;gt;&lt;br /&gt;
Одна из важных особенностей MTA:SA - возможность создания собственного GUI (графический пользовательский интерфейс). Графический интерфейс состоит из окон, кнопок, текстовых полей... Проще говоря, из всех стандартных компонент графических интерфейсов. Они могут использоваться пока пользователь в игре, и использоваться для ввода/вывода вместо команд. &lt;br /&gt;
&lt;br /&gt;
[[Image:AdminGUI.png|thumb|Admin Console GUI]]&lt;br /&gt;
&lt;br /&gt;
==Руководство по созданию интерфейса авторизации==&lt;br /&gt;
В этом руководстве мы сделаем простое окно авторизаци с двумя полями ввода и кнопкой. Окно появляется, когда игрок подключается к игре, и после того, как нажата кнопка, игрок респаунится. Это руководство - продолжение предыдущего ([[RU/Scripting Introduction|Введение в скриптинг]]). Теперь мы познакомимся с написанием клиентских скриптов. &lt;br /&gt;
&lt;br /&gt;
===Отрисовка окна===&lt;br /&gt;
GUI работает на стороне клиента. Хорошим решением будет поместить все клиентские скрипты в отдельный каталог. Перейдите в каталог /Ваш сервер MTA/mods/deathmatch/resources/myserver/ и создайте подкаталог &amp;quot;client&amp;quot;. В нём создайте текстовый файл и назовите его &amp;quot;gui.lua&amp;quot;. В этом файле мы напишем функцию, отображающую окно:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function CreateLoginWindow()&lt;br /&gt;
	local X = 0.375&lt;br /&gt;
	local Y = 0.375&lt;br /&gt;
	local Width = 0.25&lt;br /&gt;
	local Height = 0.25&lt;br /&gt;
	wdwLogin = guiCreateWindow(X, Y, Width, Height, &amp;quot;Please Log In&amp;quot;, true)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Вы можете кликнуть по имени функции, чтобы прочитать её описание. Заметьте, что координаты окна задаются в ''процентах'' от размеров экрана. Это значит, что левая граница экрана по ширине принимается за 0, а правая за 1, соответственно, &amp;quot;X&amp;quot; равное 0.5 обозначает середину экрана. Аналогично и для позиции по высоте, ширины и высоты окна (если &amp;quot;width&amp;quot; равно 0.5, окно будет в половину ширины экрана). Теперь мы добавим текстовые меткм (с надписями &amp;quot;username:&amp;quot; и &amp;quot;password:&amp;quot;), поля ввода и кнопку. Замените функцию её полной версией:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function CreateLoginWindow()&lt;br /&gt;
	local X = 0.375&lt;br /&gt;
	local Y = 0.375&lt;br /&gt;
	local Width = 0.25&lt;br /&gt;
	local Height = 0.25&lt;br /&gt;
	wdwLogin = guiCreateWindow(X, Y, Width, Height, &amp;quot;Please Log In&amp;quot;, true)&lt;br /&gt;
	&lt;br /&gt;
	X = 0.0825&lt;br /&gt;
	Y = 0.2&lt;br /&gt;
	Width = 0.25&lt;br /&gt;
	Height = 0.25&lt;br /&gt;
	guiCreateLabel(X, Y, Width, Height, &amp;quot;Username&amp;quot;, true, wdwLogin)&lt;br /&gt;
	Y = 0.5&lt;br /&gt;
	guiCreateLabel(X, Y, Width, Height, &amp;quot;Password&amp;quot;, true, wdwLogin)&lt;br /&gt;
	&lt;br /&gt;
	X = 0.415&lt;br /&gt;
	Y = 0.2&lt;br /&gt;
	Width = 0.5&lt;br /&gt;
	Height = 0.15&lt;br /&gt;
	edtUser = guiCreateEdit(X, Y, Width, Height, &amp;quot;&amp;quot;, true, wdwLogin)&lt;br /&gt;
	Y = 0.5&lt;br /&gt;
	edtPass = guiCreateEdit(X, Y, Width, Height, &amp;quot;&amp;quot;, true, wdwLogin)&lt;br /&gt;
	guiEditSetMaxLength(edtUser, 50)&lt;br /&gt;
	guiEditSetMaxLength(edtPass, 50)&lt;br /&gt;
	&lt;br /&gt;
	X = 0.415&lt;br /&gt;
	Y = 0.7&lt;br /&gt;
	Width = 0.25&lt;br /&gt;
	Height = 0.2&lt;br /&gt;
	btnLogin = guiCreateButton(X, Y, Width, Height, &amp;quot;Log In&amp;quot;, true, wdwLogin)&lt;br /&gt;
	&lt;br /&gt;
	guiSetVisible(wdwLogin, false)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Обратите внимание на то, что каждый компонент интерфейса является дочерним по отношению к окну, это достигается указанием родительского элемента (wdwLogin, в данном случае) при создании элемента:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
guiCreateLabel(X, Y, Width, Height, &amp;quot;Password&amp;quot;, true, wdwLogin)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Это очень удобно, т.к. в дальнейшем, при отображении окна, можно обращаться только к родительскому элементу. К примеру:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
guiSetVisible(wdwLogin, false) --прячет всё окно целиком так, что мы можем показать его игроку в любой момент. &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Для редактироования GUI вы также можете воспользоваться [[RU/Resource:GUI_Editor | редактором GUI]].&lt;br /&gt;
&lt;br /&gt;
===Использование написаной нами функции===&lt;br /&gt;
Функция CreateLoginWindow написана, но она не будет работать, пока мы её не вызовем. Рекомендуется создавать все окна при запуске ресурса на клиенте, прятать их, и показывать игроку позднее, когда они понадобятся. Для этого напишем обработчик события &amp;quot;[[onClientResourceStart]]&amp;quot;, в котором будем создавать окно:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onClientResourceStart&amp;quot;, getResourceRootElement(getThisResource()), &lt;br /&gt;
	function ()&lt;br /&gt;
		CreateLoginWindow()&lt;br /&gt;
	end&lt;br /&gt;
)	&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Мы хотим показывать окно когда клиент подключается к игре, используя то же событие &amp;quot;[[onClientResourceStart]]&amp;quot;. Теперь обработчик выглядит так:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onClientResourceStart&amp;quot;, getResourceRootElement(getThisResource()), &lt;br /&gt;
	function ()&lt;br /&gt;
		CreateLoginWindow()&lt;br /&gt;
&lt;br /&gt;
                outputChatBox(&amp;quot;Welcome to My MTA DM Server, please log in.  &amp;quot;)&lt;br /&gt;
&lt;br /&gt;
	        if (wdwLogin ~= nil) then&lt;br /&gt;
		         guiSetVisible(wdwLogin, true)&lt;br /&gt;
	        end &lt;br /&gt;
&lt;br /&gt;
	        showCursor(true)&lt;br /&gt;
	        guiSetInputEnabled(true)&lt;br /&gt;
	end&lt;br /&gt;
)	&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Заметьте, что мы выполняем проверку перед показом окна, так, в случае, если окно не создано, не возникнет ошибки. Функция [[showCursor]] включает управление мышью, а [[guiSetInputEnabled]] позволяет быть уверенным, что использование при вводе некоторых клавиш, таких как &amp;quot;A&amp;quot;, &amp;quot;S&amp;quot;, &amp;quot;D&amp;quot;, &amp;quot;W&amp;quot;, &amp;quot;T&amp;quot;, не приведёт к движению персонажа, или вводу текста в чате. На следующем шаге мы заставим кнопку работать так, как задумывалось.&lt;br /&gt;
&lt;br /&gt;
===Обработчик нажатия кнопки===&lt;br /&gt;
Когда пользователь кликает по любому элементу интерфейса, генерируется событие &amp;quot;[[onClientGUIClick]]&amp;quot; для этого элемента. К примеру, если вы кликните по кнопке, можно добавить обработчик для этого события:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onClientGUIClick&amp;quot;, theButtonElement, theHandlerFunction, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
В нашем скрипте требуется только обработчик привязанный к кнопке. При клике по ней, клиент должен сообщить серверу, что нужно респаунить игрока. Найдите обработчик события &amp;quot;onClientResourceStart&amp;quot; из предыдущей части и добавьте следующую строку сразу ПОСЛЕ вызова CreateLoginWindow() :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onClientGUIClick&amp;quot;, btnLogin, clientSubmitLogin, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Обработчик должен быть добавлен здесь, чтобы быть уверенным, что переменная btnLogin содержит существующую кнопку. Нельзя привязать событие к несуществующему элементу. Вы, должно быть, заметили, что нам потребуется функция &amp;quot;clientSubmitLogin&amp;quot;, вызываемая в предыдущей строке.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function clientSubmitLogin(button, state)&lt;br /&gt;
	if (button == &amp;quot;left&amp;quot; and state == &amp;quot;up&amp;quot;) then&lt;br /&gt;
		&lt;br /&gt;
		triggerServerEvent(&amp;quot;SubmitLogin&amp;quot;, getRootElement(), guiGetText(edtUser), guiGetText(edtPass))&lt;br /&gt;
		guiSetInputEnabled(false)&lt;br /&gt;
		guiSetVisible(wdwLogin, false)&lt;br /&gt;
		showCursor(false)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Переменная &amp;quot;button&amp;quot; передается обработчиком события и содержит строку с именем этой кнопки (к примеру &amp;quot;left&amp;quot; или &amp;quot;right&amp;quot;). Здесь мы познакомились с новой концепцией пользовательских событий. Пользовательские события могут генерироваться как на одной стороне, так и на разных (с сервера на клиент и наоборот). Мы используем функцию [[triggerServerEvent]], чтобы сгенерировать событие &amp;quot;SubmitLogin&amp;quot; на сервере.&lt;br /&gt;
&lt;br /&gt;
Теперь у нас есть весь необходимый клиентский код. На сервере, как вы помните, мы спавним игрока как только он подключается к серверу: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function joinHandler()&lt;br /&gt;
	local x,y,z&lt;br /&gt;
	x = 1959.55&lt;br /&gt;
	y = -1714.46&lt;br /&gt;
	z = 10&lt;br /&gt;
	spawnPlayer(source, x, y, z)&lt;br /&gt;
	fadeCamera(source, true)&lt;br /&gt;
	outputChatBox(&amp;quot;Welcome to My Server&amp;quot;, source)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, getRootElement(), joinHandler)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Так как теперь мы должны спавнить игрока после нажатия на кнопку, нам нужно заменить событие &amp;quot;onPlayerJoin&amp;quot; пользовательским событием, генерируемым клиентом. Замените приведенный выше код следующим образом:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function joinHandler(username, password)&lt;br /&gt;
	local x,y,z&lt;br /&gt;
	x = 1959.55&lt;br /&gt;
	y = -1714.46&lt;br /&gt;
	z = 10&lt;br /&gt;
        if (client) then&lt;br /&gt;
	      spawnPlayer(client, x, y, z)&lt;br /&gt;
	      fadeCamera(client, true)&lt;br /&gt;
	      outputChatBox(&amp;quot;Welcome to My Server&amp;quot;, client)&lt;br /&gt;
        end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEvent(&amp;quot;SubmitLogin&amp;quot;, true)&lt;br /&gt;
addEventHandler(&amp;quot;SubmitLogin&amp;quot;, getRootElement(), joinHandler)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Обратите внимание на второй параметр функции [[addEvent]] (имеющий значение &amp;quot;true&amp;quot;), он указывает, что событие может быть сгенерировано другой стороной. так же заметьте, что &amp;quot;client&amp;quot; - внутренняя переменная, используемая MTA для идентификации игрока, сгенерировавшего событие. &lt;br /&gt;
&lt;br /&gt;
И, наконец, не забудьте добавить файл gui.lua в meta.xml основного ресурса и пометть его как клиентский:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;client/gui.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Теперь у нас есть минимальное окно авторизации, спавнящее игрока при нажатии кнопки &amp;quot;login&amp;quot;. Вы также можете использовать логин и пароль, передаваемые функцией [[triggerServerEvent]] для идентификации пользователя.&lt;br /&gt;
&lt;br /&gt;
[[en:Introduction_to_Scripting_GUI]]&lt;br /&gt;
[[it:Introduzione_allo_scripting_della_GUI]]&lt;/div&gt;</summary>
		<author><name>Morozzzko</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=IsVehicleTaxiLightOn&amp;diff=22003</id>
		<title>IsVehicleTaxiLightOn</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=IsVehicleTaxiLightOn&amp;diff=22003"/>
		<updated>2009-12-01T17:01:47Z</updated>

		<summary type="html">&lt;p&gt;Morozzzko: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
[[Category:Needs_Example]]&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function will get the taxi light state of a taxi (vehicle ID's 420 and 438)&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 isVehicleTaxiLightOn ( vehicle taxi )              &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''taxi:''' The vehicle element of the taxi that you wish to get the light state of.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the light is on, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&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;
This example binds the 'o' key to a function that toggles the taxi's light on and off, if you're in a taxi.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function toggleTaxiLight()&lt;br /&gt;
	local gamer = getLocalPlayer()&lt;br /&gt;
	local car = getPedOccupiedVehicle(gamer)&lt;br /&gt;
	if gamer == getVehicleOccupant(car, 0) then -- if is a driver&lt;br /&gt;
		local lights = getVehicleTaxiLightOn(car) -- getting vehicle lights state&lt;br /&gt;
		local id = getElementModel(car) -- getting vehicle model&lt;br /&gt;
		if ((id == 420) or (id== 438)) then -- if is a taxi&lt;br /&gt;
			setVehicleTaxiLightOn(car, not lights) -- switch lights&lt;br /&gt;
		end&lt;br /&gt;
	end	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
bind(&amp;quot;o&amp;quot;, &amp;quot;down&amp;quot;, toggleTaxiLight) -- binding the function&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;
==See Also==&lt;br /&gt;
{{vehicle functions}}&lt;/div&gt;</summary>
		<author><name>Morozzzko</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=RU/Writing_Gamemodes&amp;diff=21994</id>
		<title>RU/Writing Gamemodes</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=RU/Writing_Gamemodes&amp;diff=21994"/>
		<updated>2009-11-30T13:32:27Z</updated>

		<summary type="html">&lt;p&gt;Morozzzko: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{translate}}&lt;br /&gt;
Это руководство поможет вам, как написать правильный режим игры. Если вы только что начали писать скрипты для MTA, вы должны сначала просмотреть другие учебники на [[RU/Main Page|Главная страница]].&lt;br /&gt;
==Введение==&lt;br /&gt;
Gamemode (ГМ, мод, гейммод) - ресурс, который, будучи запущенным, контролирует весь игровой процесс. Гейммод включает в себя посылку сообщений игрокам - указания к действиям; респауном игроков; созданием команд; указанием, что игрокам надо делать для победы, или для получения очков, и т.д. Примеры - гонки и DeatMatch'и&lt;br /&gt;
&lt;br /&gt;
==What does &amp;quot;proper gamemode&amp;quot; mean?==&lt;br /&gt;
To put it simply, a proper gamemode is one that makes full use of MTA's .map file system. This means that the gamemode code does not have any map-specific data hardcoded in it, like positions of players or cars. Instead, the gamemode should be able to load .map files which define these data. This way the gamemode can have multiple maps; also, people can create .map files for the gamemode with MTA's map editor, which is much more convenient than writing code.&lt;br /&gt;
&lt;br /&gt;
An obvious example of a &amp;quot;proper gamemode&amp;quot; is MTA:Race. It allows usermade maps with lots of possibilities within the .map file. To alter spawnpoints, objects etc., the user doesn't need to edit the gamemode itself.&lt;br /&gt;
&lt;br /&gt;
===Map Files===&lt;br /&gt;
Map files are basically XML documents with a .map extension. They define an environment to play one or more specific gamemodes in. They are however not supposed to change the rules of the game - those are defined by the gamemode.&lt;br /&gt;
&lt;br /&gt;
Each element in a map corresponds to a node in the .map file. There is standard syntax for common things like spawnpoints, objects and vehicles; however, for &amp;quot;special&amp;quot;, gamemode specific information, you need to invent your own syntax.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
Let's take a Capture the Flag gamemode as an example. A map for this gamemode needs to mainly define spawnpoints and flag locations, and eventually objects and vehicles. A simplified map file could look like this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;map&amp;gt;&lt;br /&gt;
    &amp;lt;spawnpoint id=&amp;quot;spawnpoint1&amp;quot; posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;877.25219726563&amp;quot; rot=&amp;quot;63.350006103516&amp;quot; model=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;pickup id=&amp;quot;Armor 1&amp;quot; posX=&amp;quot;1911.083984375&amp;quot; posY=&amp;quot;-1658.8798828125&amp;quot; posZ=&amp;quot;885.40216064453&amp;quot; type=&amp;quot;armor&amp;quot; health=&amp;quot;50&amp;quot; respawn=&amp;quot;60000&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;flag posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;877.25219726563&amp;quot; team=&amp;quot;blue&amp;quot; /&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you can see two MTA elements - a spawnpoint and a pickup. More importantly, this .map has a custom &amp;quot;flag&amp;quot; node which defines the position and color of the flag. The spawnpoint and pickup can be handled by existing external resources, custom elements have to be processed by the gamemode.&lt;br /&gt;
&lt;br /&gt;
To summarize - we want mass mapper input as we saw in MTA:Race. Users should NOT have to touch the gamemode script itself at all.&lt;br /&gt;
&lt;br /&gt;
====Example of getting the .map information====&lt;br /&gt;
As mentioned above, your gamemode needs de retrieve custom elements that are defined in a map file and process them. This is quite easy as demonstrated below.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- retrieve a table with all flag elements&lt;br /&gt;
local flagElements = getElementsByType ( &amp;quot;flag&amp;quot; )&lt;br /&gt;
-- loop through them&lt;br /&gt;
for key, value in pairs(flagElements) do&lt;br /&gt;
	-- get our info&lt;br /&gt;
	local posX = getElementData ( value, &amp;quot;posX&amp;quot; )&lt;br /&gt;
	local posY = getElementData ( value, &amp;quot;posY&amp;quot; )&lt;br /&gt;
	local posZ = getElementData ( value, &amp;quot;posZ&amp;quot; )&lt;br /&gt;
	local team = getElementData ( value, &amp;quot;team&amp;quot; )&lt;br /&gt;
	-- create an object according to the flag position&lt;br /&gt;
	createObject ( 1337, posX, posY, posZ )&lt;br /&gt;
	-- output the team that we created a base for&lt;br /&gt;
	outputChatBox ( &amp;quot;Base for team &amp;quot; .. team .. &amp;quot; created&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The [[getElementsByType]] function retrieves a table of all the elements of a certain type (the type corresponds to the node name in the .map file). This works for both custom types and built-in MTA types (like &amp;quot;vehicle&amp;quot; or &amp;quot;player&amp;quot;).&lt;br /&gt;
[[getElementData]] can be used to retrieve the xml attributes set in the .map file.&lt;br /&gt;
In this simple example, an object is created at the flag's location and a message is outputted in the chatbox. In reality, you will of course need to do more during map loading, like in this case setting up collision shapes to detect players taking the flag.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Map manager==&lt;br /&gt;
Having read the section above it should be clear that a gamemode should always consist of two parts:&lt;br /&gt;
* The gamemode resource that always stays the same&lt;br /&gt;
* Many different maps resources that give the gamemode map-specific information&lt;br /&gt;
&lt;br /&gt;
Now instead of writing a map-loader for every single gamemode, the [[Map manager]] provides functions to load gamemodes and maps. Simply put, when you enter the correct command (for example 'gamemode ctf ctf-italy') it will start both resources 'ctf' and 'ctf-italy' while triggering an event ([[onGamemodeMapStart]]) to tell the 'ctf' resource that a map was loaded. The 'ctf' resource can then access the information 'ctf-italy' contains and start spawning players etc.&lt;br /&gt;
&lt;br /&gt;
===How to use the mapmanager===&lt;br /&gt;
To use the mapmanager service, your gamemode resource has to be tagged as such first. More specifically you'll be setting the &amp;quot;type&amp;quot; attribute of its &amp;lt;info&amp;gt; tag to &amp;quot;gamemode&amp;quot; inside meta.xml. Also, you can set the &amp;quot;name&amp;quot; attribute to a friendly name (like &amp;quot;Capture the flag&amp;quot;) that will be shown on ASE instead of the resource name.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- meta.xml in &amp;quot;cowcatapult&amp;quot; gamemode --&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info type=&amp;quot;gamemode&amp;quot; name=&amp;quot;Cow catapulting 2.0&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;
If your gamemode is going to load custom maps, you should add handlers for&lt;br /&gt;
* onGamemodeMapStart&lt;br /&gt;
* onGamemodeMapStop (if any unloading is necessary)&lt;br /&gt;
These are fired when a map for your gamemode is started or stopped, and pass the map resource as a parameter.&lt;br /&gt;
Within the handler function for these events you can extract all info you need from the resource's map files and configuration files.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function startCtfMap( startedMap ) -- startedMap contains a reference to the resource of the map&lt;br /&gt;
    local mapRoot = getResourceRootElement( startedMap )        -- get the root node of the started map&lt;br /&gt;
    local flagElements = getElementsByType ( &amp;quot;flag&amp;quot; , mapRoot ) -- get all flags in the map and store them in a table&lt;br /&gt;
    -- go on loading information like in the example above&lt;br /&gt;
&lt;br /&gt;
    -- spawn players etc.&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEventHandler(&amp;quot;onGamemodeMapStart&amp;quot;, getRootElement(), startCtfMap)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Making maps compatible===&lt;br /&gt;
Maps are separate resources. This is done so no editing of the gamemode resource is ever necessary in order to create a custom map, and also allows you to pack map-specific scripts/config files with them.&lt;br /&gt;
&lt;br /&gt;
To make a map compatible with your gamemode, open its resource's meta.xml and tag it as well: the &amp;quot;type&amp;quot; attribute must be set to &amp;quot;map&amp;quot;, and the &amp;quot;gamemodes&amp;quot; attribute must be a comma-separated list (no spaces) of gamemode resource names that the map works with.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!--map's meta.xml--&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;cowcatapult,assault,tdm&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;
Once you have everything set up, admins will use these two commands to start/stop gamemodes:&lt;br /&gt;
/gamemode gamemodeName [mapName] (optional parameter allows picking an initial map, defaults to none)&lt;br /&gt;
/changemap mapName [gamemodeName] (optional parameter specifies the gamemode to start the map with, defaults to the current one)&lt;br /&gt;
&lt;br /&gt;
[[Map manager]] exports a few more access functions which you don't have to use, but may be useful.&lt;br /&gt;
&lt;br /&gt;
==What else should you do==&lt;br /&gt;
There are several other resources that gamemodes should use/be compliant with.&lt;br /&gt;
&lt;br /&gt;
===Helpmanager===&lt;br /&gt;
The helpmanager is ought to be the standard interface for players when they need help. If you use the helpmanager to display your gamemode's help, every player that used helpmanager before (e.g. in other gamemodes) will immediately know how to get there. It also displays help for different resources running resources in one window, if necessary.&lt;br /&gt;
&lt;br /&gt;
There are basicially two ways to use the helpmanager:&lt;br /&gt;
* Provide a simple text that explains how to use your gamemode&lt;br /&gt;
* Request a GUI element from the helpmanager that will be displayed in its own tab in the helpmanager window and lets you add any GUI elements to it. This is the recommended way for gamemodes that need to display more complex information that needs its own GUI.&lt;br /&gt;
&lt;br /&gt;
Read the helpmanager page for details on how to do it.&lt;br /&gt;
&lt;br /&gt;
===Scoreboard===&lt;br /&gt;
Scoreboard displays players and teams currently ingame. You add custom columns to it to provide map specific information. For example the column 'points' in the 'ctf' gamemode could represent the player's points gained through kills or captures. As usual, see the scoreboard help page for more information.&lt;br /&gt;
&lt;br /&gt;
===Map cycler===&lt;br /&gt;
The map cycler controls what gamemodes and maps are played on a server. You can specifiy for example how many times in a row a map will be played until it switches to the next. To achieve this, you need to tell the map cycler when your gamemode finished (e.g. when a round ends).&lt;br /&gt;
&lt;br /&gt;
[[en:Writing Gamemodes]]&lt;br /&gt;
[[it:Scrivere una gamemode]]&lt;/div&gt;</summary>
		<author><name>Morozzzko</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=IsVehicleTaxiLightOn&amp;diff=21993</id>
		<title>IsVehicleTaxiLightOn</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=IsVehicleTaxiLightOn&amp;diff=21993"/>
		<updated>2009-11-30T12:43:21Z</updated>

		<summary type="html">&lt;p&gt;Morozzzko: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
[[Category:Needs_Example]]&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function will get the taxi light state of a taxi (vehicle ID's 420 and 438)&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 isVehicleTaxiLightOn ( vehicle taxi )              &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''taxi:''' The vehicle element of the taxi that you wish to get the light state of.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the light is on, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&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;
function myfunction()&lt;br /&gt;
	local player = getLocalPlayer()&lt;br /&gt;
	local vehicle = getPlayerOccupiedVehicle(player)&lt;br /&gt;
	if player == getVehicleOccupant(vehicle, 0) then -- if is a driver&lt;br /&gt;
		local lights = getVehicleTaxiLightOn(vehicle) -- getting vehicle lights state&lt;br /&gt;
		local id = getElementModel(vehicle) -- getting vehicle model&lt;br /&gt;
		if ((id == 420) or (id== 438)) then -- if is a taxi&lt;br /&gt;
			setVehicleTaxiLightOn(vehicle, not lights) -- switch lights&lt;br /&gt;
		end&lt;br /&gt;
	end	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
bind(&amp;quot;o&amp;quot;, &amp;quot;down&amp;quot;, myfunction) -- binding the function&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;
==See Also==&lt;br /&gt;
{{vehicle functions}}&lt;/div&gt;</summary>
		<author><name>Morozzzko</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=IsVehicleTaxiLightOn&amp;diff=21992</id>
		<title>IsVehicleTaxiLightOn</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=IsVehicleTaxiLightOn&amp;diff=21992"/>
		<updated>2009-11-30T12:43:08Z</updated>

		<summary type="html">&lt;p&gt;Morozzzko: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
[[Category:Needs_Example]]&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function will get the taxi light state of a taxi (vehicle ID's 420 and 438)&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 isVehicleTaxiLightOn ( vehicle taxi )              &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''taxi:''' The vehicle element of the taxi that you wish to get the light state of.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the light is on, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&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;
function myfunction()&lt;br /&gt;
	local player = getLocalPlayer()&lt;br /&gt;
	local vehicle = getPlayerOccupiedVehicle(player)&lt;br /&gt;
	if player == getVehicleOccupant(vehicle, 0) then -- if is a driver&lt;br /&gt;
		local lights = getVehicleTaxiLightOn(vehicle) -- getting vehicle lights state&lt;br /&gt;
		local id = getElementModel(vehicle) -- getting vehicle model&lt;br /&gt;
		if ((id == 420) or (id== 438) then -- if is a taxi&lt;br /&gt;
			setVehicleTaxiLightOn(vehicle, not lights) -- switch lights&lt;br /&gt;
		end&lt;br /&gt;
	end	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
bind(&amp;quot;o&amp;quot;, &amp;quot;down&amp;quot;, myfunction) -- binding the function&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;
==See Also==&lt;br /&gt;
{{vehicle functions}}&lt;/div&gt;</summary>
		<author><name>Morozzzko</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=IsVehicleTaxiLightOn&amp;diff=21991</id>
		<title>IsVehicleTaxiLightOn</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=IsVehicleTaxiLightOn&amp;diff=21991"/>
		<updated>2009-11-30T12:42:39Z</updated>

		<summary type="html">&lt;p&gt;Morozzzko: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
[[Category:Needs_Example]]&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function will get the taxi light state of a taxi (vehicle ID's 420 and 438)&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 isVehicleTaxiLightOn ( vehicle taxi )              &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''taxi:''' The vehicle element of the taxi that you wish to get the light state of.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the light is on, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&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;
function myfunction()&lt;br /&gt;
	local player = getLocalPlayer()&lt;br /&gt;
	local vehicle = getPlayerOccupiedVehicle(player)&lt;br /&gt;
	if player == getVehicleOccupant(vehicle, 0) then -- if is a driver&lt;br /&gt;
		local lights = getVehicleTaxiLightOn(vehicle) -- getting vehicle model&lt;br /&gt;
		local id = getElementModel(vehicle)&lt;br /&gt;
		if ((id == 420) or (id== 438) then -- if is a taxi&lt;br /&gt;
			setVehicleTaxiLightOn(vehicle, not lights) -- switch lights&lt;br /&gt;
		end&lt;br /&gt;
	end	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
bind(&amp;quot;o&amp;quot;, &amp;quot;down&amp;quot;, myfunction) -- binding the function&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;
==See Also==&lt;br /&gt;
{{vehicle functions}}&lt;/div&gt;</summary>
		<author><name>Morozzzko</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=IsVehicleTaxiLightOn&amp;diff=21990</id>
		<title>IsVehicleTaxiLightOn</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=IsVehicleTaxiLightOn&amp;diff=21990"/>
		<updated>2009-11-30T12:40:36Z</updated>

		<summary type="html">&lt;p&gt;Morozzzko: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
[[Category:Needs_Example]]&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function will get the taxi light state of a taxi (vehicle ID's 420 and 438)&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 isVehicleTaxiLightOn ( vehicle taxi )              &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''taxi:''' The vehicle element of the taxi that you wish to get the light state of.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the light is on, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&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;
function myfunction()&lt;br /&gt;
	local player = getLocalPlayer()&lt;br /&gt;
	local vehicle = getPlayerOccupiedVehicle(player)&lt;br /&gt;
	if player == getVehicleOccupant(vehicle, 0) then -- if is a driver&lt;br /&gt;
		local lights = getVehicleTaxiLightOn(getElementModel(vehicle)) -- getting vehicle model&lt;br /&gt;
		if ((vehicle == 420) or (vehicle == 438) then -- if is a taxi&lt;br /&gt;
			setVehicleTaxiLightOn(vehicle, not lights) -- switch lights&lt;br /&gt;
		end&lt;br /&gt;
	end	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
bind(&amp;quot;o&amp;quot;, &amp;quot;down&amp;quot;, myfunction) -- binding the function&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;
==See Also==&lt;br /&gt;
{{vehicle functions}}&lt;/div&gt;</summary>
		<author><name>Morozzzko</name></author>
	</entry>
</feed>