<?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=Dmitry7zip</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=Dmitry7zip"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/Dmitry7zip"/>
	<updated>2026-04-20T16:19:00Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=CreateBrowser&amp;diff=45563</id>
		<title>CreateBrowser</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=CreateBrowser&amp;diff=45563"/>
		<updated>2015-07-27T19:53:20Z</updated>

		<summary type="html">&lt;p&gt;Dmitry7zip: Fix returns&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client_function}}&lt;br /&gt;
{{New feature/item|3.0150|1.5||&lt;br /&gt;
This function creates a new web [[Element/Browser|browser]] element.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;element createBrowser ( int width, int height, bool isLocal [, bool transparent = false ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[Element/Browser|Browser]]}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''width:''' The browser's native width&lt;br /&gt;
*'''height:''' The browser's native height&lt;br /&gt;
*'''isLocal:''' See examples&lt;br /&gt;
''&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''transparent:''' ''true'' if you want the browser transparent, ''false'' for opaque.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns an [[texture]] of the [[browser]] if it was created successfully, ''false'' otherwise. Returns also ''false'', if the user disabled remote pages and ''isLocal'' was set to ''false''.&lt;br /&gt;
&lt;br /&gt;
==Local Example==&lt;br /&gt;
This example shows you how to create a fullscreen Webbrowser (showing a local html file) without input-handling.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--In order to render the browser on the full screen, we need to know the dimensions.&lt;br /&gt;
local screenWidth, screenHeight = guiGetScreenSize()&lt;br /&gt;
&lt;br /&gt;
--Let's create a new browser in local mode. We will not be able to load an external URL.&lt;br /&gt;
local webBrowser = createBrowser(screenWidth, screenHeight, true, false)&lt;br /&gt;
	&lt;br /&gt;
--This is the function to render the browser.&lt;br /&gt;
function webBrowserRender()&lt;br /&gt;
	--Render the browser on the full size of the screen.&lt;br /&gt;
	dxDrawImage(0, 0, screenWidth, screenHeight, webBrowser, 0, 0, 0, tocolor(255,255,255,255), true)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--The event onClientBrowserCreated will be triggered, after the browser has been initialized.&lt;br /&gt;
--After this event has been triggered, we will be able to load our URL and start drawing.&lt;br /&gt;
addEventHandler(&amp;quot;onClientBrowserCreated&amp;quot;, webBrowser, &lt;br /&gt;
	function()&lt;br /&gt;
		--After the browser has been initialized, we can load our file.&lt;br /&gt;
		loadBrowserURL(webBrowser, &amp;quot;html/site.html&amp;quot;)&lt;br /&gt;
		--Now we can start to render the browser.&lt;br /&gt;
		addEventHandler(&amp;quot;onClientRender&amp;quot;, root, webBrowserRender)&lt;br /&gt;
	end&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Remote Example==&lt;br /&gt;
This example shows you how to create a fullscreen Webbrowser (showing youtube.com) without input-handling.&amp;lt;br&amp;gt;&lt;br /&gt;
Remember, that youtube.com is on the global whitelist. If you want to load a domain/page that is not on the global whitelist, you have to request it with [[requestBrowserDomains|requestBrowserDomains]].&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--In order to render the browser on the full screen, we need to know the dimensions.&lt;br /&gt;
local screenWidth, screenHeight = guiGetScreenSize()&lt;br /&gt;
&lt;br /&gt;
--Let's create a new browser in remote mode.&lt;br /&gt;
local webBrowser = createBrowser(screenWidth, screenHeight, false, false)&lt;br /&gt;
	&lt;br /&gt;
--Function to render the browser.&lt;br /&gt;
function webBrowserRender()&lt;br /&gt;
	--Render the browser on the full size of the screen.&lt;br /&gt;
	dxDrawImage(0, 0, screenWidth, screenHeight, webBrowser, 0, 0, 0, tocolor(255,255,255,255), true)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--The event onClientBrowserCreated will be triggered, after the browser has been initialized.&lt;br /&gt;
--After this event has been triggered, we will be able to load our URL and start drawing.&lt;br /&gt;
addEventHandler(&amp;quot;onClientBrowserCreated&amp;quot;, webBrowser, &lt;br /&gt;
	function()&lt;br /&gt;
		--After the browser has been initialized, we can load www.youtube.com&lt;br /&gt;
		loadBrowserURL(webBrowser, &amp;quot;http://www.youtube.com&amp;quot;)&lt;br /&gt;
		--Now we can start to render the browser.&lt;br /&gt;
		addEventHandler(&amp;quot;onClientRender&amp;quot;, root, webBrowserRender)&lt;br /&gt;
	end&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{CEF_functions}}&lt;/div&gt;</summary>
		<author><name>Dmitry7zip</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=RU/dbConnect&amp;diff=45349</id>
		<title>RU/dbConnect</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=RU/dbConnect&amp;diff=45349"/>
		<updated>2015-06-19T19:36:13Z</updated>

		<summary type="html">&lt;p&gt;Dmitry7zip: Some translation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Translate}}&lt;br /&gt;
{{RU/Server function}}&lt;br /&gt;
Эта функция открывает подключение к базе данных и возвращает элемент, который может быть использован с [[RU/dbQuery|dbQuery]]. Для отключения используйте [[RU/destroyElement|destroyElement]].&lt;br /&gt;
{{RU/Note|Подсоединение и отсоединение много раз может негативно повлиять на производительность сервера. Для оптимальной производительности рекомендуется использовать dbConnect только один раз, когда ресурс запускается, и использовать это соединение во всем ресурсе.}}&lt;br /&gt;
{{RU/Note|dbConnect на Linux MySQL требует libmysqlclient.so.15 (для MTA 1.3), или libmysqlclient.so.16 (для MTA 1.4)}}&lt;br /&gt;
==Синтаксис== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
element dbConnect ( string databaseType, string host [, string username = &amp;quot;&amp;quot;, string password = &amp;quot;&amp;quot;, string options = &amp;quot;&amp;quot; ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{RU/OOP||[[Connection]]}}&lt;br /&gt;
===Обязательные параметры===&lt;br /&gt;
*'''databaseType:''' Тип базы данных. Может быть ''sqlite'' или ''mysql''&lt;br /&gt;
*'''host:''' Цель для подключения. Формат зависит от типа базы данных.&lt;br /&gt;
** Для SQLite это [[filepath|путь]] к файлу SQLite базы данных. Если путь начинается с &amp;quot;:/&amp;quot; будет использоваться глобальный каталог баз данных сервера. Файл будет создан, если он не существует.&lt;br /&gt;
** Для MySQL это список формата ключ=значение, разделенный точкой с запятой. Поддерживаются следующие ключи:&lt;br /&gt;
*** '''dbname''': Имя базы данных для использования. Например: ''dbname=test''&lt;br /&gt;
*** '''host''': Адрес хоста. Например: ''host=127.0.0.1''&lt;br /&gt;
*** '''port''': Порт хоста. Например: ''port=1234'' (опционально, по умолчанию используется стандартный порт MySQL)&lt;br /&gt;
*** '''unix_socket''': Unix-сокет или именованный канал для использования (опционально)&lt;br /&gt;
&lt;br /&gt;
===Необязательные параметры===&lt;br /&gt;
*'''username:''' Обычно требуется для MySQL, игнорируется для SQLite &lt;br /&gt;
*'''password:''' Обычно требуется для MySQL, игнорируется для SQLite &lt;br /&gt;
*'''options :''' List of key=value pairs separated by semicolons. Supported keys are:&lt;br /&gt;
**'''share''' which can be set to 0 or 1. (Default value for SQLite is &amp;quot;share=1&amp;quot;, for MySQL is &amp;quot;share=0&amp;quot;). When set to 1, the connection is shared and will be used by other calls to dbConnect with the same host string. This is usually a good thing for SQLite connections, but not so good for MySQL unless care is taken.&lt;br /&gt;
**'''batch''' which can be set to 0 or 1. (Default is &amp;quot;batch=1&amp;quot;). When set to 1, queries called in the same frame are automatically batched together which can significantly speed up inserts/updates. The downside is you lose control of the feature that is used to achieve batching (For SQLite it is transactions, for MySQL it is autocommit mode). Therefore, if you use transactions, lock tables or control autocommit yourself, you may want to disable this feature.&lt;br /&gt;
**'''autoreconnect''' which can be set to 0 or 1. (Default value &amp;quot;autoreconnect=1&amp;quot;). When set to 1, dropped connections will automatically be reconnected. Note that session variables, user variables, table locks and temporary tables will be reset because of the reconnection. So if you use these fancy features, you will need to turn autoreconnect off and cope with dropped connections some other way.&lt;br /&gt;
**'''log''' which can be set to 0 or 1. (Default value &amp;quot;log&amp;lt;nowiki&amp;gt;=&amp;lt;/nowiki&amp;gt;1&amp;quot;). When set to 0, activity from this connection will not be recorded in the [[Server_Commands#debugdb|database debug log file]].&lt;br /&gt;
**'''tag''' (Default value &amp;quot;tag&amp;lt;nowiki&amp;gt;=&amp;lt;/nowiki&amp;gt;script&amp;quot;). A string which helps identify activity from this connection in the [[Server_Commands#debugdb|database debug log file]].&lt;br /&gt;
**'''suppress''' A comma separated list of error codes to ignore. (eg. &amp;quot;suppress&amp;lt;nowiki&amp;gt;=&amp;lt;/nowiki&amp;gt;1062,1169&amp;quot;).&lt;br /&gt;
**'''charset''' If you want to communicate with the server using a character set different from the default, you'll need to indicate which one. (eg. &amp;quot;charset&amp;lt;nowiki&amp;gt;=&amp;lt;/nowiki&amp;gt;utf8&amp;quot;). (used only in MySQL)&lt;br /&gt;
&lt;br /&gt;
===Возвращает===&lt;br /&gt;
Возвращает элемент подключения к базе данных, если проблем нет, в противном случае ''false''.&lt;br /&gt;
&lt;br /&gt;
==Пример==&lt;br /&gt;
This example opens a connection to a SQLite database file in the current resource&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
test_db = dbConnect( &amp;quot;sqlite&amp;quot;, &amp;quot;file.db&amp;quot; )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example opens a connection to a SQLite database file in another resource&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
test_db = dbConnect( &amp;quot;sqlite&amp;quot;, &amp;quot;:resname/file.db&amp;quot; )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example opens a connection to a SQLite database file in the global databases directory&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
test_db = dbConnect( &amp;quot;sqlite&amp;quot;, &amp;quot;:/file.db&amp;quot; )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example opens a connection to a SQLite database file in a sub directory of the global databases directory&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
test_db = dbConnect( &amp;quot;sqlite&amp;quot;, &amp;quot;:/example/sub/dir/file.db&amp;quot; )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example opens a connection to a MySQL database called 'frank' at server ip 1.2.3.4 and allows the connection to be shared. Note that changing the database or other connection dependent settings affect all connections that are shared.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
test_db = dbConnect( &amp;quot;mysql&amp;quot;, &amp;quot;dbname=frank;host=1.2.3.4&amp;quot;, &amp;quot;username&amp;quot;, &amp;quot;password&amp;quot;, &amp;quot;share=1&amp;quot; )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example opens a connection to a SQLite database is disallows sharing of the connection&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
test_db = dbConnect( &amp;quot;sqlite&amp;quot;, &amp;quot;file.db&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;share=0&amp;quot; )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Требования==&lt;br /&gt;
{{RU/Requirements|1.1.1-9.03328|n/a}}&lt;br /&gt;
&lt;br /&gt;
==Список изменений==&lt;br /&gt;
{{ChangelogHeader}}&lt;br /&gt;
{{ChangelogItem|1.3.1-9.04817|Добавлены опции 'log', 'tag' и 'suppress'}}&lt;br /&gt;
{{ChangelogItem|1.3.5-9.06386|Добавлена опция 'charset'}}&lt;br /&gt;
&lt;br /&gt;
==Смотрите также==&lt;br /&gt;
{{RU/Registry_functions}}&lt;br /&gt;
&lt;br /&gt;
[[en:dbConnect]]&lt;/div&gt;</summary>
		<author><name>Dmitry7zip</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=BanPlayer&amp;diff=45302</id>
		<title>BanPlayer</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=BanPlayer&amp;diff=45302"/>
		<updated>2015-06-07T14:38:27Z</updated>

		<summary type="html">&lt;p&gt;Dmitry7zip: /* Returns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server function}}&lt;br /&gt;
{{New feature|3|1.0|&lt;br /&gt;
This function will ban the specified player by either IP, [[serial]] or username&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Deprecated_feature|3|1.0|&lt;br /&gt;
This function will ban the specified player from the server by IP.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
{{New feature|3|1.0|&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
ban banPlayer ( player bannedPlayer, [ bool IP = true, bool Username = false, bool Serial = false, player responsiblePlayer = nil, string reason = nil, int seconds = 0 ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Deprecated_feature|3|1.0|&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool banPlayer ( player bannedPlayer , [ element responsibleElement, string reason ] )         &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
{{OOP||[[player]]:ban||}}&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''bannedPlayer:''' The player that will be banned from the server.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
{{OptionalArg}} &lt;br /&gt;
{{New feature|3|1.0|&lt;br /&gt;
*'''IP:''' Will player be banned by IP?&lt;br /&gt;
*'''Username:''' Will player be banned by username?&lt;br /&gt;
*'''Serial:''' Will player be banned by serial?&lt;br /&gt;
}}&lt;br /&gt;
*'''responsibleElement:''' The element that is responsible for banning the player. This can be a player or the root ([[getRootElement]]()) (Maximum 30 characters if using a string).&lt;br /&gt;
*'''reason:''' The reason the player will be banned from the server.&lt;br /&gt;
*'''seconds:''' The amount of seconds the player will be banned from the server for. This can be 0 for an infinite amount of time.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a [[ban]] object if banned successfully, or ''false'' if unsuccessful.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example lets a player ban anyone if he has ACL rights.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--Add the &amp;quot;ban&amp;quot; command handler&lt;br /&gt;
-- Example with the player&lt;br /&gt;
function banPlayerCommand ( theClient, commandName, bannedName, reason )&lt;br /&gt;
&lt;br /&gt;
	-- Give the player a nice error if he doesn't have rights&lt;br /&gt;
	if ( hasObjectPermissionTo ( theClient, &amp;quot;function.banPlayer&amp;quot; ) ) then&lt;br /&gt;
		--Get player element from the name&lt;br /&gt;
		local bannedPlayer = getPlayerFromName ( bannedName )&lt;br /&gt;
&lt;br /&gt;
		--Ban the player&lt;br /&gt;
		banPlayer ( bannedPlayer, theClient, reason )&lt;br /&gt;
		outputChatBox ( &amp;quot;ban: &amp;quot; .. bannedName .. &amp;quot; successfully banned&amp;quot;, theClient )&lt;br /&gt;
&lt;br /&gt;
	else&lt;br /&gt;
		outputChatBox ( &amp;quot;ban: You don't have enough permissions&amp;quot;, theClient )&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;ban&amp;quot;, banPlayerCommand )&lt;br /&gt;
&lt;br /&gt;
-- Example function with the root element. Here you would pass a player element to the function.&lt;br /&gt;
function banCheater(theCheater)&lt;br /&gt;
	banPlayer(theCheater, getRootElement(), &amp;quot;You are banned because of cheating.&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This example is Firewall Account Player by serial on Login&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
Firewall = &lt;br /&gt;
{&lt;br /&gt;
    [ 'AccountName' ] = 'SerialPlayer',&lt;br /&gt;
    [ '3ash8' ] = '9C9F3B55D9D7BB7135FF274D3BF444E4',&lt;br /&gt;
    [ 'test5' ] = '1D6F76CF8D7193792D13789849498452',&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
addEventHandler ( 'onPlayerLogin', getRootElement ( ),&lt;br /&gt;
    function ( _, theCurrentAccount )&lt;br /&gt;
    local Serial = Firewall[getAccountName(theCurrentAccount)]&lt;br /&gt;
        if ( Serial ) then&lt;br /&gt;
            if Serial ~= getPlayerSerial ( source ) then&lt;br /&gt;
                banPlayer ( source, false, false, true, getRootElement ( ), 'reason ban' )&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Admin_functions}}&lt;br /&gt;
[[es:banPlayer]]&lt;br /&gt;
[[ru:BanPlayer]]&lt;/div&gt;</summary>
		<author><name>Dmitry7zip</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetVersion&amp;diff=45301</id>
		<title>GetVersion</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetVersion&amp;diff=45301"/>
		<updated>2015-06-07T14:26:59Z</updated>

		<summary type="html">&lt;p&gt;Dmitry7zip: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
&lt;br /&gt;
This function gives you various version information about MTA and the operating system.&lt;br /&gt;
&lt;br /&gt;
''Note:'' Clientside will return the version from the player, and the server-sided will return version from the server.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;table getVersion ( )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a table with version information. Specifically these keys are present in the table:&lt;br /&gt;
*'''number:''' the MTA server or client version (depending where the function was called) in pure numerical form, e.g. ''&amp;quot;256&amp;quot;''&lt;br /&gt;
*'''mta:''' the MTA server or client version (depending where the function was called) in textual form, e.g. ''&amp;quot;1.0&amp;quot;''&lt;br /&gt;
*'''name:''' the full MTA product name, either ''&amp;quot;MTA:SA Server&amp;quot;'' or ''&amp;quot;MTA:SA Client&amp;quot;''.&lt;br /&gt;
*'''netcode:''' the netcode version number.&lt;br /&gt;
*'''os:''' returns the operating system on which the server or client is running&lt;br /&gt;
*'''type:''' the type of build.  can be:&lt;br /&gt;
**'''&amp;quot;Nightly rX&amp;quot;''' - A nightly development build.  '''X''' represents the nightly build revision.&lt;br /&gt;
**'''&amp;quot;Custom&amp;quot;''' - A build compiled manually&lt;br /&gt;
**'''&amp;quot;Release&amp;quot;''' - A build that is publicly released (provisional).&lt;br /&gt;
*'''tag:''' the build tag (from 1.0.3 onwards). Contains infomation about the underlying version used. i.e. The final version of 1.0.3 has the build tag of &amp;quot;1.0.3 rc-9&amp;quot;. (This can be confirmed by using the console command 'ver'.)&lt;br /&gt;
*'''sortable:''' a 15 character sortable version string (from 1.0.4 onwards). Format of the string is described in [[getPlayerVersion]].&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
'''Example 1:''' This example will make a script compatible only with version 1.0:&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 setHoboSkin ( playerSource )&lt;br /&gt;
  local version = getVersion ( )&lt;br /&gt;
  if version.number &amp;lt; 256 then -- MTA 1.0 version number is 0x0100&lt;br /&gt;
    setPlayerSkin ( playerSource, 137 )&lt;br /&gt;
  else&lt;br /&gt;
    setElementModel ( playerSource, 137 )&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;hobo&amp;quot;, setHoboSkin )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Example 2:''' This client and server example will kick players that have anything earlier than the final released version of 1.0.3:&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 sendVersion ()&lt;br /&gt;
  -- Send local player version to the server&lt;br /&gt;
  triggerServerEvent ( &amp;quot;onNotifyPlayerVersion&amp;quot;, getResourceRootElement(), getVersion() )&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onClientResourceStart&amp;quot;, getResourceRootElement(), sendVersion )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;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 handlePlayerVersion( version )&lt;br /&gt;
  if version.number &amp;gt; 256 + 3 then  -- Allow anything above 1.0.3&lt;br /&gt;
    return&lt;br /&gt;
  end&lt;br /&gt;
  if version.number == 256 + 3 then  -- Check further if it is exactly 1.0.3&lt;br /&gt;
    if version.type == &amp;quot;Release&amp;quot; then -- Check further if it is the &amp;quot;Release&amp;quot; type&lt;br /&gt;
      local _,_,buildnumber = string.find( version.tag or &amp;quot;&amp;quot;, &amp;quot;(%d)$&amp;quot; )  -- Extract the build number if there&lt;br /&gt;
      buildnumber = tonumber(buildnumber) or 0&lt;br /&gt;
      if buildnumber &amp;gt;= 9 then  -- Allow 9 and above&lt;br /&gt;
        return&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  outputConsole( &amp;quot;Kicking player as below 1.0.3 Release build 9&amp;quot; );&lt;br /&gt;
  kickPlayer( client, &amp;quot;Upgrade your version at www.mtasa.com&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
addEvent ( &amp;quot;onNotifyPlayerVersion&amp;quot;, true)&lt;br /&gt;
addEventHandler ( &amp;quot;onNotifyPlayerVersion&amp;quot;, getResourceRootElement(), handlePlayerVersion )&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;
{{Server functions}}&lt;/div&gt;</summary>
		<author><name>Dmitry7zip</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetVersion&amp;diff=45300</id>
		<title>GetVersion</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetVersion&amp;diff=45300"/>
		<updated>2015-06-07T14:26:46Z</updated>

		<summary type="html">&lt;p&gt;Dmitry7zip: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
&lt;br /&gt;
This function gives you various version information about MTA and the operating system.&lt;br /&gt;
&lt;br /&gt;
''Note:'' Clientside will return the version from the player, and the server-sided will return version from the server.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;table getVersion ( )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a table with version information. Specifically these keys are present in the table:&lt;br /&gt;
*'''number:''' the MTA server or client version (depending where the function was called) in pure numerical form, e.g. ''&amp;quot;256&amp;quot;''&lt;br /&gt;
*'''mta:''' the MTA server or client version (depending where the function was called) in textual form, e.g. ''&amp;quot;1.0&amp;quot;''&lt;br /&gt;
*'''name:''' the full MTA product name, either ''&amp;quot;MTA:SA Server&amp;quot;'' or ''&amp;quot;MTA:SA Client&amp;quot;''.&lt;br /&gt;
*'''netcode:''' the netcode version number.&lt;br /&gt;
*'''os:''' returns the operating system on which the server or client is running&lt;br /&gt;
*'''type:''' the type of build.  can be:&lt;br /&gt;
**'''&amp;quot;Nightly rX&amp;quot;''' - A nightly development build.  '''X''' represents the nightly build revision.&lt;br /&gt;
**'''&amp;quot;Custom&amp;quot;''' - A build compiled manually&lt;br /&gt;
**'''&amp;quot;Release&amp;quot;''' - A build that is publicly released (provisional).&lt;br /&gt;
*'''tag:''' the build tag (from 1.0.3 onwards). Contains infomation about the underlying version used. i.e. The final version of 1.0.3 has the build tag of &amp;quot;1.0.3 rc-9&amp;quot;. (This can be confirmed by using the console command 'ver'.)&lt;br /&gt;
*'''sortable:''' a 15 character sortable version string (from 1.0.4 onwards). Format of the string is described in [[getPlayerVersion]].&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
'''Example 1:''' This example will make a script compatible only with version 1.0:&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 setHoboSkin ( playerSource )&lt;br /&gt;
  local version = getVersion ( )&lt;br /&gt;
  if version.number &amp;lt; 256 then -- MTA 1.0 version number is 0x0100&lt;br /&gt;
    setPlayerSkin ( playerSource, 137 )&lt;br /&gt;
  else&lt;br /&gt;
    setElementModel ( playerSource, 137 )&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;hobo&amp;quot;, setHoboSkin )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Example 2:''' This client and server example will kick players that have anything earlier than the final released version of 1.0.3:&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 sendVersion ()&lt;br /&gt;
  -- Send local player version to the server&lt;br /&gt;
  triggerServerEvent ( &amp;quot;onNotifyPlayerVersion&amp;quot;, getResourceRootElement(), getVersion() )&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onClientResourceStart&amp;quot;, getResourceRootElement(), sendVersion )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;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 handlePlayerVersion( version )&lt;br /&gt;
  if version.number &amp;gt; 256 + 3 then  -- Allow anything above 1.0.3&lt;br /&gt;
    return&lt;br /&gt;
  end&lt;br /&gt;
  if version.number == 256 + 3 then  -- Check further if it is exactly 1.0.3&lt;br /&gt;
    if version.type == &amp;quot;Release&amp;quot; then -- Check further if it is the &amp;quot;Release&amp;quot; type&lt;br /&gt;
      local _,_,buildnumber = string.find( version.tag or &amp;quot;&amp;quot;, &amp;quot;(%d)$&amp;quot; )  -- Extract the build number if there&lt;br /&gt;
      buildnumber = tonumber(buildnumber) or 0&lt;br /&gt;
      if buildnumber &amp;gt;= 9 then  -- Allow 9 and above&lt;br /&gt;
        return&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  outputConsole( &amp;quot;Kicking player as below 1.0.3 Release build 9&amp;quot; );&lt;br /&gt;
  kickPlayer( client, &amp;quot;Upgrade your version at www.mtasa.com&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
addEvent ( &amp;quot;onNotifyPlayerVersion&amp;quot;, true)&lt;br /&gt;
addEventHandler ( &amp;quot;onNotifyPlayerVersion&amp;quot;, getResourceRootElement(), handlePlayerVersion )&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;
{{Server functions}}&lt;/div&gt;</summary>
		<author><name>Dmitry7zip</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetVehicleHeadLightColor&amp;diff=45299</id>
		<title>GetVehicleHeadLightColor</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetVehicleHeadLightColor&amp;diff=45299"/>
		<updated>2015-06-07T14:21:32Z</updated>

		<summary type="html">&lt;p&gt;Dmitry7zip: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function will get the headlight color of a vehicle.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int, int, int getVehicleHeadLightColor ( vehicle theVehicle )            &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[vehicle]]:getHeadLightColor||setVehicleHeadLightColor}}&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theVehicle:''' The [[vehicle]] that you wish to set the headlight color of.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns three ''integers'' for the red, green and blue of the headlight color for the specified vehicle, ''false'' if an invalid vehicle was specified.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example outputs the player vehicle head lights color.&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 getHeadLightsColor()&lt;br /&gt;
	local vehicle = getPedOccupiedVehicle(localPlayer) -- We get the player vehicle..&lt;br /&gt;
	if (vehicle) then -- We check if he's on a vehicle...&lt;br /&gt;
		local r, g, b = getVehicleHeadLightColor(vehicle) -- We get the vehicle head lights color..&lt;br /&gt;
		outputChatBox(&amp;quot;Your vehicle lights color are: &amp;quot;.. r ..&amp;quot;, &amp;quot;.. g ..&amp;quot;, &amp;quot;.. b) -- We output them to the chatbox.&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;lightscolor&amp;quot;,getHeadLightsColor) -- Add the command handler attached to the function &amp;quot;getHeadLightsColor&amp;quot;.&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 getHeadLightsColor(thePlayer)&lt;br /&gt;
	local vehicle = getPedOccupiedVehicle(thePlayer) -- We get the player vehicle..&lt;br /&gt;
	if (vehicle) then -- We check if he's on a vehicle...&lt;br /&gt;
		local r, g, b = getVehicleHeadLightColor(vehicle) -- We get the vehicle head lights color..&lt;br /&gt;
		outputChatBox(&amp;quot;Your vehicle lights color are: &amp;quot;.. r ..&amp;quot;, &amp;quot;.. g ..&amp;quot;, &amp;quot;.. b, thePlayer) -- We output them to the chatbox.&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;lightscolor&amp;quot;,getHeadLightsColor) -- Add the command handler attached to the function &amp;quot;getHeadLightsColor&amp;quot;.&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>Dmitry7zip</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetWeaponTarget&amp;diff=45297</id>
		<title>SetWeaponTarget</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetWeaponTarget&amp;diff=45297"/>
		<updated>2015-06-06T21:30:51Z</updated>

		<summary type="html">&lt;p&gt;Dmitry7zip: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
This function sets the target of a [[Element/Weapon|custom weapon]]. There are 3 different targeting modes, which are explained below.&lt;br /&gt;
{{Note|[[Element/Weapon|Custom weapons]] target its target (assigned by this function) with no recoil. If you want a custom weapon to take into account recoil, you will have to script it by firing at fixed coordinates.}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
Fires the weapon at a physical [[element]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool setWeaponTarget ( weapon theWeapon, element theTarget [, int theComponent = 255] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{OOP|Variable is read only.|[[Element/Weapon|weapon]]:setTarget|target|getWeaponTarget}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''theWeapon:''' The weapon to set the target of.&lt;br /&gt;
* '''theTarget:''' The [[element]] to shoot at. It can be a [[player]], [[ped]], [[vehicle]] or [[object]].&lt;br /&gt;
&lt;br /&gt;
===Optional arguments===&lt;br /&gt;
* '''theComponent:''' The component of the target to shoot at. This argument is only relevant when used in the following element types:&lt;br /&gt;
** '''[[Vehicle|Vehicles]]''':&lt;br /&gt;
*** '''0''': front left tire.&lt;br /&gt;
*** '''1''': front right tire. &lt;br /&gt;
*** '''2''': rear left tire.&lt;br /&gt;
*** '''3''': rear right tire.&lt;br /&gt;
*** '''255''': center of the car (position returned by [[getElementPosition]]).&lt;br /&gt;
** '''[[Ped|Peds]]''' (players '''not''' included; see [[getPedBonePosition]] to know where is located each bone):&lt;br /&gt;
***'''1:''' ''BONE_PELVIS1'' position.&lt;br /&gt;
***'''2:''' ''BONE_PELVIS'' position.&lt;br /&gt;
***'''3:''' ''BONE_SPINE1'' position.&lt;br /&gt;
***'''4:''' ''BONE_UPPERTORSO'' position.&lt;br /&gt;
***'''5:''' ''BONE_NECK'' position.&lt;br /&gt;
***'''6:''' ''BONE_HEAD2'' position.&lt;br /&gt;
***'''7:''' ''BONE_HEAD1'' position.&lt;br /&gt;
***'''8:''' ''BONE_HEAD'' position.&lt;br /&gt;
***'''21:''' ''BONE_RIGHTUPPERTORSO'' position.&lt;br /&gt;
***'''22:''' ''BONE_RIGHTSHOULDER'' position.&lt;br /&gt;
***'''23:''' ''BONE_RIGHTELBOW'' position.&lt;br /&gt;
***'''24:''' ''BONE_RIGHTWRIST'' position.&lt;br /&gt;
***'''25:''' ''BONE_RIGHTHAND'' position.&lt;br /&gt;
***'''26:''' ''BONE_RIGHTTHUMB'' position.&lt;br /&gt;
***'''31:''' ''BONE_LEFTUPPERTORSO'' position.&lt;br /&gt;
***'''32:''' ''BONE_LEFTSHOULDER'' position.&lt;br /&gt;
***'''33:''' ''BONE_LEFTELBOW'' position.&lt;br /&gt;
***'''34:''' ''BONE_LEFTWRIST'' position.&lt;br /&gt;
***'''35:''' ''BONE_LEFTHAND'' position.&lt;br /&gt;
***'''36:''' ''BONE_LEFTTHUMB'' position.&lt;br /&gt;
***'''41:''' ''BONE_LEFTHIP'' position.&lt;br /&gt;
***'''42:''' ''BONE_LEFTKNEE'' position.&lt;br /&gt;
***'''43:''' ''BONE_LEFTANKLE'' position.&lt;br /&gt;
***'''44:''' ''BONE_LEFTFOOT'' position.&lt;br /&gt;
***'''51:''' ''BONE_RIGHTHIP'' position.&lt;br /&gt;
***'''52:''' ''BONE_RIGHTKNEE'' position.&lt;br /&gt;
***'''53:''' ''BONE_RIGHTANKLE'' position.&lt;br /&gt;
***'''54:''' ''BONE_RIGHTFOOT'' position.&lt;br /&gt;
*** '''255''': center of the ped (position returned by [[getElementPosition]]).&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' on success, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Syntax (target a position)==&lt;br /&gt;
Fires the weapon at the specified position.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool setWeaponTarget ( weapon theWeapon, float targetX, float targetY, float targetZ )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''theWeapon:''' The weapon to set the target of.&lt;br /&gt;
* '''targetX:''' The target X.&lt;br /&gt;
* '''targetY:''' The target Y.&lt;br /&gt;
* '''targetZ:''' The target Z.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' on success, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Syntax (rotational target)==&lt;br /&gt;
Sets the weapon back to rotation based targeting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool setWeaponTarget ( weapon theWeapon, nil )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''theWeapon:''' The weapon to clear the target of.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' on success, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.3.0-9.04555|}}&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Client weapon creation functions}}&lt;/div&gt;</summary>
		<author><name>Dmitry7zip</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=RemoveWorldModel&amp;diff=45296</id>
		<title>RemoveWorldModel</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=RemoveWorldModel&amp;diff=45296"/>
		<updated>2015-06-06T21:27:58Z</updated>

		<summary type="html">&lt;p&gt;Dmitry7zip: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server client function}}&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
{{Note box|Pre r4844: There are two types of world objects Binary IPL (anything not in data/maps and in gta3.img) and data IPL (anything in data/maps) Binary IPL removal requires a stream out if you are deleting anything within 300 units (anything visible) you can just move the camera to do this. Data IPL are removed instantly and this is not required. Also LOD objects are not removed automatically so you need to remove them separately.}}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
This function is used to remove a world object.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
{{Tip|Pre r4844: It is strongly advised that you use this server side rather than client side because it will just function infinitely better as you should not need to handle streaming it out/back in.}}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool removeWorldModel ( int modelID, float radius, float x, float y, float z [, int interior = 0 ] )&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''modelID:''' A whole integer specifying the GTASA object model ID.&lt;br /&gt;
*'''radius:''' A floating point number representing the radius that will be eliminated.&lt;br /&gt;
*'''x:''' A floating point number representing the X coordinate on the map.&lt;br /&gt;
*'''y:''' A floating point number representing the Y coordinate on the map.&lt;br /&gt;
*'''z:''' A floating point number representing the Z coordinate on the map.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
{{New items|3.0132|1.3.2|&lt;br /&gt;
*'''interior:''' The interior ID to apply the removal to ( some objects in interior 13 show in all interiors so if you want to remove everything in interior 0 also remove everything in interior 13 )&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the [[object]] was removed, ''false'' if invalid arguments were passed.&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|1.2.0-9.03618|1.2.0-9.03618|}}&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example will removes buildings on BigEar:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
removeWorldModel(16617,1000,-300,1556,75) --lod&lt;br /&gt;
removeWorldModel(16616,1000,-300,1556,75) --lod&lt;br /&gt;
removeWorldModel(16615,1000,-300,1556,75) --lod&lt;br /&gt;
removeWorldModel(16138,1000,-300,1556,75) -- model&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example removes CJ house:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
for i=700,20000 do&lt;br /&gt;
    removeWorldModel(i,10,2494,-1696,17)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This server script example removes all models, everywhere:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
for i=550,20000 do&lt;br /&gt;
    removeWorldModel(i,10000,0,0,0)&lt;br /&gt;
end&lt;br /&gt;
setOcclusionsEnabled(false)  -- Also disable occlusions when removing certain models&lt;br /&gt;
setWaterLevel(-5000)         -- Also hide the default water as it will be full of holes&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Changelog==&lt;br /&gt;
{{ChangelogHeader}}&lt;br /&gt;
{{ChangelogItem|1.3.1-9.04636|Added interior argument}}&lt;br /&gt;
{{ChangelogItem|1.3.1-9.04844|Everything streams out fine now.}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_world_functions}}&lt;/div&gt;</summary>
		<author><name>Dmitry7zip</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=RestoreAllWorldModels&amp;diff=45295</id>
		<title>RestoreAllWorldModels</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=RestoreAllWorldModels&amp;diff=45295"/>
		<updated>2015-06-06T21:27:43Z</updated>

		<summary type="html">&lt;p&gt;Dmitry7zip: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function allows restoring of all world objects,which were removed with [[RemoveWorldModel]].&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 restoreAllWorldModels ( )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Returns==&lt;br /&gt;
Returns ''true'' if the world objects were restored, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|1.2.0-9.03618|1.2.0-9.03618|}}&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example adds command ''&amp;quot;restoreallworldobjects&amp;quot;'' that restores all world objects.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addCommandHandler(&amp;quot;restoreallworldobjects&amp;quot;,&lt;br /&gt;
  function()&lt;br /&gt;
    restoreAllWorldModels()&lt;br /&gt;
  end&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_world_functions}}&lt;/div&gt;</summary>
		<author><name>Dmitry7zip</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=RestoreWorldModel&amp;diff=45294</id>
		<title>RestoreWorldModel</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=RestoreWorldModel&amp;diff=45294"/>
		<updated>2015-06-06T21:27:27Z</updated>

		<summary type="html">&lt;p&gt;Dmitry7zip: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
&lt;br /&gt;
This function allows restoring of world object,which was removed with [[RemoveWorldModel]].&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 restoreWorldModel ( int modelID, float radius, float x, float y, float z [, int iInterior = -1 ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''modelID:''' A whole integer specifying the GTASA object model ID.&lt;br /&gt;
*'''radius:''' A floating point number representing the radius that will be eliminated.&lt;br /&gt;
*'''x:''' A floating point number representing the X coordinate on the map.&lt;br /&gt;
*'''y:''' A floating point number representing the Y coordinate on the map.&lt;br /&gt;
*'''z:''' A floating point number representing the Z coordinate on the map.&lt;br /&gt;
{{New items|3.0132|1.3.2|&lt;br /&gt;
*'''iInterior:''' &lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the world object was restored, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|1.2.0-9.03618|1.2.0-9.03618|}}&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
Remove every lamp post (object 1226) besides Grove Street.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
removeWorldModel(1226, 4000, 0, 0, 0, -1)&lt;br /&gt;
restoreWorldModel(1226, 50, 2489, -1665, 13, -1)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Changelog==&lt;br /&gt;
{{ChangelogHeader}}&lt;br /&gt;
{{ChangelogItem|1.3.1-9.04636|Added iInterior argument}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_world_functions}}&lt;/div&gt;</summary>
		<author><name>Dmitry7zip</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=TakeWeapon&amp;diff=45293</id>
		<title>TakeWeapon</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=TakeWeapon&amp;diff=45293"/>
		<updated>2015-06-06T21:27:01Z</updated>

		<summary type="html">&lt;p&gt;Dmitry7zip: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server function}}&lt;br /&gt;
This function removes a specified weapon or ammo from a certain player's inventory.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool takeWeapon ( player thePlayer, int weaponId [, int ammo ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''thePlayer''': A player object referencing the specified player.&lt;br /&gt;
*'''weaponId''': An integer that refers to a [[weapon]] that you wish to remove.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''ammo''': If used, this amount of ammo will be taken instead and the weapon will not be removed.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a ''true'' if the weapon/ammo was removed successfully, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example removes teargas from player.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addCommandHandler( 'rtear',&lt;br /&gt;
  function( thePlayer )&lt;br /&gt;
    takeWeapon( thePlayer, 17 )&lt;br /&gt;
  end&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Weapon functions}}&lt;br /&gt;
[[ru:takeWeapon]]&lt;/div&gt;</summary>
		<author><name>Dmitry7zip</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetCursorAlpha&amp;diff=45292</id>
		<title>GetCursorAlpha</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetCursorAlpha&amp;diff=45292"/>
		<updated>2015-06-06T20:56:10Z</updated>

		<summary type="html">&lt;p&gt;Dmitry7zip: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
This function is used to get alpha (transparency) from the client's cursor.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int getCursorAlpha ( )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a int, 0-255, where 255 is fully opaque and 0 is fully transparent.&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.3.2}}&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Simple command to test the getCursorAlpha function&lt;br /&gt;
addCommandHandler( &amp;quot;cursorAlpha&amp;quot;, &lt;br /&gt;
    function ()&lt;br /&gt;
        if ( isCursorShowing ( ) ) then&lt;br /&gt;
            outputChatBox( &amp;quot;The cursor alpha: &amp;quot;..getCursorAlpha( ) )&lt;br /&gt;
        else&lt;br /&gt;
            outputChatBox( &amp;quot;The cursor is not showing!&amp;quot; )&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{GUI_functions}}&lt;/div&gt;</summary>
		<author><name>Dmitry7zip</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetCamera&amp;diff=45291</id>
		<title>GetCamera</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetCamera&amp;diff=45291"/>
		<updated>2015-06-06T20:55:47Z</updated>

		<summary type="html">&lt;p&gt;Dmitry7zip: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New items|3.0135|1.3.5|&lt;br /&gt;
This function returns an [[element]] that corresponds to the game camera &lt;br /&gt;
}}&lt;br /&gt;
{{Note|Using attachElements with the camera and the main player can interfere with movement}}&lt;br /&gt;
{{Note|Using setElementPosition/Rotation/Matrix on the camera element will automatically clear any target set with [[setCameraTarget]]}}&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
element getCamera ()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns an [[element]] that corresponds to the game camera &lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example attaches (fixes) the camera to a vehicle.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local cam = getCamera()&lt;br /&gt;
setElementPosition( cam, 0,0,0 )  -- Clear camera target&lt;br /&gt;
local myVehicle = getPedOccupiedVehicle(localPlayer)&lt;br /&gt;
attachElements( cam, myVehicle, 0,-4,2, -20,0,0 )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client camera functions}}&lt;/div&gt;</summary>
		<author><name>Dmitry7zip</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=CreateVehicle&amp;diff=45276</id>
		<title>CreateVehicle</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=CreateVehicle&amp;diff=45276"/>
		<updated>2015-06-02T15:03:00Z</updated>

		<summary type="html">&lt;p&gt;Dmitry7zip: Fixed 'bDirection' arg name in description&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Needs_Checking|&lt;br /&gt;
* Explain the direction parameter which should always be false and what is the point of having a parameter whose value need to be the same all the time. --[[User:MTA SE|MTA SE]] 20:05, 5 July 2012 (UTC)&lt;br /&gt;
}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
{{note_box|Vehicles (and other elements) created client-side are only seen by the client that created them, aren't synced and players cannot enter them. They are essentially for display only.}}&lt;br /&gt;
This function creates a vehicle at the specified location.&lt;br /&gt;
&lt;br /&gt;
Its worth noting that the position of the vehicle is the center point of the vehicle, not its base. As such, you need to ensure that the z value (vertical axis) is some height above the ground. You can find the exact height using the client side function [[getElementDistanceFromCentreOfMassToBaseOfModel]], or you can estimate it yourself and just spawn the vehicle so it drops to the ground.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
vehicle createVehicle ( int model, float x, float y, float z [, float rx, float ry, float rz, string numberplate, bool bDirection, int variant1, int variant2 ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[Vehicle]]||}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''model''': The [[Vehicle IDs|vehicle ID]] of the vehicle being created.&lt;br /&gt;
* '''x''': A floating point number representing the X coordinate on the map.&lt;br /&gt;
* '''y''': A floating point number representing the Y coordinate on the map.&lt;br /&gt;
* '''z''': A floating point number representing the Z coordinate on the map.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
{{OptionalArg}}&lt;br /&gt;
* '''rx''': A floating point number representing the rotation about the X axis in degrees.&lt;br /&gt;
* '''ry''': A floating point number representing the rotation about the Y axis in degrees.&lt;br /&gt;
* '''rz''': A floating point number representing the rotation about the Z axis in degrees.&lt;br /&gt;
* '''numberplate''': A string that will go on the number plate of the car (max 8 characters). This is only applicable to cars.&lt;br /&gt;
* '''bDirection''': A boolean which should be set to false. *SERVER ONLY*&lt;br /&gt;
{{New feature/item|3.0120|1.2|| &lt;br /&gt;
* '''variant1''': An integer for the first vehicle variant see [[Vehicle variants]]&lt;br /&gt;
* '''variant2''': An integer for the second vehicle variant see [[Vehicle variants]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the [[vehicle]] element that was created. Returns ''false'' if the arguments are incorrect, or if the vehicle limit of 65535 is exceeded.&lt;br /&gt;
&lt;br /&gt;
==Using trains==&lt;br /&gt;
Trains are created using the createVehicle function. They are placed at the nearest point of the GTASA train pathing (railroad tracks) from their spawning point. &lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 1: Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This script spawns a Rhino on top of one lucky individual.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function scriptCreateTank ( player, command )&lt;br /&gt;
      local luckyBugger = getRandomPlayer() -- get a random player&lt;br /&gt;
      local x, y, z = getElementPosition ( luckyBugger ) -- retrive the player's position&lt;br /&gt;
      createVehicle ( 432, x, y, z + 10 ) -- create the tank 10 units above them&lt;br /&gt;
      outputChatBox ( &amp;quot;You got Tank'd!&amp;quot;, luckyBugger )&lt;br /&gt;
end&lt;br /&gt;
--Attach the 'scriptCreateTank' function to the &amp;quot;tank&amp;quot; command&lt;br /&gt;
addCommandHandler ( &amp;quot;tank&amp;quot;, scriptCreateTank )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 2: Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This script spawns a Rhino on top of the local player.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function scriptCreateTank ( commandName )&lt;br /&gt;
      local luckyBugger = getLocalPlayer() -- get the local player&lt;br /&gt;
      local x, y, z = getElementPosition ( luckyBugger ) -- retrive the player's position&lt;br /&gt;
      createVehicle ( 432, x, y, z + 10 ) -- create the tank 10 units above them&lt;br /&gt;
      outputChatBox ( &amp;quot;You got Tank'd!&amp;quot;, 255, 0, 0)&lt;br /&gt;
end&lt;br /&gt;
--Attach the 'scriptCreateTank' function to the &amp;quot;tank&amp;quot; command&lt;br /&gt;
addCommandHandler ( &amp;quot;tank&amp;quot;, scriptCreateTank )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 3: Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
This example creates a vehicle five units to the right of a player when they type ''createvehicle'' and its name in the console:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local distance = 5 --units&lt;br /&gt;
&lt;br /&gt;
-- define our handler (we'll take a variable number of parameters where the name goes, because there are vehicle names with more than one word)&lt;br /&gt;
function consoleCreateVehicle ( sourcePlayer, commandName, ... )&lt;br /&gt;
   -- if a player triggered it, not the admin,&lt;br /&gt;
   if ( sourcePlayer ) then&lt;br /&gt;
      -- calculate the position of the vehicle based on the player's position and rotation:&lt;br /&gt;
      local x, y, z = getElementPosition ( sourcePlayer ) -- get the player's position&lt;br /&gt;
      local rotZ = getPedRotation ( sourcePlayer ) -- get the player's rotation around the Z axis in degrees&lt;br /&gt;
      x = x + ( ( math.cos ( math.rad ( rotZ ) ) ) * distance ) -- calculate the X position of the vehicle&lt;br /&gt;
      y = y + ( ( math.sin ( math.rad ( rotZ ) ) ) * distance ) -- calculate the Y position of the vehicle&lt;br /&gt;
&lt;br /&gt;
      -- get the complete vehicle name by joining all passed parameters using Lua function table.concat&lt;br /&gt;
      local vehicleName = table.concat({...}, &amp;quot; &amp;quot;)&lt;br /&gt;
      -- get the vehicle's model ID from the name&lt;br /&gt;
      local vehicleID = getVehicleModelFromName ( vehicleName )&lt;br /&gt;
      -- if vehicle ID is valid,&lt;br /&gt;
      if vehicleID then&lt;br /&gt;
            -- create the vehicle using the information gathered above:&lt;br /&gt;
            local newVehicle = createVehicle ( vehicleID, x, y, z, 0, 0, rotZ )&lt;br /&gt;
            -- if vehicle creation failed, give the player a message&lt;br /&gt;
            if not newVehicle then&lt;br /&gt;
               outputConsole ( &amp;quot;Failed to create vehicle.&amp;quot;, sourcePlayer )&lt;br /&gt;
            end&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Attach the 'consoleCreateVehicle' function to the &amp;quot;createvehicle&amp;quot; command&lt;br /&gt;
addCommandHandler ( &amp;quot;createvehicle&amp;quot;, consoleCreateVehicle )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{New items|4.0132|1.4|&lt;br /&gt;
This is an example of how this function is executed in an OOP environment.&lt;br /&gt;
&amp;lt;section name=&amp;quot;OOP server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This script will create an Infernus at the center (0, 0, 3) of San Andreas upon execution.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler( &amp;quot;onResourceStart&amp;quot;, resourceRoot,&lt;br /&gt;
    function()&lt;br /&gt;
        infernus = Vehicle(411, Vector3(0, 0, 3)); -- Create an Infernus and spawn it at the middle of SA.&lt;br /&gt;
        infernus:setColor(0, 0, 0); -- Set its color to black.&lt;br /&gt;
        infernus.damageProof = true; -- Make it damage proof&lt;br /&gt;
    end&lt;br /&gt;
)&lt;br /&gt;
	&lt;br /&gt;
addCommandHandler( &amp;quot;blowinfernus&amp;quot;,&lt;br /&gt;
    function(p)&lt;br /&gt;
        if not infernus.blown then -- Check if the Infernus is blown up or not.&lt;br /&gt;
            infernus:blow();&lt;br /&gt;
        else -- Ouch, it's blown up, let's output an error to the player.&lt;br /&gt;
            outputChatBox( &amp;quot;The Infernus has already been blown up by you.&amp;quot;, p, 255, 0, 0, false );&lt;br /&gt;
        end&lt;br /&gt;
    end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Vehicle functions}}&lt;/div&gt;</summary>
		<author><name>Dmitry7zip</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=IsBrowserDomainBlocked&amp;diff=45268</id>
		<title>IsBrowserDomainBlocked</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=IsBrowserDomainBlocked&amp;diff=45268"/>
		<updated>2015-05-31T19:28:19Z</updated>

		<summary type="html">&lt;p&gt;Dmitry7zip: OOP fix&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{New feature/item|3.0150|1.5||&lt;br /&gt;
This function checks if the specified URL is blocked from being loaded.&lt;br /&gt;
}}&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 isBrowserDomainBlocked ( string address [, bool isURL = false] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[Element/Browser|browser]]:isDomainBlocked|isBrowserDomainBlocked|}}&lt;br /&gt;
&lt;br /&gt;
===Required arguments===&lt;br /&gt;
*'''address:''' A website URL&lt;br /&gt;
&lt;br /&gt;
===Optional arguments===&lt;br /&gt;
*'''isURL:''' ''true'' if ''address'' should be parsed as URL, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the URL is able to be loaded, ''false'' if it is blocked.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--Check the state of wiki.mtasa.com&lt;br /&gt;
if ( isBrowserDomainBlocked ( &amp;quot;wiki.mtasa.com&amp;quot; ) ) then&lt;br /&gt;
	--If it is blocked.&lt;br /&gt;
	outputChatBox(&amp;quot;wiki.mtasa.com is blocked and can't be loaded right now!&amp;quot;)&lt;br /&gt;
else&lt;br /&gt;
	--If it is not blocked. (Was accepted by the user)&lt;br /&gt;
	outputChatBox(&amp;quot;wiki.mtasa.com is not blocked and ready to be loaded!&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{CEF_functions}}&lt;/div&gt;</summary>
		<author><name>Dmitry7zip</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=IsBrowserDomainBlocked&amp;diff=45267</id>
		<title>IsBrowserDomainBlocked</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=IsBrowserDomainBlocked&amp;diff=45267"/>
		<updated>2015-05-31T19:19:52Z</updated>

		<summary type="html">&lt;p&gt;Dmitry7zip: Fix OOP&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{New feature/item|3.0150|1.5||&lt;br /&gt;
This function checks if the specified URL is blocked from being loaded.&lt;br /&gt;
}}&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 isBrowserDomainBlocked ( string address [, bool isURL = false] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[Element/Browser|browser]]:isDomainBlocked||isBrowserDomainBlocked}}&lt;br /&gt;
&lt;br /&gt;
===Required arguments===&lt;br /&gt;
*'''address:''' A website URL&lt;br /&gt;
&lt;br /&gt;
===Optional arguments===&lt;br /&gt;
*'''isURL:''' ''true'' if ''address'' should be parsed as URL, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the URL is able to be loaded, ''false'' if it is blocked.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--Check the state of wiki.mtasa.com&lt;br /&gt;
if ( isBrowserDomainBlocked ( &amp;quot;wiki.mtasa.com&amp;quot; ) ) then&lt;br /&gt;
	--If it is blocked.&lt;br /&gt;
	outputChatBox(&amp;quot;wiki.mtasa.com is blocked and can't be loaded right now!&amp;quot;)&lt;br /&gt;
else&lt;br /&gt;
	--If it is not blocked. (Was accepted by the user)&lt;br /&gt;
	outputChatBox(&amp;quot;wiki.mtasa.com is not blocked and ready to be loaded!&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{CEF_functions}}&lt;/div&gt;</summary>
		<author><name>Dmitry7zip</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=ToggleControl&amp;diff=43863</id>
		<title>ToggleControl</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=ToggleControl&amp;diff=43863"/>
		<updated>2015-01-03T10:27:59Z</updated>

		<summary type="html">&lt;p&gt;Dmitry7zip: Fixed arg name in &amp;quot;Required Arguments&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
{{Needs Checking|By enabling a control all bindings belonging to it seem to be deleted. (tested clientside) --[[User:NeonBlack|NeonBlack]] 16:48, 28 August 2009 (UTC)}}&lt;br /&gt;
Enables or disables the use of a GTA control for a specific player.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &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;bool toggleControl ( player thePlayer, string control, bool enabled ) &amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''thePlayer:''' The player you wish to toggle the control ability of.&lt;br /&gt;
*'''control:''' The control that you want to toggle the ability of. See [[control names]] for a list of possible controls.&lt;br /&gt;
*'''enabled:''' A boolean value representing whether or not the key will be usable or not.&lt;br /&gt;
&amp;lt;/section&amp;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;bool toggleControl ( string control, bool enabled ) &amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''control:''' The control that you want to toggle the ability of. See [[control names]] for a list of possible controls.&lt;br /&gt;
*'''enabled:''' A boolean value representing whether or not the key will be usable or not.&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Returns==&lt;br /&gt;
This function ''true'' if the control was set successfully, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==  &lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 1&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This function will disable the use of the vehicle secondary-fire key for anyone in a Hydra, consequently removing the ability to fire rockets.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function disableFireForHydra ( theVehicle, seat, jacked )&lt;br /&gt;
    if ( getElementModel ( theVehicle ) == 520 ) then -- if they entered a hydra&lt;br /&gt;
        toggleControl ( source, &amp;quot;vehicle_secondary_fire&amp;quot;, false ) -- disable their fire key&lt;br /&gt;
    else -- if they entered another vehicle&lt;br /&gt;
        toggleControl ( source, &amp;quot;vehicle_secondary_fire&amp;quot;, true ) -- enable their fire key&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerVehicleEnter&amp;quot;, getRootElement(), disableFireForHydra )&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 function will disable the use of the vehicle secondary-fire key for anyone in a Hydra, consequently removing the ability to fire rockets.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function disableFireForHydra ( theVehicle, seat )&lt;br /&gt;
    if ( getElementModel ( theVehicle ) == 520 ) then -- if they entered a hydra&lt;br /&gt;
        toggleControl ( &amp;quot;vehicle_secondary_fire&amp;quot;, false ) -- disable their fire key&lt;br /&gt;
    else -- if they entered another vehicle&lt;br /&gt;
        toggleControl ( &amp;quot;vehicle_secondary_fire&amp;quot;, true ) -- enable their fire key&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onClientPlayerVehicleEnter&amp;quot;, getLocalPlayer(), disableFireForHydra )&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;
{{Input functions}}&lt;/div&gt;</summary>
		<author><name>Dmitry7zip</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=BindKey&amp;diff=43862</id>
		<title>BindKey</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=BindKey&amp;diff=43862"/>
		<updated>2015-01-03T10:10:56Z</updated>

		<summary type="html">&lt;p&gt;Dmitry7zip: Added return type&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
Binds a player's key to a handler function or command, which will be called when the key is pressed. &lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;section name=&amp;quot;Server - Syntax 1&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;bool bindKey ( player thePlayer, string key, string keyState, function handlerFunction,  [ var arguments, ... ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''thePlayer:''' The player you wish to bind the key of.&lt;br /&gt;
*'''key:''' The key or control you wish to bind to the command. See [[key names]] for a list of possible keys and [[control names]] for a list of possible controls.&lt;br /&gt;
*'''keyState:''' A string that has one of the following values:&lt;br /&gt;
**'''&amp;quot;up&amp;quot;:''' If the bound key should trigger the function when the key is released&lt;br /&gt;
**'''&amp;quot;down&amp;quot;:''' If the bound key should trigger the function when the key is pressed&lt;br /&gt;
**'''&amp;quot;both&amp;quot;:''' If the bound key should trigger the function when the key is pressed or released&lt;br /&gt;
*'''handlerFunction:''' The function that will be triggered when the player's key is pressed. This function should have the form:&lt;br /&gt;
:&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;function functionName ( player keyPresser, string key, string keyState, [ var arguments, ... ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
:The values passed to this function are:&lt;br /&gt;
:*'''keyPresser:''' The player who pressed the key&lt;br /&gt;
:*'''key:''' The key that was pressed&lt;br /&gt;
:*'''keyState:''' The state of the key that was pressed, ''down'' if it was pressed, ''up'' if it was released.&lt;br /&gt;
:*'''arguments''' The optional arguments you specified when calling [[bindKey]] (see below).&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{New feature|3|1.0|&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server - Syntax 2&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This alternative syntax allows you to bind a key with a command.  This will also allow users to customize the control in their Settings menu.  Use in conjunction with [[addCommandHandler]] to add handler functions to the keybind.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool bindKey ( player thePlayer, string key, string keyState, string commandName, [ string arguments ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''thePlayer:''' The player you wish to bind the key of.&lt;br /&gt;
*'''key:''' The key or control you wish to bind to the command. See [[key names]] for a list of possible keys.&lt;br /&gt;
*'''keyState:''' A string that has one of the following values:&lt;br /&gt;
**'''&amp;quot;up&amp;quot;:''' If the bound key should trigger the function when the key is released&lt;br /&gt;
**'''&amp;quot;down&amp;quot;:''' If the bound key should trigger the function when the key is pressed&lt;br /&gt;
**'''&amp;quot;both&amp;quot;:''' If the bound key should trigger the function when the key is pressed or released&lt;br /&gt;
*'''commandName:''' The name of the command that the key should be binded to.  &lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''arguments''' Space delimited arguments that are entered as if one was typing the command.&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client - Syntax 1&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;bool bindKey ( string key, string keyState, function handlerFunction,  [ var arguments, ... ] ) &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''key:''' The key or control you wish to bind to the command. See [[key names]] for a list of possible keys and [[control names]] for a list of possible controls.&lt;br /&gt;
*'''keyState:''' A string that has one of the following values:&lt;br /&gt;
**'''&amp;quot;up&amp;quot;:''' If the bound key should trigger the function when the key is released&lt;br /&gt;
**'''&amp;quot;down&amp;quot;:''' If the bound key should trigger the function when the key is pressed&lt;br /&gt;
**'''&amp;quot;both&amp;quot;:''' If the bound key should trigger the function when the key is pressed or released&lt;br /&gt;
&amp;lt;!--*'''bindName:''' The name for this key bind when it appears in the client's settings dialog.--&amp;gt;&lt;br /&gt;
*'''handlerFunction:''' The function that will be triggered when the player's key is pressed. This function should have the form:&lt;br /&gt;
:&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;function functionName ( string key, string keyState, [ var arguments, ... ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
:The values passed to this function are:&lt;br /&gt;
:*'''key:''' The key that was pressed&lt;br /&gt;
:*'''keyState:''' The state of the key that was pressed, ''down'' if it was pressed, ''up'' if it was released.&lt;br /&gt;
:*'''arguments''' The optional arguments you specified when calling [[bindKey]] (see below).&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{New feature|3|1.0|&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client - Syntax 2&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This alternative syntax allows you to bind a key with a command.  This will also allow users to customize the control in their Settings menu.  Use in conjunction with [[addCommandHandler]] to add handler functions to the keybind.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool bindKey ( string key, string keyState, string commandName, [ string arguments ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''key:''' The key or control you wish to bind to the command. See [[key names]] for a list of possible keys.&lt;br /&gt;
*'''keyState:''' A string that has one of the following values:&lt;br /&gt;
**'''&amp;quot;up&amp;quot;:''' If the bound key should trigger the function when the key is released&lt;br /&gt;
**'''&amp;quot;down&amp;quot;:''' If the bound key should trigger the function when the key is pressed&lt;br /&gt;
**'''&amp;quot;both&amp;quot;:''' If the bound key should trigger the function when the key is pressed or released&lt;br /&gt;
*'''commandName:''' The name of the command that the key should be binded to.  &lt;br /&gt;
*'''arguments''' Space delimited arguments that are entered as if one was typing the command.&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
{{OptionalArg}} &lt;br /&gt;
*'''arguments:''' Any arguments you may want to pass to the function when the key is pressed by the user. Any number of arguments of  can be specified, each being passed to the designated function. You may not pass functions.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the key was bound, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
===Issues===&lt;br /&gt;
{{Issues|&lt;br /&gt;
{{Issue|7948|bindKey using a command and control name doesn't work}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
Example 1&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;
This example will bind a player's 'F1' key and 'fire' control to 1 input function.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function funcInput ( player, key, keyState )&lt;br /&gt;
  local state = &amp;quot;let go of&amp;quot;&lt;br /&gt;
  if ( keyState == &amp;quot;down&amp;quot; ) then&lt;br /&gt;
    state = &amp;quot;pressed&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
  outputChatBox ( getPlayerName ( player) .. &amp;quot; &amp;quot; .. state .. &amp;quot; the &amp;quot; .. key .. &amp;quot; key!&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function bindTheKeys ( player, commandName )&lt;br /&gt;
  bindKey ( player, &amp;quot;F1&amp;quot;, &amp;quot;down&amp;quot;, funcInput )   -- bind the player's F1 down key&lt;br /&gt;
  bindKey ( player, &amp;quot;F1&amp;quot;, &amp;quot;up&amp;quot;, funcInput )     -- bind the player's F1 up key&lt;br /&gt;
  bindKey ( player, &amp;quot;fire&amp;quot;, &amp;quot;both&amp;quot;, funcInput ) -- bind the player's fire down and up control&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;bindme&amp;quot;, bindTheKeys )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example 2&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 will bind a player's 'F1' key and 'fire' control to 1 input function, clientside.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function funcInput ( key, keyState )&lt;br /&gt;
  local state = &amp;quot;let go of&amp;quot;&lt;br /&gt;
  if ( keyState == &amp;quot;down&amp;quot; ) then&lt;br /&gt;
    state = &amp;quot;pressed&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
  outputChatBox ( &amp;quot;You &amp;quot; .. state .. &amp;quot; the &amp;quot; .. key .. &amp;quot; key!&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function bindTheKeys ()&lt;br /&gt;
  bindKey ( &amp;quot;F1&amp;quot;, &amp;quot;down&amp;quot;, funcInput )   -- bind the player's F1 down key&lt;br /&gt;
  bindKey ( &amp;quot;F1&amp;quot;, &amp;quot;up&amp;quot;, funcInput )     -- bind the player's F1 up key&lt;br /&gt;
  bindKey ( &amp;quot;fire&amp;quot;, &amp;quot;both&amp;quot;, funcInput ) -- bind the player's fire down and up control&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;bindme&amp;quot;, bindTheKeys )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example says how cool is the MTA:SA is if players wants to move.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function fanFunction()&lt;br /&gt;
  bindKey (source,&amp;quot;forwards&amp;quot;,&amp;quot;down&amp;quot;,&lt;br /&gt;
    function(player,key,state)&lt;br /&gt;
      outputChatBox (getPlayerName (player) .. &amp;quot;#FFFF00 thinks MTA:SA is so cool.&amp;quot;,getRootElement(),255,255,0,true)&lt;br /&gt;
    end&lt;br /&gt;
  )&lt;br /&gt;
end&lt;br /&gt;
addEventHandler (&amp;quot;onPlayerLogin&amp;quot;,getRootElement(),fanFunction)&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;
{{Input functions}}&lt;/div&gt;</summary>
		<author><name>Dmitry7zip</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AclGroupGetName&amp;diff=43861</id>
		<title>AclGroupGetName</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AclGroupGetName&amp;diff=43861"/>
		<updated>2015-01-03T10:08:40Z</updated>

		<summary type="html">&lt;p&gt;Dmitry7zip: Added arg type in syntax&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server function}}&lt;br /&gt;
&amp;lt;!-- Describe in plain english what this function does. Don't go into details, just give an overview --&amp;gt;&lt;br /&gt;
This function is used to get the name of the given ACL group.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;!-- NOTE: don't use 'special' names for variable names, e.g. you shouldn't be writing things like 'player player, vehicle vehicle', instead write something like 'player thePlayer, vehicle vehicleToGetInto'. This is less confusing and prevents the syntax highlighting being odd --&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
string aclGroupGetName ( aclgroup aclGroup )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[aclgroup]]:getName|name|}}&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
&amp;lt;!-- List each argument one per line. This should be the argument's name as in the argument list above, NOT the argument's data type --&amp;gt;&lt;br /&gt;
*'''aclGroup:''' The ACL group to get the name of&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
&amp;lt;!-- Make this descriptive. Explain what cases will return false. If you're unsure, add a tag to it so we can check --&amp;gt;&lt;br /&gt;
Returns the name of the given ACL group as a string if successfull, ''false''/''nil'' if the aclGroup is invalid or it fails for some other reason.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example outputs to the console that &amp;quot;Admin's are ready to watch&amp;quot;. &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;addEventHandler(&amp;quot;onResourceStart&amp;quot;,resourceRoot,function()&lt;br /&gt;
	outputConsole(aclGroupGetName(aclGetGroup(&amp;quot;Admin&amp;quot;))..&amp;quot;'s are ready to watch :)&amp;quot;,root)&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&amp;lt;!-- Change FunctionArea to the area that this function is in on the main function list page, e.g. Server, Player, Vehicle etc --&amp;gt;&lt;br /&gt;
{{ACL_functions}}&lt;/div&gt;</summary>
		<author><name>Dmitry7zip</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AclGroupAddObject&amp;diff=43860</id>
		<title>AclGroupAddObject</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AclGroupAddObject&amp;diff=43860"/>
		<updated>2015-01-03T10:06:29Z</updated>

		<summary type="html">&lt;p&gt;Dmitry7zip: Fixed arg name in &amp;quot;Required Arguments&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server function}}&lt;br /&gt;
&amp;lt;!-- Describe in plain english what this function does. Don't go into details, just give an overview --&amp;gt;&lt;br /&gt;
This function adds an object to the given ACL group. An object can be a player's account, specified as:&lt;br /&gt;
  ''user.&amp;lt;accountname&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
Or a resource, specified as:&lt;br /&gt;
  ''resource.&amp;lt;resourcename&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
Objects are specified as strings. The ACL groups work for the user accounts and the resources that are specified in them.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;!-- NOTE: don't use 'special' names for variable names, e.g. you shouldn't be writing things like 'player player, vehicle vehicle', instead write something like 'player thePlayer, vehicle vehicleToGetInto'. This is less confusing and prevents the syntax highlighting being odd --&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool aclGroupAddObject ( aclgroup theGroup, string theObjectName )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[aclgroup]]:addObject||}}&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
&amp;lt;!-- List each argument one per line. This should be the argument's name as in the argument list above, NOT the argument's data type --&amp;gt;&lt;br /&gt;
*'''theGroup:''' The group to add the object name string too.&lt;br /&gt;
*'''theObjectName:''' The object string to add to the given ACL&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
&amp;lt;!-- Make this descriptive. Explain what cases will return false. If you're unsure, add a tag to it so we can check --&amp;gt;&lt;br /&gt;
Returns ''true'' if the object was successfully added to the ACL, ''false'' if it already existed in the list.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;!-- Explain what the example is in a single sentance --&amp;gt;&lt;br /&gt;
This example makes every player able to use a command named &amp;quot;giveAccountAdminRights&amp;quot; that will add a specific accountname as an ACL object to the &amp;quot;Admin&amp;quot; group.&lt;br /&gt;
&amp;lt;!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized --&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function giveAdminRights (playerSource, commandName, accountName) --add the function giveAdminRights and specify its arguments&lt;br /&gt;
	if accountName then --if there was an accountName entered then&lt;br /&gt;
		aclGroupAddObject (aclGetGroup(&amp;quot;Admin&amp;quot;), &amp;quot;user.&amp;quot;..accountName) --add an ACL object using the form &amp;quot;user.[accountName]&amp;quot; to the ACL group &amp;quot;Admin&amp;quot;&lt;br /&gt;
		outputChatBox (&amp;quot;Account '&amp;quot;..accountName..&amp;quot;' succesfully added to the admin group&amp;quot;, playerSource) --output a notification to the player who entered the command that the acocunt was successfully added&lt;br /&gt;
	else --else output an error message and the correct syntax of the command to the player who entered it&lt;br /&gt;
		outputChatBox (&amp;quot;No account name specified.&amp;quot;, playerSource)&lt;br /&gt;
		outputChatBox (&amp;quot;Correct syntax: /giveAccountAdminRights [accountName]&amp;quot;, playerSource)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addCommandHandler (&amp;quot;giveAccountAdminRights&amp;quot;, giveAdminRights) --add a command &amp;quot;giveAccountAdminRights&amp;quot; and attch the function &amp;quot;giveAdminRights&amp;quot; to it &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&amp;lt;!-- Change FunctionArea to the area that this function is in on the main function list page, e.g. Server, Player, Vehicle etc --&amp;gt;&lt;br /&gt;
{{ACL_functions}}&lt;/div&gt;</summary>
		<author><name>Dmitry7zip</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=ClearElementVisibleTo&amp;diff=43838</id>
		<title>ClearElementVisibleTo</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=ClearElementVisibleTo&amp;diff=43838"/>
		<updated>2015-01-02T20:46:58Z</updated>

		<summary type="html">&lt;p&gt;Dmitry7zip: Fixed arg name in &amp;quot;Required Arguments&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server function}}&lt;br /&gt;
This function clears any settings added by setElementVisibleTo and restores an element to its default visibility.  This does not work with all entities - [[vehicle]]s, [[player]]s and [[object]]s are exempt. This is because these objects are required for accurate sync (they're physical objects). This function is particularily useful for changing the visibility of markers, radar blips and radar areas.&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 clearElementVisibleTo ( element theElement )   &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP|||[[element]]:clearVisibility||}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theElement:''' The element in which you wish to restore to its default visibility&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the operation was successful, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example clears any visibility settings after a player dies, so everyone can see his blip for a short period&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- specify the getBlipAttachedTo function&lt;br /&gt;
function getBlipAttachedTo( thePlayer )&lt;br /&gt;
	local blips = getElementsByType( &amp;quot;blip&amp;quot; )&lt;br /&gt;
	for k, theBlip in ipairs( blips ) do&lt;br /&gt;
		if getElementAttachedTo( theBlip ) == thePlayer then&lt;br /&gt;
			return theBlip&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return false&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function clearVisibilityWasted ( totalammo, killer, killerweapon, bodypart ) -- when a player dies&lt;br /&gt;
    clearElementVisibleTo ( getBlipAttachedTo ( source ) ) -- clear any visiblity settings of his blip&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerWasted&amp;quot;, getRootElement(), clearVisibilityWasted  ) --add an event handler for onPlayerWasted&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Element_functions}}&lt;/div&gt;</summary>
		<author><name>Dmitry7zip</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetPlayerCount&amp;diff=43689</id>
		<title>GetPlayerCount</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetPlayerCount&amp;diff=43689"/>
		<updated>2015-01-01T14:53:40Z</updated>

		<summary type="html">&lt;p&gt;Dmitry7zip: Link to russian page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function returns the number of players currently connected to the server.&lt;br /&gt;
{{Note|#getElementsByType(&amp;quot;player&amp;quot;) works the same as this function but also works client side unlike this function.}}&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int getPlayerCount ( )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[Player]].getCount||}}&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the number of players connected to the server as an [[int]].&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example displays a chat message with the number of players connected to the server when a player joins or quits.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function playerCount ( )&lt;br /&gt;
	outputChatBox ( &amp;quot;There are now &amp;quot; .. getPlayerCount() .. &amp;quot; players on this server!&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerJoin&amp;quot;, getRootElement(), playerCount )&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerQuit&amp;quot;, getRootElement(), playerCount )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Shared implementation of getPlayerCount==&lt;br /&gt;
''getElementsByType(&amp;quot;player&amp;quot;)'' returns a regular-indexed table with every player connected to the server, so by counting how many entries has the table (by using the ''#'' operator) we can archieve the same result as this function, but also clientside. However, it's more efficient to use the built-in function serverside. The next function replaces this function accordingly serverside and clientside to work on both.&lt;br /&gt;
&amp;lt;section name=&amp;quot;Shared (client and server)&amp;quot; class=&amp;quot;both&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 originalGetPlayerCount = getPlayerCount -- Store the original getPlayerCount function to a variable&lt;br /&gt;
&lt;br /&gt;
function getPlayerCount()&lt;br /&gt;
    -- If originalGetPlayerCount is defined, that means that this function is executed serverside.&lt;br /&gt;
    -- The next line returns the result of the original function if it's defined. If not, it counts the number of player elements (to also work clientside).&lt;br /&gt;
    return originalGetPlayerCount and originalGetPlayerCount() or #getElementsByType(&amp;quot;player&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Player functions}}&lt;br /&gt;
&lt;br /&gt;
[[ru:getPlayerCount]]&lt;/div&gt;</summary>
		<author><name>Dmitry7zip</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=RU/getPlayerCount&amp;diff=43688</id>
		<title>RU/getPlayerCount</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=RU/getPlayerCount&amp;diff=43688"/>
		<updated>2015-01-01T14:53:01Z</updated>

		<summary type="html">&lt;p&gt;Dmitry7zip: Created page with &amp;quot;{{RU/Server function}} __NOTOC__ Эта функция возвращает количество игроков, подключенных к серверу. {{Примечан...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{RU/Server function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
Эта функция возвращает количество игроков, подключенных к серверу.&lt;br /&gt;
{{Примечание|#getElementsByType(&amp;quot;player&amp;quot;) работает так же, как эта функция, но работает и на стороне клиента, в отличие от этой функции.}}&lt;br /&gt;
==Синтаксис==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int getPlayerCount ( )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{RU/OOP||[[Player]].getCount||}}&lt;br /&gt;
===Возвращает===&lt;br /&gt;
Возвращает количество игроков, подключенных к серверу в качестве [[int]].&lt;br /&gt;
&lt;br /&gt;
==Пример==&lt;br /&gt;
В этом примере выводится сообщение в чате с количеством игроков, подключенных к серверу, когда игрок входит или выходит.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function playerCount ( )&lt;br /&gt;
	outputChatBox ( &amp;quot;В данный момент &amp;quot; .. getPlayerCount() .. &amp;quot; игроков на сервере!&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerJoin&amp;quot;, getRootElement(), playerCount )&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerQuit&amp;quot;, getRootElement(), playerCount )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Общая реализация getPlayerCount==&lt;br /&gt;
''getElementsByType(&amp;quot;player&amp;quot;)'' возвращает таблицу со списком игроков, подключенных к серверу, поэтому подсчитывая количество записей в таблице (с помощью оператора ''#'') мы получим такой же результат, как и при использовании этой функции, но данный метод работает также в клиентской части. Однако, более эффективно использовать встроенные функции сервера.&lt;br /&gt;
&amp;lt;section name=&amp;quot;Общая реализация (клиент и сервер)&amp;quot; class=&amp;quot;both&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 originalGetPlayerCount = getPlayerCount -- Сохраняем оригинальную функцию getPlayerCount в переменную&lt;br /&gt;
&lt;br /&gt;
function getPlayerCount()&lt;br /&gt;
    -- Если переменная originalGetPlayerCount определена, это значит, что функция выполняется на стороне сервера&lt;br /&gt;
    -- Следующая строка возвращает результат оригинальной функции, если она определена. Если нет, то подсчитывается количество элементов таблицы ''player'' (для работы на клиентской части)&lt;br /&gt;
    return originalGetPlayerCount and originalGetPlayerCount() or #getElementsByType(&amp;quot;player&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Смотрите также==&lt;br /&gt;
{{RU/Player functions}}&lt;br /&gt;
&lt;br /&gt;
[[en:getPlayerCount]]&lt;/div&gt;</summary>
		<author><name>Dmitry7zip</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetPlayerPing&amp;diff=43648</id>
		<title>GetPlayerPing</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetPlayerPing&amp;diff=43648"/>
		<updated>2015-01-01T14:32:50Z</updated>

		<summary type="html">&lt;p&gt;Dmitry7zip: Link to russian page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function returns the ping of a specified [[player]]. The ping is the number of milliseconds that data takes to travel from the player's client to the server or vice versa.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;int getPlayerPing ( player thePlayer )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[player]]:getPing|ping|}}&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''thePlayer''': The [[player]] whose ping you want to determine.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the ping as an [[int]], or ''false'' if the player is invalid.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example checks every players ping every 5 seconds and if it's over 500 they get kicked.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function kickPing() -- Creates a function called kickPing&lt;br /&gt;
	for i, player in ipairs(getElementsByType(&amp;quot;player&amp;quot;)) do -- Loop every player&lt;br /&gt;
		if (getPlayerPing(player) &amp;gt;= 500) then -- If their ping is over 500&lt;br /&gt;
			kickPlayer(player, &amp;quot;Ping over 500!&amp;quot;) -- Kick them&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
setTimer(kickPing, 5000, 0) -- Every 5 seconds, the kickPing function is called.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example checks the ping of every player entering the 'ping' command and warns him if it's over 100.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function checkPing()&lt;br /&gt;
        local ping = getPlayerPing(getLocalPlayer())  -- get the ping from the source element (the player who joined)&lt;br /&gt;
        if (ping &amp;gt; 100) then                          -- if it's higher than 100...&lt;br /&gt;
                outputChatBox(&amp;quot;Your ping is pretty high! Please try to lower it if possible.&amp;quot;) -- output a message to the player&lt;br /&gt;
        end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;ping&amp;quot;, checkPing)&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;
{{Player functions}}&lt;br /&gt;
&lt;br /&gt;
[[ru:getPlayerPing]]&lt;/div&gt;</summary>
		<author><name>Dmitry7zip</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=RU/getPlayerPing&amp;diff=43646</id>
		<title>RU/getPlayerPing</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=RU/getPlayerPing&amp;diff=43646"/>
		<updated>2015-01-01T14:31:50Z</updated>

		<summary type="html">&lt;p&gt;Dmitry7zip: Created page with &amp;quot;__NOTOC__ {{RU/Server client function}} Данная функция возвращает пинг определенного игрока. Пинг - это количеств...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{RU/Server client function}}&lt;br /&gt;
Данная функция возвращает пинг определенного игрока. Пинг - это количество миллисекунд, за которые информация доходит от клиента игрока до сервера и наоборот.&lt;br /&gt;
&lt;br /&gt;
==Синтаксис==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;int getPlayerPing ( player thePlayer )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{RU/OOP|Данная функция также является статической функцией класса Player.|[[player]].getPing||}}&lt;br /&gt;
===Обязательные аргументы===&lt;br /&gt;
*'''thePlayer''': [[игрок]], пинг которого нужно узнать&lt;br /&gt;
&lt;br /&gt;
===Возвращает===&lt;br /&gt;
Возвращает пинг как [[int]] или ''false'', если указан некорректный игрок&lt;br /&gt;
&lt;br /&gt;
==Пример==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Сервер&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
Этот пример каждые 5 секунд получает пинг каждого игрока, и если он выше 500, то происходит отсоединение игрока от сервера&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function kickPing() -- Создаем функцию для таймера&lt;br /&gt;
	for i, player in ipairs(getElementsByType(&amp;quot;player&amp;quot;)) do -- Проходим всех игроков&lt;br /&gt;
		if (getPlayerPing(player) &amp;gt;= 500) then -- Если пинг больше 500&lt;br /&gt;
			kickPlayer(player, &amp;quot;Ваш пинг выше 500!&amp;quot;) -- Отсоединяем игрока&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
setTimer(kickPing, 5000, 0) -- Создаем таймер, который будет вызывать функцию kickPing каждые 5 секунд&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Клиент&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
Этот пример проверяет пинг игрока при вводе команды 'ping' и выводит предупреждение, если он выше 100&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function checkPing()&lt;br /&gt;
        local ping = getPlayerPing(getLocalPlayer())  -- получаем пинг&lt;br /&gt;
        if (ping &amp;gt; 100) then                          -- если пинг выше 100...&lt;br /&gt;
                outputChatBox(&amp;quot;У Вас слишком высокий пинг! Пожалуйста, попробуйте снизить его.&amp;quot;) -- выводим сообщение игроку&lt;br /&gt;
        end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;ping&amp;quot;, checkPing)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Смотрите также==&lt;br /&gt;
{{RU/Player functions}}&lt;br /&gt;
&lt;br /&gt;
[[en:getPlayerPing]]&lt;/div&gt;</summary>
		<author><name>Dmitry7zip</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetFogDistance&amp;diff=37523</id>
		<title>SetFogDistance</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetFogDistance&amp;diff=37523"/>
		<updated>2013-11-08T10:12:22Z</updated>

		<summary type="html">&lt;p&gt;Dmitry7zip: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function changes the visible distance of fog.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool setFogDistance ( float distance )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a ''bool''.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server and Client&amp;quot; class=&amp;quot;both&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 fogdistance ( )&lt;br /&gt;
    setFogDistance(1.0)&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;fog&amp;quot;, fogdistance )&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;
{{World functions}}&lt;/div&gt;</summary>
		<author><name>Dmitry7zip</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetFogDistance&amp;diff=37522</id>
		<title>SetFogDistance</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetFogDistance&amp;diff=37522"/>
		<updated>2013-11-08T10:11:54Z</updated>

		<summary type="html">&lt;p&gt;Dmitry7zip: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function changes the visible distance of fog.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool setFogDistance ( float distance )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a ''bool''.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server and Client&amp;quot; class=&amp;quot;both&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 fogdistance ( )&lt;br /&gt;
    setFogDistance(1.0)&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;fog&amp;quot;, fogdistance )&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;
{{World functions}}&lt;br /&gt;
&lt;br /&gt;
[[ru:getGameSpeed]]&lt;/div&gt;</summary>
		<author><name>Dmitry7zip</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=RU/Modules/Texturizer&amp;diff=37495</id>
		<title>RU/Modules/Texturizer</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=RU/Modules/Texturizer&amp;diff=37495"/>
		<updated>2013-11-05T17:54:35Z</updated>

		<summary type="html">&lt;p&gt;Dmitry7zip: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Module_Info|&lt;br /&gt;
  name           = Texturizer |&lt;br /&gt;
  version        = 0.91 |&lt;br /&gt;
  author         = [[User:Jyrno|Jyrno]] и JoRX |&lt;br /&gt;
  module_website = ''Недоступен'' |&lt;br /&gt;
  download_link  = [http://www.mediafire.com/?65c339jt4wl21i5 Здесь] [http://www.multiupload.com/JW4SICQG57 Зеркало] |&lt;br /&gt;
  license        = ''Без лицензии'' |&lt;br /&gt;
  written_in     = C++ |&lt;br /&gt;
  operating_system = Только Windows |&lt;br /&gt;
  compatible_with = 1.0.4 |&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Texturizer - модуль, предоставляющий запись в библиотеки TXD и GD-функции для сервера MTASA. На данный момент он доступен только для Windows, но так как он основан на системе CMake, его использование на других платформах должно быть также достаточно несложным.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Установка==&lt;br /&gt;
===Windows===&lt;br /&gt;
&lt;br /&gt;
# Распакуйте файл Texturizer.dll в папку ''%PROGRAMFILES%\MTA San Andreas 1.3\server\mods\deathmatch\modules\'' вашего сервера.&lt;br /&gt;
# Распакуйте бинарные файлы библиотеки GD bgd.dll и libpng14.dll в папку ''%PROGRAMFILES%\MTA San Andreas 1.3\server\'' вашего сервера.&lt;br /&gt;
# Затем, добавьте следующую строку в mtaserver.conf вашего сервера:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;module src=&amp;quot;Texturizer.dll&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Теперь все, что вам осталось - запустить сервер.&lt;br /&gt;
&lt;br /&gt;
'''Также рекомендуется:'''&lt;br /&gt;
# Распаковать ресурс texturizer в папку ''%PROGRAMFILES%\MTA San Andreas 1.3\server\mods\deathmatch\resources\'' вашего сервера.&lt;br /&gt;
# Затем, добавить следующую строку в mtaserver.conf вашего сервера:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;resource src=&amp;quot;texturizer&amp;quot; startup=&amp;quot;1&amp;quot; protected=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Это предоставит функцию автоочистки памяти в случае, если вы забыли уничтожить картинки, используемые каким-либо ресурсом, при его выгрузке.&lt;br /&gt;
&lt;br /&gt;
==Функции==&lt;br /&gt;
{{Modules/Texturizer/Functions}}&lt;br /&gt;
&lt;br /&gt;
[[Category:RU/Modules]]&lt;br /&gt;
&lt;br /&gt;
[[en:Modules/Texturizer]]&lt;/div&gt;</summary>
		<author><name>Dmitry7zip</name></author>
	</entry>
</feed>