<?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=Nikoo834</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=Nikoo834"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/Nikoo834"/>
	<updated>2026-05-03T23:51:41Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL&amp;diff=76185</id>
		<title>Modules/MTA-MySQL</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL&amp;diff=76185"/>
		<updated>2023-02-07T17:36:22Z</updated>

		<summary type="html">&lt;p&gt;Nikoo834: Accidentally entered whitespace removed&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
{{Warning|We don't provide any support for this module!}}&lt;br /&gt;
{{Warning|This module is too old, please use [[dbConnect]] instead.}}&lt;br /&gt;
&lt;br /&gt;
{{Module_Info|&lt;br /&gt;
  name           = MTA MySQL |&lt;br /&gt;
  version        = 0.5 |&lt;br /&gt;
  author         = [[User:ryden|Alberto Alonso (ryden)]] |&lt;br /&gt;
  author2         = [[User:ryden|Alberto Alonso (ryden)]] |&lt;br /&gt;
  module_website = [http://code.google.com/p/multitheftauto-modules Here] |&lt;br /&gt;
  download_link  = [https://nightly.mtasa.com/files/modules/32/mta_mysql.dll Windows 32 bit]&amp;lt;br/&amp;gt;[https://nightly.mtasa.com/files/modules/64/mta_mysql.dll Windows  64 bit]&lt;br /&gt;
[https://nightly.mtasa.com/files/modules/32/mta_mysql.so Linux 32 bit]&amp;lt;br/&amp;gt;[https://nightly.mtasa.com/files/modules/64/mta_mysql.so Linux 64 bit] |&lt;br /&gt;
  license        = [http://www.opensource.org/licenses/bsd-license.php BSD] |&lt;br /&gt;
  written_in     = C++ |&lt;br /&gt;
  operating_system = Cross-platform |&lt;br /&gt;
  compatible_with = DP2.x &amp;amp; 1.X |&lt;br /&gt;
}}&lt;br /&gt;
MTA MySQL is an alternative to the default [[Modules/MySQL|ml_mysql]] module provided by the MTA team.&lt;br /&gt;
It is available for Windows and GNU/Linux and provides the source code.&lt;br /&gt;
&lt;br /&gt;
''Note: From version 0.4 it supports both DP2.3 and 1.0 servers.''&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
===Windows===&lt;br /&gt;
'''32 bit:''' Copy 32 bit mta_mysql.dll into the '''MTA San Andreas\server\mods\deathmatch\modules\''' directory.&amp;lt;br/&amp;gt;&lt;br /&gt;
''(You might also need to install [https://nightly.mtasa.com/files/vcredist_2013_x86.exe 32 bit VS2013 Runtime Redist])''&lt;br /&gt;
&lt;br /&gt;
'''64 bit:''' Copy 64 bit mta_mysql.dll into the '''MTA San Andreas\server\x64\modules\''' directory.&amp;lt;br/&amp;gt;&lt;br /&gt;
''(You might also need to install [https://nightly.mtasa.com/files/vcredist_2013_x64.exe 64 bit VS2013 Runtime Redist])''&lt;br /&gt;
&lt;br /&gt;
Then, add the following line in 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;mta_mysql.dll&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GNU/Linux===&lt;br /&gt;
'''32 bit:''' Copy 32 bit mta_mysql.so into the '''mods/deathmatch/modules/''' directory.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''64 bit:''' Copy 64 bit mta_mysql.so into the '''x64/modules/''' directory.&lt;br /&gt;
&lt;br /&gt;
Then, add the following line in 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;mta_mysql.so&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To fix '''MODULE: Unable to find modules/mta_mysql.so (libmysqlclient.so.16: cannot open shared object file: No such file or directory)!''' copy ''libmysqlclient.so.16'' into '''/usr/lib''' ([https://nightly.mtasa.com/files/modules/32/libmysqlclient.so.16 32 bit], [https://nightly.mtasa.com/files/modules/64/libmysqlclient.so.16 64 bit])&lt;br /&gt;
&lt;br /&gt;
'''If you experience an error on Unix systems:'''&lt;br /&gt;
Try to add port and socket parameters to your mysql_connect.&lt;br /&gt;
&lt;br /&gt;
==Handler functions==&lt;br /&gt;
{{Modules/MTA-MySQL/Handler_functions}}&lt;br /&gt;
&lt;br /&gt;
==Result managing functions==&lt;br /&gt;
{{Modules/MTA-MySQL/Result_functions}}&lt;br /&gt;
&lt;br /&gt;
==Version 0.5 calling method==&lt;br /&gt;
From version 0.5 onwards you can call all this module functions, except mysql_connect and mysql_null, as if they are methods of an object.&lt;br /&gt;
&lt;br /&gt;
For example, having a valid MySQL handler, you can do handler:query ( &amp;quot;SELECT * FROM table&amp;quot; ) instead of mysql_query ( handler, &amp;quot;SELECT * FROM table&amp;quot; ).&lt;br /&gt;
&lt;br /&gt;
===Function aliases===&lt;br /&gt;
A function alias is a second name for a function, which makes calling any of the original name or the alias have the same result. The new aliases introduced in version 0.5 are:&lt;br /&gt;
* result:num_rows() is the same as result:numrows()&lt;br /&gt;
* result:num_fields() is the same as result:numfields()&lt;br /&gt;
* result:free_result() is the same as result:free()&lt;br /&gt;
&lt;br /&gt;
[[Category:Modules]]&lt;br /&gt;
&lt;br /&gt;
[[ru:Modules/MTA-MySQL]]&lt;/div&gt;</summary>
		<author><name>Nikoo834</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL&amp;diff=76184</id>
		<title>Modules/MTA-MySQL</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL&amp;diff=76184"/>
		<updated>2023-02-07T17:34:08Z</updated>

		<summary type="html">&lt;p&gt;Nikoo834: Reduced huge font size&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Warning|We don't provide any support for this module!}}&lt;br /&gt;
{{Warning|This module is too old, please use [[dbConnect]] instead.}}&lt;br /&gt;
&lt;br /&gt;
{{Module_Info|&lt;br /&gt;
  name           = MTA MySQL |&lt;br /&gt;
  version        = 0.5 |&lt;br /&gt;
  author         = [[User:ryden|Alberto Alonso (ryden)]] |&lt;br /&gt;
  author2         = [[User:ryden|Alberto Alonso (ryden)]] |&lt;br /&gt;
  module_website = [http://code.google.com/p/multitheftauto-modules Here] |&lt;br /&gt;
  download_link  = [https://nightly.mtasa.com/files/modules/32/mta_mysql.dll Windows 32 bit]&amp;lt;br/&amp;gt;[https://nightly.mtasa.com/files/modules/64/mta_mysql.dll Windows  64 bit]&lt;br /&gt;
[https://nightly.mtasa.com/files/modules/32/mta_mysql.so Linux 32 bit]&amp;lt;br/&amp;gt;[https://nightly.mtasa.com/files/modules/64/mta_mysql.so Linux 64 bit] |&lt;br /&gt;
  license        = [http://www.opensource.org/licenses/bsd-license.php BSD] |&lt;br /&gt;
  written_in     = C++ |&lt;br /&gt;
  operating_system = Cross-platform |&lt;br /&gt;
  compatible_with = DP2.x &amp;amp; 1.X |&lt;br /&gt;
}}&lt;br /&gt;
MTA MySQL is an alternative to the default [[Modules/MySQL|ml_mysql]] module provided by the MTA team.&lt;br /&gt;
It is available for Windows and GNU/Linux and provides the source code.&lt;br /&gt;
&lt;br /&gt;
''Note: From version 0.4 it supports both DP2.3 and 1.0 servers.''&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
===Windows===&lt;br /&gt;
'''32 bit:''' Copy 32 bit mta_mysql.dll into the '''MTA San Andreas\server\mods\deathmatch\modules\''' directory.&amp;lt;br/&amp;gt;&lt;br /&gt;
''(You might also need to install [https://nightly.mtasa.com/files/vcredist_2013_x86.exe 32 bit VS2013 Runtime Redist])''&lt;br /&gt;
&lt;br /&gt;
'''64 bit:''' Copy 64 bit mta_mysql.dll into the '''MTA San Andreas\server\x64\modules\''' directory.&amp;lt;br/&amp;gt;&lt;br /&gt;
''(You might also need to install [https://nightly.mtasa.com/files/vcredist_2013_x64.exe 64 bit VS2013 Runtime Redist])''&lt;br /&gt;
&lt;br /&gt;
Then, add the following line in 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;mta_mysql.dll&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GNU/Linux===&lt;br /&gt;
'''32 bit:''' Copy 32 bit mta_mysql.so into the '''mods/deathmatch/modules/''' directory.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''64 bit:''' Copy 64 bit mta_mysql.so into the '''x64/modules/''' directory.&lt;br /&gt;
&lt;br /&gt;
Then, add the following line in 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;mta_mysql.so&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To fix '''MODULE: Unable to find modules/mta_mysql.so (libmysqlclient.so.16: cannot open shared object file: No such file or directory)!''' copy ''libmysqlclient.so.16'' into '''/usr/lib''' ([https://nightly.mtasa.com/files/modules/32/libmysqlclient.so.16 32 bit], [https://nightly.mtasa.com/files/modules/64/libmysqlclient.so.16 64 bit])&lt;br /&gt;
&lt;br /&gt;
'''If you experience an error on Unix systems:'''&lt;br /&gt;
Try to add port and socket parameters to your mysql_connect.&lt;br /&gt;
&lt;br /&gt;
==Handler functions==&lt;br /&gt;
{{Modules/MTA-MySQL/Handler_functions}}&lt;br /&gt;
&lt;br /&gt;
==Result managing functions==&lt;br /&gt;
{{Modules/MTA-MySQL/Result_functions}}&lt;br /&gt;
&lt;br /&gt;
==Version 0.5 calling method==&lt;br /&gt;
From version 0.5 onwards you can call all this module functions, except mysql_connect and mysql_null, as if they are methods of an object.&lt;br /&gt;
&lt;br /&gt;
For example, having a valid MySQL handler, you can do handler:query ( &amp;quot;SELECT * FROM table&amp;quot; ) instead of mysql_query ( handler, &amp;quot;SELECT * FROM table&amp;quot; ).&lt;br /&gt;
&lt;br /&gt;
===Function aliases===&lt;br /&gt;
A function alias is a second name for a function, which makes calling any of the original name or the alias have the same result. The new aliases introduced in version 0.5 are:&lt;br /&gt;
* result:num_rows() is the same as result:numrows()&lt;br /&gt;
* result:num_fields() is the same as result:numfields()&lt;br /&gt;
* result:free_result() is the same as result:free()&lt;br /&gt;
&lt;br /&gt;
[[Category:Modules]]&lt;br /&gt;
&lt;br /&gt;
[[ru:Modules/MTA-MySQL]]&lt;/div&gt;</summary>
		<author><name>Nikoo834</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AddEventHandler&amp;diff=76183</id>
		<title>AddEventHandler</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AddEventHandler&amp;diff=76183"/>
		<updated>2023-02-07T15:14:19Z</updated>

		<summary type="html">&lt;p&gt;Nikoo834: Adding warning messages to sourceResource and sourceResourceRoot.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server client function}} &lt;br /&gt;
{{Important Note|Do '''NOT''' use the same name for your handler function as the event name, as this can lead to confusion if multiple handler functions are used. On the same note, for multiple reasons, it is '''NOT''' a good idea to export the same functions that you use locally as remote event handlers.}}&lt;br /&gt;
This function will add an [[event]] handler. An event handler is a function that will be called when the event it's attached to is triggered. See [[event system]] for more information on how the event system works.&lt;br /&gt;
{{Important Note|See code for this note below}}&lt;br /&gt;
&lt;br /&gt;
Event handlers are functions that are called when a particular event happens. Each event specifies a specific set of variables that are passed to the event handler and can be read by your function. The following global variables are available for use in handler functions:&lt;br /&gt;
*'''source''': the element that triggered the event&lt;br /&gt;
*'''this''': the element that the event handler is attached to&lt;br /&gt;
*'''sourceResource''': the resource that triggered the event. Not set if the event was not triggered from a client.&lt;br /&gt;
*'''sourceResourceRoot''': the root element of the resource that triggered the event. Not set if the event was not triggered from a client.&lt;br /&gt;
*'''client''': the client that triggered the event using [[triggerServerEvent]]. Not set if the event was not triggered from a client.&lt;br /&gt;
{{New_feature|3|1.0|&lt;br /&gt;
*'''eventName''': the name of the event which triggered the handler function.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
It is important to remember that events pass up and down the [[element tree]]. An event triggered on the root element is triggered on every element in the tree. An event triggered on any other element is triggered on its ancestors (its parent element and its parent's parent etc) and its children, grandchildren and great-grandchildren. You can use the ''propagate'' argument to specify if you wish your handler to receive events that have propagated up or down the tree.&lt;br /&gt;
&lt;br /&gt;
The order in which event handlers are triggered is undefined, you should not rely on one event handler being executed before another.&lt;br /&gt;
{{Note|See [[Script security]] for tips on preventing cheaters when using events and element data}}&lt;br /&gt;
{{Note|See [[Event_Source_Element|Event Source Element]] for a descriptive visualization of the event system handling an event trigger.}}&lt;br /&gt;
&lt;br /&gt;
Each function closure can only be added once to each event. On the second attempt to add the function closure to the same event a warning will be emitted to the debug console and the call to addEventHandler will fail.&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool addEventHandler ( string eventName, element attachedTo, function handlerFunction [, bool propagate = true, string priority = &amp;quot;normal&amp;quot; ] )    &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''eventName:''' The name of the [[event]] you want to attach the handler function to. '''Note: The maximum allowed length is 100 ASCII characters (that is, English letters and numerals)'''&lt;br /&gt;
*'''attachedTo:''' The [[element]] you wish to attach the handler to. The handler will only be called when the event it is attached to is triggered for this element, or one of its children. Often, this can be the root element (meaning the handler will be called when the event is triggered for ''any'' element).&lt;br /&gt;
*'''handlerFunction:''' The handler function you wish to call when the event is triggered. This function will be passed all of the event's parameters as arguments, but it isn't required that it takes all of them.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''propagate:''' A boolean representing whether the handler will be triggered if the event was propagated down or up the [[element tree]] (starting from the source), and not triggered directly on attachedTo (that is, handlers attached with this argument set to ''false'' will only be triggered if ''source == this''). In GUI events you will probably want to set this to ''false''.&lt;br /&gt;
{{New_feature|3.0131|1.3.1|&lt;br /&gt;
*'''priority :''' A string representing the trigger order priority relative to other event handlers of the same name. Possible values are:&lt;br /&gt;
**'''&amp;quot;high&amp;quot;'''&lt;br /&gt;
**'''&amp;quot;normal&amp;quot;'''&lt;br /&gt;
**'''&amp;quot;low&amp;quot;'''&lt;br /&gt;
''It is also possible to add finer priority control by appending a positive or negative number to the priority string. For example (in priority order for reference): &amp;quot;high+4&amp;quot; &amp;quot;high&amp;quot; &amp;quot;high-1&amp;quot; &amp;quot;normal-6&amp;quot; &amp;quot;normal-7&amp;quot; &amp;quot;low+1&amp;quot; &amp;quot;low&amp;quot; &amp;quot;low-1&amp;quot;''&lt;br /&gt;
{{Important Note|Anything bound to a specific element will be run before other handlers that are bound to something higher in the element tree (like root) This means that &amp;quot;high+10&amp;quot; bound to root '''won't''' trigger before &amp;quot;normal&amp;quot; bound directly to an element.}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the event handler was attached successfully. Returns ''false'' if the specified event could not be found or any parameters were invalid.&lt;br /&gt;
&lt;br /&gt;
==Remarks==&lt;br /&gt;
Due to the additional set of global variables, the event-trigger specific variables it is '''NOT a good idea to use the same function locally as well as directly as an event handler'''. Event handlers often make use of the source element variable which would often find no use in generic functions. Inside of server-side remote event handlers it is important to add protections against exploits due to unexpected client event triggers or network-based load situations while generic functions, due to being part of a controlled call-stack, do not in general face the same issues. It is recommended to adapt a '''good-natured distancing''' principle between code meant to run from local logic in separation to code meant to run from remote logic.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;!-- This code is wrong. It WILL crash the server eventually because it is registering a new event handler every time &amp;quot;eventName&amp;quot; event is called.&lt;br /&gt;
&amp;lt;section name=&amp;quot;Code for important note above&amp;quot; class=&amp;quot;Important&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This code might not work as you expect: The handler added here won't be called until the next time the event is triggered. On the other hand, removing events works as expected.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEvent(&amp;quot;eventName&amp;quot;)&lt;br /&gt;
addEventHandler(&amp;quot;eventName&amp;quot;, root, function()&lt;br /&gt;
    print(&amp;quot;Existing called&amp;quot;)&lt;br /&gt;
    addEventHandler(&amp;quot;eventName&amp;quot;, root, function()&lt;br /&gt;
        print(&amp;quot;newly added called&amp;quot;)&lt;br /&gt;
    end)&lt;br /&gt;
end)&lt;br /&gt;
-- first time calling the event&lt;br /&gt;
triggerEvent(&amp;quot;eventName&amp;quot;, root) -- prints &amp;quot;Existing called&amp;quot;&lt;br /&gt;
-- second time - now both handlers are called&lt;br /&gt;
triggerEvent(&amp;quot;eventName&amp;quot;, root) -- prints &amp;quot;Existing called&amp;quot;, &amp;quot;newly added called&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;--&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 serverside example sends a message to everyone in the server when a player spawns.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- define our handler function&lt;br /&gt;
function onPlayerSpawnHandler ( )&lt;br /&gt;
	-- get the player's name, source is the player because he was spawned&lt;br /&gt;
	local playerName = getPlayerName( source )&lt;br /&gt;
	-- output in the chat box that they've spawned&lt;br /&gt;
	outputChatBox ( playerName .. &amp;quot; has spawned!&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEventHandler( &amp;quot;onPlayerSpawn&amp;quot;, root, onPlayerSpawnHandler ) -- root is a predefined global variable for getRootElement()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Changelog==&lt;br /&gt;
{{ChangelogHeader}}&lt;br /&gt;
{{ChangelogItem|1.3.0-9.03795|Added priority argument}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Event_functions}}&lt;br /&gt;
[[ru:addEventHandler]]&lt;/div&gt;</summary>
		<author><name>Nikoo834</name></author>
	</entry>
</feed>