https://wiki.multitheftauto.com/api.php?action=feedcontributions&user=Quiret&feedformat=atomMulti Theft Auto: Wiki - User contributions [en]2024-03-28T23:54:14ZUser contributionsMediaWiki 1.39.3https://wiki.multitheftauto.com/index.php?title=Template:Deprecated_items&diff=77499Template:Deprecated items2023-08-17T18:28:18Z<p>Quiret: </p>
<hr />
<div><includeonly>{{#if:{{{1|}}}|<div style='border-radius: 10px; margin: 14px 0; overflow: hidden'><div style='background: red; color: #fff; font-weight: bold; padding: 4px 8px'>BEFORE VERSION {{{2}}} {{#if:{{{4|}}}|{{r|{{{4}}}}}|}}:</div><div style='border: 2px solid red;padding: 3px; border-bottom-left-radius: 10px; border-bottom-right-radius: 10px;'>{{{3}}}</div></div>|}}</includeonly><noinclude><br />
Use this template to list deprecated functions and events.<br />
[[Category:Utility templates]]</noinclude></div>Quirethttps://wiki.multitheftauto.com/index.php?title=User_talk:Dragon&diff=76999User talk:Dragon2023-06-14T19:02:08Z<p>Quiret: gj</p>
<hr />
<div><section name="Todo" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
>extend magnetwheels functionality<br />
| -different modes, detect near ground and walls<br />
----->camera fixes ... ?<br />
| | -remove quick changing, flickering<br />
| | -possibility to deactivate, maybe request it<br />
| -remove ability to use it as a way of flying<br />
>extend xxxs functionality if playing animations backwards becomes possible<br />
| -user controls, mime hot coffee... if i get permission to do so lols<br />
| -maybe add female part too, multiplayer like<br />
| -camera<br />
>add new features to scoreboard<br />
----->click players and get options what to do, PM, votekick, etc.<br />
| | export a function to include new fields, for admin kick, band, spectate and such<br />
| -clientside settings<br />
| -request name column to become smaller or shrink, or code and submit patch for it<br />
>spacecowboys gamemode<br />
| -to much to do to list it here<br />
>dark resource<br />
| -let this become a stealth map or something with included lua to make it "dark" ;P<br />
| -set the timer correctly so the darkness rectangle doesnt stack and activate, deactivate correctly for goggles<br />
| -somehow add a hint that goggles are really useful on this map so more people take it on stealth start<br />
>utsounds<br />
| -get the original facts when which sound is played<br />
| -clean up code... -argh<br />
| -better quality for some sounds<br />
| -remove headshot code and include it instead, offer setting for sniper 1 hit kill or put it in an own resource<br />
| -a help file..??<br />
>admin<br />
| -possibility to dis include resource types in resource list so servers with many maps have a better survey of their resources<br />
| -fix autologin option somehow<br />
| -maybe help getting rid of warnings, errors and bring back its old functionality<br />
>lag compensation<br />
| -maybe ask talidan for a fix and an included testing session<br />
| -search for the revision its uselessness is caused by<br />
| -testing between dp2.3 and current<br />
>find cause for currently emerging BAD DESYNC<br />
>bullet holes and scratches for cars script<br />
>chatbubbles<br />
----->fix overlapping (for a later release)<br />
| | -make it work<br />
| | -make it look smooth<br />
| | -find a good way to implement this, test CAREFULLY<br />
| -release it<br />
| -ask for it to become part of optional resources<br />
>dragonsmusic<br />
| -cycling between own stand alone resources which play the music, so you dont need to download all of them at once<br />
| -MOAR SONGS<br />
>external http download issue?!<br />
>flashbang<br />
| -sound volume depending on distance<br />
| -when closer longer blind, when far away only for short time<br />
| -depending where on screen it is<br />
| -bug with rocketlauncher and sniper aim<br />
| -dxrectangle instead, find a way to combine it with sound blending<br />
>notifications<br />
| -optimize the size for all resolutions<br />
| -create a how to use guide<br />
| -add some examples<br />
| -release<br />
>maps<br />
| -check for doors to replace (because of new dynamic objects)<br />
| -release them<br />
| -finish hallway and add security cams<br />
>stealth<br />
| -add some celebration sounds in the end<br />
>beg for community login, 3d scene and credits scene to come back<br />
</syntaxhighlight><br />
</section><br />
<br />
good job on the GTA SA obtainment recommendation page. Just minor grammatical things but I like your perceptional, accessibility touch ups. Btw pls tell me it was not done using AI text tools. 😊 [[User:Quiret|Quiret]] ([[User talk:Quiret|talk]]) 19:02, 14 June 2023 (UTC)</div>Quirethttps://wiki.multitheftauto.com/index.php?title=Modules/FileSystem&diff=76320Modules/FileSystem2023-03-29T23:08:27Z<p>Quiret: clarified arch of new 64bit release (Windows AMD64)</p>
<hr />
<div><pageclass class="#62A033" subcaption="FileSystem module"></pageclass><br />
<br />
{{Module_Info|<br />
name = FileSystem |<br />
version = 2.0 |<br />
author = [[User:The_GTA|Martin Turski (The_GTA)]] |<br />
module_website = [http://eirfs.osdn.jp/ Here] |<br />
download_link = [https://green-candy.osdn.jp/external/releases/fileSystem_2_0_win32.zip Win32] [https://green-candy.osdn.jp/external/releases/fileSystem_2_0_x64.zip AMD64 (Win)] [https://green-candy.osdn.jp/external/releases/fileSystem_2_0_linux.zip Linux (AMD64)] |<br />
license = [https://green-candy.osdn.jp/external/licenses/license_mtamodule.txt here] |<br />
written_in = C++ |<br />
operating_system = Cross-platform |<br />
compatible_with = 1.X |<br />
}}<br />
FileSystem is the [[MTA:Eir]] file management implementation exported as MTA:BLUE module. It is made for those people who are not satisfied with the standard MTA file functions. Its feature-set covers '''binary stream writing''', '''directory scanning''' and '''path resolution logic'''. It should satisfy all needs regarding file functionality. The modules' source code is released [https://osdn.net/projects/green-candy/scm/svn/tree/head/blueMods/fileSystem/ within the MTA:Eir SVN].<br />
<br />
It's documentation can be found [[MTA:Eir/FileSystem|here]]. To find coding examples, ''browse the individual class methods''.<br />
<br />
==Installing FileSystem into your Server==<br />
*Place the fileSystem*.dll module into your MTA server modules directory<br />
*Add the module into the mtaserver.conf module loading list (at the bottom of the file)<br />
*'''Edit the acl.xml in a way that resources require admin rights to call''' [[Modules/FileSystem/createFilesystemInterface|createFilesystemInterface]]''<br />
<br />
==System Access Possibilities==<br />
*Accessing whole system<br />
*Listing and editing all server resources<br />
*Modifying MTA Server configuration<br />
<br />
'''Be careful how you expose the FileSystem module to your server resources!'''<br />
<br />
==OOP-style API==<br />
Since version 2.0 of this library the API has been changed to match the MTA OOP-style API. This means that object methods are now accessed solely using the '''colon operator''' instead of the '''dot operator'''. If you have old FileSystem code (pre 2.0) then you may have to adjust it.<br />
<br />
==Support==<br />
If you are looking for direct support about this module then contact [https://forum.mtasa.com/profile/9756-the_gta/ The_GTA on the MTA forums]. The official MTA forums support topic can be found [https://forum.mtasa.com/topic/133936-filesystem-module-for-mtablue/ here].<br />
<br />
*[[Modules/FileSystem/Porting_Between_Clientside_and_Serverside|Porting Clientside and Serverside code]]<br />
<br />
{{:Modules/FileSystem/functions}}<br />
<br />
[[Category:Modules]]</div>Quirethttps://wiki.multitheftauto.com/index.php?title=Modules/FileSystem&diff=76319Modules/FileSystem2023-03-29T23:06:56Z<p>Quiret: </p>
<hr />
<div><pageclass class="#62A033" subcaption="FileSystem module"></pageclass><br />
<br />
{{Module_Info|<br />
name = FileSystem |<br />
version = 2.0 |<br />
author = [[User:The_GTA|Martin Turski (The_GTA)]] |<br />
module_website = [http://eirfs.osdn.jp/ Here] |<br />
download_link = [https://green-candy.osdn.jp/external/releases/fileSystem_2_0_win32.zip Win32] [https://green-candy.osdn.jp/external/releases/fileSystem_2_0_x64.zip x64] [https://green-candy.osdn.jp/external/releases/fileSystem_2_0_linux.zip Linux (AMD64)] |<br />
license = [https://green-candy.osdn.jp/external/licenses/license_mtamodule.txt here] |<br />
written_in = C++ |<br />
operating_system = Cross-platform |<br />
compatible_with = 1.X |<br />
}}<br />
FileSystem is the [[MTA:Eir]] file management implementation exported as MTA:BLUE module. It is made for those people who are not satisfied with the standard MTA file functions. Its feature-set covers '''binary stream writing''', '''directory scanning''' and '''path resolution logic'''. It should satisfy all needs regarding file functionality. The modules' source code is released [https://osdn.net/projects/green-candy/scm/svn/tree/head/blueMods/fileSystem/ within the MTA:Eir SVN].<br />
<br />
It's documentation can be found [[MTA:Eir/FileSystem|here]]. To find coding examples, ''browse the individual class methods''.<br />
<br />
==Installing FileSystem into your Server==<br />
*Place the fileSystem*.dll module into your MTA server modules directory<br />
*Add the module into the mtaserver.conf module loading list (at the bottom of the file)<br />
*'''Edit the acl.xml in a way that resources require admin rights to call''' [[Modules/FileSystem/createFilesystemInterface|createFilesystemInterface]]''<br />
<br />
==System Access Possibilities==<br />
*Accessing whole system<br />
*Listing and editing all server resources<br />
*Modifying MTA Server configuration<br />
<br />
'''Be careful how you expose the FileSystem module to your server resources!'''<br />
<br />
==OOP-style API==<br />
Since version 2.0 of this library the API has been changed to match the MTA OOP-style API. This means that object methods are now accessed solely using the '''colon operator''' instead of the '''dot operator'''. If you have old FileSystem code (pre 2.0) then you may have to adjust it.<br />
<br />
==Support==<br />
If you are looking for direct support about this module then contact [https://forum.mtasa.com/profile/9756-the_gta/ The_GTA on the MTA forums]. The official MTA forums support topic can be found [https://forum.mtasa.com/topic/133936-filesystem-module-for-mtablue/ here].<br />
<br />
*[[Modules/FileSystem/Porting_Between_Clientside_and_Serverside|Porting Clientside and Serverside code]]<br />
<br />
{{:Modules/FileSystem/functions}}<br />
<br />
[[Category:Modules]]</div>Quirethttps://wiki.multitheftauto.com/index.php?title=DbConnect&diff=75584DbConnect2022-10-14T16:13:41Z<p>Quiret: Undo revision 75583 by Derx (talk) (sorry, but you introduced a bug!)</p>
<hr />
<div>__NOTOC__<br />
{{Server function}}<br />
This function opens a connection to a database and returns an element that can be used with [[dbQuery]]. To disconnect use [[destroyElement]].<br />
{{Note|Connecting and disconnecting many times can have a performance impact on the server. For optimal performance it is recommended that you use dbConnect only once when the resource starts, and share the connection element with the whole script.}}<br />
{{Note|If you use MySQL 8 or newer, add this line to mysqld.cnf '''<nowiki>default-authentication-plugin=mysql_native_password</nowiki>'''}}<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
element dbConnect ( string databaseType, string host [, string username = "", string password = "", string options = "" ] )<br />
</syntaxhighlight><br />
{{OOP||[[Connection]]}}<br />
===Required Arguments===<br />
*'''databaseType:''' The type of database. This can be either ''sqlite'' or ''mysql''<br />
*'''host:''' The target to connect to. The format of this depends on the database type.<br />
** For SQLite it is a [[filepath]] to a SQLite database file. If the filepath starts with ":/" then the server's global databases directory is used. The file will be created if it does not exist.<br />
** For MySQL it is a list of key=value pairs separated by semicolons. Supported keys are:<br />
*** '''dbname''': Name of the database to use e.g. ''dbname=test''<br />
*** '''host''': Host address e.g. ''host=127.0.0.1''<br />
*** '''port''': Host port e.g. ''port=1234'' (optional, defaults to standard MySQL port if not used)<br />
*** '''unix_socket''': Unix socket or named pipe to use (optional)<br />
***'''charset''': Communicate with the server using a character which is different from the default e.g. ''charset<nowiki>=</nowiki>utf8'' (optional)<br />
<br />
===Optional Arguments===<br />
*'''username:''' Usually required for MySQL, ignored by SQLite <br />
*'''password:''' Usually required for MySQL, ignored by SQLite <br />
*'''options :''' List of key=value pairs separated by semicolons. Supported keys are:<br />
**'''share''' which can be set to 0 or 1. (Default value for SQLite is "share=1", for MySQL is "share=0"). 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.<br />
**'''batch''' which can be set to 0 or 1. (Default is "batch=1"). 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.<br />
**'''autoreconnect''' which can be set to 0 or 1. (Default value "autoreconnect=1"). When set to 1, dropped connections will automatically be reconnected. Note that session variables (incl. SET NAMES), 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.<br />
**'''log''' which can be set to 0 or 1. (Default value "log<nowiki>=</nowiki>1"). When set to 0, activity from this connection will not be recorded in the [[Server_Commands#debugdb|database debug log file]].<br />
**'''tag''' (Default value "tag<nowiki>=</nowiki>script"). A string which helps identify activity from this connection in the [[Server_Commands#debugdb|database debug log file]].<br />
**'''suppress''' A comma separated list of error codes to ignore. (eg. "suppress<nowiki>=</nowiki>1062,1169").<br />
**'''multi_statements''' Enable multiple statements (separated by a semi-colon) in one query. Use [[dbPrepareString]] when building a multiple statement query to reduce SQL injection risks.<br />
**'''queue''' Name of the queue to use. (Default value for SQLite is "sqlite", for MySQL default is the host string from the '''host''' argument). Asynchronous database queries in the same queue are processed in order, one at a time. Any name can be used.<br />
<br />
===Returns===<br />
Returns a database connection element unless there are problems, in which case it return ''false''.<br />
<br />
==Remarks==<br />
Under certain platforms, for example on Unix-based OSes like Linux, using this function could fail with a debug warning containing "[Could not connect]" accompanied by a prior debug error explaining the problem. In that case you should check the [[Server Manual]] to see if you have missed any recommended (best-effort) steps for server set-up.<br />
<br />
==Example==<br />
This example opens a connection to a SQLite database file in the current resource<br />
<syntaxhighlight lang="lua"><br />
test_db = dbConnect( "sqlite", "file.db" )<br />
</syntaxhighlight><br />
<br />
This example opens a connection to a SQLite database file in another resource<br />
<syntaxhighlight lang="lua"><br />
test_db = dbConnect( "sqlite", ":resname/file.db" )<br />
</syntaxhighlight><br />
<br />
This example opens a connection to a SQLite database file in the global databases directory<br />
<syntaxhighlight lang="lua"><br />
test_db = dbConnect( "sqlite", ":/file.db" )<br />
</syntaxhighlight><br />
<br />
This example opens a connection to a SQLite database file in a sub directory of the global databases directory<br />
<syntaxhighlight lang="lua"><br />
test_db = dbConnect( "sqlite", ":/example/sub/dir/file.db" )<br />
</syntaxhighlight><br />
<br />
This example opens a connection to a MySQL database called 'frank' at server ip 1.2.3.4 using utf8 character set and allows the connection to be shared. Note that changing the database or other connection dependent settings affect all connections that are shared.<br />
<syntaxhighlight lang="lua"><br />
test_db = dbConnect( "mysql", "dbname=frank;host=1.2.3.4;charset=utf8", "username", "password", "share=1" )<br />
</syntaxhighlight><br />
<br />
This example opens a connection to a SQLite database is disallows sharing of the connection<br />
<syntaxhighlight lang="lua"><br />
test_db = dbConnect( "sqlite", "file.db", "", "", "share=0" )<br />
</syntaxhighlight><br />
<br />
This example output debug message, if the connection with SQLite database was established or not<br />
<syntaxhighlight lang="lua"><br />
test_db = dbConnect( "sqlite", "file.db" )<br />
<br />
if test_db then<br />
outputDebugString( "Connection with database was successfully established." )<br />
else<br />
outputDebugString( "Connection with database couldn't be established." )<br />
end<br />
</syntaxhighlight><br />
<br />
The folowing example shows how you could approach a common resource for database operations with exported functions ('''query''' and '''execute'''):<br />
<br />
<syntaxhighlight lang="lua"><br />
function connect()<br />
DBConnection = dbConnect( "mysql", "dbname=DBNAME;host=HOST;charset=utf8", "USERNAME", "PASSWORD" )<br />
if (not DBConnection) then<br />
outputDebugString("Error: Failed to establish connection to the MySQL database server")<br />
else<br />
outputDebugString("Success: Connected to the MySQL database server")<br />
end<br />
end<br />
<br />
addEventHandler("onResourceStart",resourceRoot, connect)<br />
<br />
function query(...)<br />
local queryHandle = dbQuery(DBConnection, ...)<br />
if (not queryHandle) then<br />
return nil<br />
end<br />
local rows = dbPoll(queryHandle, -1)<br />
return rows<br />
end<br />
<br />
function execute(...)<br />
local queryHandle = dbQuery(DBConnection, ...)<br />
local result, numRows = dbPoll(queryHandle, -1)<br />
return numRows<br />
end<br />
<br />
function getDBConnection()<br />
return DBConnection<br />
end<br />
</syntaxhighlight><br />
<br />
==Requirements==<br />
{{Requirements|1.1.1-9.03328|n/a}}<br />
<br />
==Changelog==<br />
{{ChangelogHeader}}<br />
{{ChangelogItem|1.3.1-9.04817|Added options 'log', 'tag' and 'suppress'}}<br />
{{ChangelogItem|1.3.5-9.06386|Added option 'charset'}}<br />
{{ChangelogItem|1.5.2-9.07972|Added option 'multi_statements'}}<br />
{{ChangelogItem|1.5.4-9.11138|Added option 'queue'}}<br />
<br />
==See Also==<br />
{{SQL_functions}}<br />
<br />
[[ru:dbConnect]]</div>Quirethttps://wiki.multitheftauto.com/index.php?title=Where_to_buy_GTASA&diff=75195Where to buy GTASA2022-06-29T09:17:54Z<p>Quiret: added more AMZN links</p>
<hr />
<div>This page outlines some of the places Grand Theft Auto San Andreas can be bought and played with MTA:SA (sometimes with an automatic downgrade step). <br />
<br />
'''Compatibility'''<br />
<br />
Not all of the GTA versions listed below have been tested, but all should work correctly. If not, try reinstalling MTA. If that doesn't work, follow [https://forum.mtasa.com/topic/11757-patching-your-101-or-200-version-of-gta_saexe/ these instructions]. If that still doesn't work, then please contact us on [https://forum.mtasa.com/forum/83-client/ on the forums], or join the [https://mtasa.com/discord MTA Discord #help-support channel].<br />
<br />
The newly announced '''Grand Theft Auto: The Trilogy – The Definitive Edition''' will contain a new release of GTA San Andreas. This game version will not be compatible with MTA:SA (at launch).<br />
<br />
'''Obtaining compatible & used copies'''<br />
<br />
Officially, Rockstar Games and Take-Two have stopped selling the original PC port of GTA San Andreas. In order to obtain it you could look into online flea-markets or private resellers. A prominent example in the EU is [https://ebay.com ebay.com]. By typing in "gta san andreas pc" into the search field you can find plenty of people that still sell the compatible game. Be careful though as buying from untrustworthy resellers such as unknown non-business people does pose risks (for example fake or broken copies).<br />
<br />
{| class="wikitable" style="width: 900px; text-align: center; table-layout: fixed;"<br />
|-<br />
!Retailer<br />
!Notes<br />
!Works with MTA:SA?<br />
|-<br />
|[http://store.steampowered.com/app/12120/ Steam]<br />
|Specialized Steam version of the game.<br />
MTA installer will make this compatible for you (make sure to install the latest version of MTA '''after''' installing the Steam GTA version), but without modifying original game files.<br />
<br />
'''The purchase of the compatible game is unavailable through Steam.'''<br />
|{{Yes}}<br />
|-<br />
|[http://www.amazon.com/Grand-Theft-Auto-Andreas-Download/dp/B006YVXGJQ Amazon] ([https://www.amazon.de/Grand-Theft-Auto-Andreas-DVD-ROM/dp/B00076YSDM/ref=sr_1_1 alt #1], [https://www.amazon.com/-/de/dp/B001DUG0NC/ref=sr_1_14 alt #2])<br />
|For the '''Standard''' edition of the game, if MTA is incompatible, visit [https://forum.mtasa.com/topic/11757-patching-your-101-or-200-version-of-gta_saexe/ this topic] and follow the instructions, or try obtaining a GTA SA 1.00 No CD - any HOODLUM release will function correctly.<br />
|{{Partial|Unconfirmed (Standard)}}<br />
|-<br />
|[https://www.rockstarwarehouse.com/store/rsg/en_IE/pd/productID.5281755000 Rockstar Games Launcher]<br />
|You cannot buy the compatible game from the Rockstar Games Launcher (RGL) anymore.<br />
<br />
According to this [https://www.rockstargames.com/newswire/article/393o373751k48k/a-note-from-the-rockstar-games-team-re-grand-theft-auto-the-trilogy-th Rockstar Games Newswire article] you were able to buy the classic GTA SA game within the 3D GTA classic bundle. Buyers of the Definitive Edition bundle received a free RGL copy of the game if the purchase was done until the 30th of June 2022.<br />
<br />
'''The purchase of the compatible game is unavailable through the R* Games store.'''<br />
|{{Yes}}<br />
|-<br />
|[https://www.microsoft.com/en-us/p/grand-theft-auto-san-andreas/9wzdncrfj1zn Windows App Store]<br />
|This is a mobile/Xbox "remastered" version of the game ported to PC. '''Will never work with MTA.'''<br />
|{{No}}<br />
|}<br />
<br />
[[hu:Where to buy GTASA]]<br />
[[es:Dónde comprar GTA: SA]]<br />
[[pl:Where to buy GTASA]]<br />
[[ru:Where to buy GTASA]]<br />
[[uk:Where to buy GTASA]]<br />
[[tr:GTA:SA Nerden Alınır]]<br />
[[zh-cn:在那里可以购买GTASA]]<br />
[[ro:Where to buy GTASA]]</div>Quirethttps://wiki.multitheftauto.com/index.php?title=Where_to_buy_GTASA&diff=75194Where to buy GTASA2022-06-29T09:05:14Z<p>Quiret: it is time; changed the remark about purchasing compatible GTA SA through RGL</p>
<hr />
<div>This page outlines some of the places Grand Theft Auto San Andreas can be bought and played with MTA:SA (sometimes with an automatic downgrade step). <br />
<br />
'''Compatibility'''<br />
<br />
Not all of the GTA versions listed below have been tested, but all should work correctly. If not, try reinstalling MTA. If that doesn't work, follow [https://forum.mtasa.com/topic/11757-patching-your-101-or-200-version-of-gta_saexe/ these instructions]. If that still doesn't work, then please contact us on [https://forum.mtasa.com/forum/83-client/ on the forums], or join the [https://mtasa.com/discord MTA Discord #help-support channel].<br />
<br />
The newly announced '''Grand Theft Auto: The Trilogy – The Definitive Edition''' will contain a new release of GTA San Andreas. This game version will not be compatible with MTA:SA (at launch).<br />
<br />
'''Obtaining compatible & used copies'''<br />
<br />
Officially, Rockstar Games and Take-Two have stopped selling the original PC port of GTA San Andreas. In order to obtain it you could look into online flea-markets or private resellers. A prominent example in the EU is [https://ebay.com ebay.com]. By typing in "gta san andreas pc" into the search field you can find plenty of people that still sell the compatible game. Be careful though as buying from untrustworthy resellers such as unknown non-business people does pose risks (for example fake or broken copies).<br />
<br />
{| class="wikitable" style="width: 900px; text-align: center; table-layout: fixed;"<br />
|-<br />
!Retailer<br />
!Notes<br />
!Works with MTA:SA?<br />
|-<br />
|[http://store.steampowered.com/app/12120/ Steam]<br />
|Specialized Steam version of the game.<br />
MTA installer will make this compatible for you (make sure to install the latest version of MTA '''after''' installing the Steam GTA version), but without modifying original game files.<br />
<br />
'''The purchase of the compatible game is unavailable through Steam.'''<br />
|{{Yes}}<br />
|-<br />
|[http://www.amazon.com/Grand-Theft-Auto-Andreas-Download/dp/B006YVXGJQ Amazon]<br />
|For the '''Standard''' edition of the game, if MTA is incompatible, visit [https://forum.mtasa.com/topic/11757-patching-your-101-or-200-version-of-gta_saexe/ this topic] and follow the instructions, or try obtaining a GTA SA 1.00 No CD - any HOODLUM release will function correctly.<br />
|{{Partial|Unconfirmed (Standard)}}<br />
|-<br />
|[https://www.rockstarwarehouse.com/store/rsg/en_IE/pd/productID.5281755000 Rockstar Games Launcher]<br />
|You cannot buy the compatible game from the Rockstar Games Launcher (RGL) anymore.<br />
<br />
According to this [https://www.rockstargames.com/newswire/article/393o373751k48k/a-note-from-the-rockstar-games-team-re-grand-theft-auto-the-trilogy-th Rockstar Games Newswire article] you were able to buy the classic GTA SA game within the 3D GTA classic bundle. Buyers of the Definitive Edition bundle received a free RGL copy of the game if the purchase was done until the 30th of June 2022.<br />
<br />
'''The purchase of the compatible game is unavailable through the R* Games store.'''<br />
|{{Yes}}<br />
|-<br />
|[https://www.microsoft.com/en-us/p/grand-theft-auto-san-andreas/9wzdncrfj1zn Windows App Store]<br />
|This is a mobile/Xbox "remastered" version of the game ported to PC. '''Will never work with MTA.'''<br />
|{{No}}<br />
|}<br />
<br />
[[hu:Where to buy GTASA]]<br />
[[es:Dónde comprar GTA: SA]]<br />
[[pl:Where to buy GTASA]]<br />
[[ru:Where to buy GTASA]]<br />
[[uk:Where to buy GTASA]]<br />
[[tr:GTA:SA Nerden Alınır]]<br />
[[zh-cn:在那里可以购买GTASA]]<br />
[[ro:Where to buy GTASA]]</div>Quirethttps://wiki.multitheftauto.com/index.php?title=Modules/FileSystem&diff=74768Modules/FileSystem2022-06-06T16:18:22Z<p>Quiret: </p>
<hr />
<div><pageclass class="#62A033" subcaption="FileSystem module"></pageclass><br />
<br />
{{Module_Info|<br />
name = FileSystem |<br />
version = 2.0 |<br />
author = [[User:The_GTA|Martin Turski (The_GTA)]] |<br />
module_website = [http://eirfs.osdn.jp/ Here] |<br />
download_link = [https://green-candy.osdn.jp/external/releases/fileSystem_2_0_win32.zip Win32] [https://green-candy.osdn.jp/external/releases/fileSystem_2_0_linux.zip Linux (AMD64)] |<br />
license = [https://green-candy.osdn.jp/external/licenses/license_mtamodule.txt here] |<br />
written_in = C++ |<br />
operating_system = Cross-platform |<br />
compatible_with = 1.X |<br />
}}<br />
FileSystem is the [[MTA:Eir]] file management implementation exported as MTA:BLUE module. It is made for those people who are not satisfied with the standard MTA file functions. Its feature-set covers '''binary stream writing''', '''directory scanning''' and '''path resolution logic'''. It should satisfy all needs regarding file functionality. The modules' source code is released [https://osdn.net/projects/green-candy/scm/svn/tree/head/blueMods/fileSystem/ within the MTA:Eir SVN].<br />
<br />
It's documentation can be found [[MTA:Eir/FileSystem|here]]. To find coding examples, ''browse the individual class methods''.<br />
<br />
==Installing FileSystem into your Server==<br />
*Place the fileSystem*.dll module into your MTA server modules directory<br />
*Add the module into the mtaserver.conf module loading list (at the bottom of the file)<br />
*'''Edit the acl.xml in a way that resources require admin rights to call''' [[Modules/FileSystem/createFilesystemInterface|createFilesystemInterface]]''<br />
<br />
==System Access Possibilities==<br />
*Accessing whole system<br />
*Listing and editing all server resources<br />
*Modifying MTA Server configuration<br />
<br />
'''Be careful how you expose the FileSystem module to your server resources!'''<br />
<br />
==OOP-style API==<br />
Since version 2.0 of this library the API has been changed to match the MTA OOP-style API. This means that object methods are now accessed solely using the '''colon operator''' instead of the '''dot operator'''. If you have old FileSystem code (pre 2.0) then you may have to adjust it.<br />
<br />
==Support==<br />
If you are looking for direct support about this module then contact [https://forum.mtasa.com/profile/9756-the_gta/ The_GTA on the MTA forums]. The official MTA forums support topic can be found [https://forum.mtasa.com/topic/133936-filesystem-module-for-mtablue/ here].<br />
<br />
*[[Modules/FileSystem/Porting_Between_Clientside_and_Serverside|Porting Clientside and Serverside code]]<br />
<br />
{{:Modules/FileSystem/functions}}<br />
<br />
[[Category:Modules]]</div>Quirethttps://wiki.multitheftauto.com/index.php?title=Modules&diff=74766Modules2022-06-06T16:14:00Z<p>Quiret: added hint about using Lua on Linux</p>
<hr />
<div>Modules are extensions for Multi Theft Auto's Lua core, allowing the integration and use of custom Lua functions that have been written in C++, and compiled as a DLL or SO file. Modules are commonly used to create functions for such purposes that Multi Theft Auto lacks, such as sockets. All modules listed here are not distributed with Multi Theft Auto, and must be manually installed.<br />
<br />
==Modules list==<br />
<!-- You can view a list of all the documented modules in this wiki [[:Category:Modules|here]]. --><br />
You can view a list of all the documented modules here:<br />
{{ModulesList}}<br />
<br />
==Modules SDK==<br />
To be able to create your own modules, you must use the Modules SDK. You can download it from one of the links below - choose a link in accordance with your server's operating system.<br />
<br />
* Linux<br />
** [http://files.mtasa.com/apps/1.0/dm/ml_devkit.tar.gz Official]<br />
*** (Delete the .d files, and add #include <cstring> to Common.h)<br />
**** (On 64bit add -m32 to CPPFLAGS and LDFLAGS lines in Makefile)<br />
* Microsoft Windows<br />
** [http://www.mediafire.com/?b8b3asgegn0xkm4 Mirror (Mediafire)]<br />
** [https://mega.co.nz/#!nBNGUCgQ!3AHEJt684Heu9bN5de8xwAQ3h-qq5-V6fjUeU7rj5hI Mirror (MEGA)]<br />
<br />
===SDK Functions===<br />
*Currently in there:<br />
**Base:<br />
***HelloWorld<br />
**MySQL<br />
***MySQLCreate<br />
***MySQLOpen<br />
***MySQLDestroy<br />
***MySQLQuery<br />
***MySQLSafeString<br />
<br />
===Using Lua inside of Linux Modules===<br />
If you want to make use of Lua functions as exported by the MTA Server you have to link against the official deathmatch.so file. Then the export resolution during dlopen of your module will respect the symbol table of deathmatch.so which contains all of the Lua exports. '''Do NOT link against a static version of a freshly-compiled Lua library because that will create code conflicts and potentially crashes in the long run.'''<br />
<br />
<br />
<br />
[[Category:Scripting Concepts]]<br />
[[Category:Incomplete]]<br />
[[Category:Modules]]<br />
<br />
[[hu:Modules]]<br />
[[pl:Modules]]<br />
[[pt-br:Módulos]]<br />
[[ru:Modules]]<br />
[[ro:Module]]</div>Quirethttps://wiki.multitheftauto.com/index.php?title=Modules/FileSystem&diff=74760Modules/FileSystem2022-06-06T15:49:26Z<p>Quiret: added Linux version as download link</p>
<hr />
<div><pageclass class="#62A033" subcaption="FileSystem module"></pageclass><br />
<br />
{{Module_Info|<br />
name = FileSystem |<br />
version = 2.0 |<br />
author = [[User:The_GTA|Martin Turski (The_GTA)]] |<br />
module_website = [http://eirfs.osdn.jp/ Here] |<br />
download_link = [https://green-candy.osdn.jp/external/releases/fileSystem_2_0_win32.zip Win32] [https://green-candy.osdn.jp/external/releases/fileSystem_2_0_linux.zip Linux] |<br />
license = [https://green-candy.osdn.jp/external/licenses/license_mtamodule.txt here] |<br />
written_in = C++ |<br />
operating_system = Cross-platform |<br />
compatible_with = 1.X |<br />
}}<br />
FileSystem is the [[MTA:Eir]] file management implementation exported as MTA:BLUE module. It is made for those people who are not satisfied with the standard MTA file functions. Its feature-set covers '''binary stream writing''', '''directory scanning''' and '''path resolution logic'''. It should satisfy all needs regarding file functionality. The modules' source code is released [https://osdn.net/projects/green-candy/scm/svn/tree/head/blueMods/fileSystem/ within the MTA:Eir SVN].<br />
<br />
It's documentation can be found [[MTA:Eir/FileSystem|here]]. To find coding examples, ''browse the individual class methods''.<br />
<br />
==Installing FileSystem into your Server==<br />
*Place the fileSystem*.dll module into your MTA server modules directory<br />
*Add the module into the mtaserver.conf module loading list (at the bottom of the file)<br />
*'''Edit the acl.xml in a way that resources require admin rights to call''' [[Modules/FileSystem/createFilesystemInterface|createFilesystemInterface]]''<br />
<br />
==System Access Possibilities==<br />
*Accessing whole system<br />
*Listing and editing all server resources<br />
*Modifying MTA Server configuration<br />
<br />
'''Be careful how you expose the FileSystem module to your server resources!'''<br />
<br />
==OOP-style API==<br />
Since version 2.0 of this library the API has been changed to match the MTA OOP-style API. This means that object methods are now accessed solely using the '''colon operator''' instead of the '''dot operator'''. If you have old FileSystem code (pre 2.0) then you may have to adjust it.<br />
<br />
==Support==<br />
If you are looking for direct support about this module then contact [https://forum.mtasa.com/profile/9756-the_gta/ The_GTA on the MTA forums]. The official MTA forums support topic can be found [https://forum.mtasa.com/topic/133936-filesystem-module-for-mtablue/ here].<br />
<br />
*[[Modules/FileSystem/Porting_Between_Clientside_and_Serverside|Porting Clientside and Serverside code]]<br />
<br />
{{:Modules/FileSystem/functions}}<br />
<br />
[[Category:Modules]]</div>Quirethttps://wiki.multitheftauto.com/index.php?title=DebugSleep&diff=73856DebugSleep2022-01-27T14:35:04Z<p>Quiret: fixed the example, having to use a number as first argument to debugSleep</p>
<hr />
<div>__NOTOC__<br />
{{Server client function}}<br />
[[debugSleep]] freezes the client/server for the specified time. This means that all synchronization, rendering and script execution will stop except HTTP processing invoked by [[fetchRemote]]. This function only works, if development mode is enabled by [[setDevelopmentMode]] and can be utilised to build a debugger that communicates via HTTP requests with the editor/IDE.<br />
<br />
{{Warning|Only use this function if you know what you are doing!|true}}<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
bool debugSleep ( int sleep )<br />
</syntaxhighlight><br />
<br />
===Required Arguments===<br />
*'''sleep ''': An integer value in milliseconds.<br />
<br />
===Returns===<br />
Returns ''true'' if the development mode is enabled and arguments are correct, ''false'' otherwise.<br />
<br />
==Requirements==<br />
{{Requirements|1.5.4-9.11306|1.5.4-9.11306|}}<br />
<br />
==Example== <br />
'''Example 1:''' This example would add the command to set the client's freeze time.<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua" side="client"><br />
addCommandHandler ( "zzz",<br />
function ( command, sleep )<br />
if ( sleep ) then<br />
local ms = tonumber ( sleep )<br />
if ( ms ) then<br />
debugSleep ( ms )<br />
end<br />
end<br />
end<br />
)<br />
</syntaxhighlight><br />
</section><br />
<br />
==See Also==<br />
{{Client_utility_functions}}</div>Quirethttps://wiki.multitheftauto.com/index.php?title=Obs%C5%82uga_Klienta&diff=73855Obsługa Klienta2022-01-26T23:44:44Z<p>Quiret: /* Klawisze w grze */</p>
<hr />
<div>==Zanim zaczniesz==<br />
<br />
Zanim zainstalujesz Multi Theft Auto: San Andreas upewnij się, że nie masz zainstalowanych modów do GTA:SA. Mody będą kolidować z MTA:SA. Jeżeli mimo wszystko chcesz zachować mody z singleplayer'a, możesz zainstalować GTA:SA po raz drugi w innej lokalizacji na dysku twardym.<br />
<br />
Dodatkowo upewnij się, że masz system '''Windows XP''', '''Windows Vista''' (32-bitowe lub 64-bitowe), '''Windows 7''' (32-bitowe lub 64-bitowe) lub '''Windows 8''' (32-bitowe lub 64-bitowe) oraz, że gra GTA:SA będzie działać na twoim sprzęcie. Weź pod uwagę to, że jeżeli grałeś w singleplayer'a na najniższych ustawieniach, to MTA będzie Ci działało wolniej, ponieważ ma większe wymagania.<br />
<br />
{{PL/Note| <br />
* MTA:SA działa tylko z GTA:SA '''v1.0'''. Jeśli kupiłeś grę niedawno, jest prawdopodobieństwo, że masz nowszą wersje.''' [[PL/Known_Issues_-_FAQ#Czy_MTA:SA_pracuje_z_wersj.C4.85_1.01_lub_2.00_GTA_San_Andreas.3F| (Więcej informacji)]]<br />
* Jeżeli masz wersję Steam GTA: San Andreas powinieneś [[PL/Known_Issues_-_FAQ#Mam_wersj.C4.99_steam_GTA_San_Andreas._Czy_mog.C4.99_gra.C4.87_w_MTA:SA.3F|najpierw to przeczytać]].<br />
}}<br />
<br />
===Wymagania Sprzętowe===<br />
====Minimalne wymagania sprzętowe====<br />
Minimalne wymagania sprzętowe dla Multi Theft Auto: San Andreas są '''nieco większe''', niż najmniejsze wymagania dla Grand Theft Auto: San Andreas.<br />
* Procesor Intel Pentium 4 lub AMD Athlon XP<br />
* 512MB DDR RAM<br />
* Czysta instalacja gry Grand Theft Auto: San Andreas, wersja 1.0 (Amerykańska lub Europejska)<br />
* 3.7GB wolnej przestrzeni na dysku twardym (3.6GB dla instalacji minimalnej Grand Theft Auto)(Pamiętaj, że MTA:SA pobiera pliki z serwerów, które wymagają miejsca na dysku.<br />
* nVidia GeForce seria 4 lub ATI Radeon seria 8xxx (64MB RAM i kompatybilność z DirectX 9.0)<br />
* Karta dźwiękowa kompatybilna z DirectX 9.0<br />
* Klawiatura i mysz<br />
* Połączenie do internetu<br />
====Zalecane wymagania sprzętowe====<br />
* Procesor Intel Core 2 Duo lub odpowiednik AMD<br />
* 1GB DDR RAM<br />
* Czysta instalacja gry Grand Theft Auto: San Andreas, wersja 1.0 (Amerykańska lub Europejska)<br />
* >5GB wolnego miejsca na dysku twardym<br />
* nVidia GeForce z serii FX lub nowsza, ATI Radeon z serii 9xxx lub nowsza.(Kompatybilność z Pixel Shader 2.0)<br />
* Karta dźwiękowa zgodna z DirectX 9.0<br />
* Klawiatura i mysz<br />
* Połączenie do internetu<br />
====Uwagi====<br />
* Minimalne wymagania sprzętowe są uważane za niezbędne minimum dla MTA: San Andreas, wydajność może zależeć od trybów gry oraz liczby graczy.<br />
* Na dodatkową wydajność ładowania, zaleca się więcej pamięci RAM.<br />
* Upewnij się, że system Windows jest w pełni aktualny.<br />
* Zanim zgłosisz problem sprawdź czy nie ma go tutaj: [[PL/Known_Issues_-_FAQ|Znane problemy - FAQ]]. Jeżeli nie znalazłeś problemu w FAQ dołącz do nas na [https://discord.com/invite/mtasa Discord]<br />
<br />
==Instalacja gry==<br />
<br />
# Jeżeli jeszcze nie masz klienta MTA:SA, pobierz go ze strony [http://mtasa.com mtasa.com].<br />
# Uruchom instalator. Na Windows Vista i 7 będzie wymagane uruchomienie na prawach administratorskich.<br />
# Wybierz język gry.<br />
# Ty musisz zaakceptować licencje MTA:SA<br />
# Ty będziesz zapytany o elementy instalacji:<br />
#* '''Klient i serwer''' główny interface gry, który jest potrzebny do działania multiplayera.<br />
#* '''Tylko serwer''' pozwala na stawianie własnego serwera.<br />
#* '''Użytkownika''' użytkownik sam wybiera sobie elementy instalacji.<br />
# Później zostaniesz zapytany o lokalizację, w której chcesz zainstalować MTA:SA. Możesz zainstalować gdziekolwiek chcesz i nie musi to być w folderze głównym gry GTA:SA.<br />
# Następnie zostaniesz poproszony o wskazanie lokalizacji zainstalowanej gry GTA:SA. Standardowo jest to: '''C:\Program Files\Rockstar Games\GTA San Andreas\'''.<br />
# Po zakończeniu instalacji wyświetli Ci się opcja do uruchomienia MTA: San Andreas. Zaznacz ją lub odznacz i kliknij '''Finish'''.<br />
# Od tej pory będziesz mógł uruchamiać multiplayer MTA:DM z menu Start jak też ze skrótu na Pulpicie.<br />
<br />
==Uruchomienie gry==<br />
# Uruchom Multi Theft Auto klikając na ikonkę multiplayera podpisaną '''MTA:San Andreas''' w Menu Start.<br />
# GTA: San Andreas się uruchomi i po załadowaniu się niezbędnych elementów ujrzysz główne menu MTA:SA. Tutaj znajdziesz kilka opcji:<br />
<br />
{| border="0" align="center"<br />
| width="188" |<br />
[[Image:MENU_QuickConnect.jpg]]<br />
| width="380" |<br />
<font size="-1" face="tahoma,helvetica,arial,sans-serif">'''Quick connect''' – Przy pomocy tej opcji możesz połączyć się z serwerem gry, którego adres IP lub URL oraz Port znasz. opcja jest bardzo przydatna, jeżeli znasz adres i port serwera i nie chce Ci się szukać go pośród innych serwerów w wyszukiwarce.</font><br />
<br />
<br /><br />
|-<br />
| width="188" |<br />
[[Image:Server_Browser.jpg|280px]]<br />
| width="380" |<br />
<font size="-1" face="tahoma,helvetica,arial,sans-serif">'''Browse servers''' – Dzięki tej opcji masz dostęp do listy wszystkich działających serwerów. </font><br />
<br />
<br /><br />
|-<br />
| width="188" |<br />
[[Image:Host_Game.jpg|280px]]<br />
| width="380" |<br />
<font size="-1" face="tahoma,helvetica,arial,sans-serif">'''Host game''' – Dzięki tej opcji możesz założyć własny serwer. </font><br />
<br />
<br /><br />
|-<br />
| width="188" |<br />
[[Image:Menu_Settings.JPG|280px]]<br />
| width="380" |<br />
<font size="-1" face="tahoma,helvetica,arial,sans-serif">'''Settings '''– Tutaj możesz zmienić m.in: swój nick używany w grze, klawisze, opcje grafiki i kilka innych rzeczy.</font><br />
<br />
<br /><br /><br />
|-<br />
| width="188" |<br />
[[Image:About_Menu.jpg|280px]]<br />
| width="380" |<br />
<font size="-1" face="tahoma,helvetica,arial,sans-serif">'''About '''– Tutaj są wymienieni wszyscy, którzy mieli wkład w rozwój projektu.</font><br />
<br />
<br /><br />
|-<br />
| width="188" |<br />
[[Image:Map_Editor.jpg|280px]]<br />
| width="380" |<br />
<font size="-1" face="tahoma,helvetica,arial,sans-serif">'''Map editor '''– Tutaj możesz tworzyć własne mapy, wstawiać checkpointy, rampy, pickupy i inne obiekty. później możesz to dodać do plików serwera i grać z innymi graczami na świeżo zrobionych mapach.</font><br />
<br />
<br /><br /><br />
|-<br />
| width="188" |<br />
<br><br />
| width="380" |<br />
<font size="-1" face="tahoma,helvetica,arial,sans-serif">'''Quit '''– Wybranie tej opcji spowoduje zamknięcie MTA i powrót do pulpitu.</font><br />
<br />
<br /><br /><br />
|}<br />
<br />
Najprostszym sposobem by grać, jest wybranie opcji '''Browse Servers''' z menu. Jeżeli serwery się nie wyświetlają kliknij przycisk '''Refresh''', a MTA zacznie szukać serwerów, a następnie je wyświetli w formie listy.<br />
<br />
* W kolumnie '''Name''' są wyświetlane nazwy serwerów.<br />
* W kolumnie '''Players''' wyświetla się liczba graczy grających i maksymalna mogąca wejść na serwer w formacie [Liczba slotów zajętych] / [Liczba maksymalna slotów].<br />
* W kolumnie '''Ping''' jest wyświetlany Ping (opóźnienie) miedzy Twoją maszyną, a maszyną serwera. Ping to miara czasu, w jakim "pakiety" danych są przesyłane od Ciebie na serwer i spowrotem, czyli większy ping oznacza dłuższy czas wędrówki pakietów, a tym samym lag. Generalnie serwery usytuowane bliżej Ciebie mają mniejsze pingi.<br />
* W kolumnie '''Host''' jest podany adres IP serwerów. możesz używać tego adresu by później łączyć się z danym serwerem przy pomocy opcji '''Quick connect''' z głównego menu.<br />
<br />
Listę serwerów możesz segregować wg każdej z kolumn rosnąco i malejąco.<br />
<br />
Do optymalnej rozgrywki szukaj najlepszego balansu między ilością graczy online, a pingiem danego serwera.<br />
<br />
Jeżeli już wybierzesz interesujący Cię serwer, zaznacz go i kliknij przycisk '''Connect''' usytuowany w górnym prawym rogu okienka. Jeżeli wszystko jest dobrze to powinno Cię połączyć z serwerem i dołączyć do rozgrywki.<br />
<br />
==Jak grać==<br />
<br />
Edytor map MTA pozwala na dodawanie nowych obiektów do gry takich jak drogi, eksplodujące beczki, rampy, budynki, nowe tereny (i wiele, wiele więcej). Obiekty te mogą się poruszać, pojawiać i znikać, zmieniać wygląd. Dzięki temu każdy serwer może zaskoczyć nas swoją oryginalnością, nowymi efektami, naprawdę przyjemną i ciekawą rozgrywką.<br />
<br />
Przytrzymując '''tab''' wyświetlona zostaje tablica wyników. Domyślnie znajdują się na niej informacje takie jak nazwa gracza, jego ping, ilość zabójstw, jednak są skrypty, które pozwalają na dodanie (lub modyfikowanie istniejących) danych tam wyświetlanych. Na przykład na serwerze typu DM wyświetlana będzie ilość zabójstw. Na serwerze typu RPG ilość posiadanych pieniędzy.<br />
<br />
==Sterowanie==<br />
<br />
===Klawisze w grze===<br />
<br />
* F8 (lub przycisk tylda) - Konsola<br />
* F9 - Pomoc (jeżeli [[Helpmanager]] jest uruchomiony na serwerze)<br />
* F11 - Pokazuje mapę SA ''(Poniższa lista jest do użytku, gdy mapa jest do góry)''<br />
**numpad /- - Powiększanie i pomniejszanie<br />
**numpad 4, 8, 6, 2 - ruszanie mapa w lewo, gorę, prawo, dół <br />
**numpad 0 - przełączać się między dołączyć do lokalnych graczy (z mapą blip player) i swobodny ruch (map pozostaje nieruchomy)<br />
* F12 - Robienie screenshotów<br />
* T - Rozmowa<br />
* Y - Rozmowa w zespole<br />
* TAB - Lista graczy (jeśli [[Scoreboard]] jest uruchomiony na serwerze)<br />
<br />
===Klawisze określone przez zasoby===<br />
Klawisze te zależą od skryptów, które są uruchomione na serwerze.<br />
* F9 - Pomoc (jeżeli [[Helpmanager]] jest uruchomiony na serwerze)<br />
* V - Komunikacja głosowa. Naciśnij i mów jeśli skrypt jest włączony na serwerze.<br />
* TAB - Lista graczy (jeśli [[Scoreboard]] jest uruchomiony na serwerze)<br />
<br />
==Komendy konsoli==<br />
Defaults bind''' Wiąże domyślne ustawienia sterowania w menu<br />
<br />
''Naciśnij "~ (tylda)'''lub'''''F8", aby uzyskać dostęp do konsoli, a następnie wpisz polecenie po wszelkie niezbędne parametry (jeśli dotyczy), a następnie naciśnij klawisz Enter.<br />
<br />
;'''Mapy''': To wyświetla listę wszystkich map dostępnych na serwerze.<br />
<br />
;'''Nick [''] nick ": zmienia swój nick, podczas gdy w grze do tego, co należy określić w parametrach.<br />
<br />
;'''Msg [nick] [wiadomość''] "lub''' [pseudonim pm] [komunikat'']": Ten wysyła prywatną wiadomość do osoby, którą określa się w [parametr] nick. Tylko osoby, z którą określić można zobaczyć tą wiadomość. Zarówno'''msg''' i'''''pm "tę samą funkcję.<br />
<br />
;'''Quit''' lub'''''wyjścia ": Ten rozłącza się z serwera i powrót do pulpitu Windows. Wykonuje tę samą funkcję jak przycisk Zamknij w menu głównym.<br />
<br />
;'''''Ver ": Wyświetla numer wersji i prawach autorskich do oprogramowania.<br />
<br />
;'''''Sver ": Wyświetla numer wersji serwera jesteś podłączony.<br />
<br />
;'''time''', to wyświetla aktualny czas.<br />
<br />
;'''discconet''', to rozłącza się z serwera i powrót do głównego menu.<br />
<br />
;'''Say [tekst]''': Funkcja ta pozwala na kontynuowanie rozmów z ludźmi na czacie przy oknie konsoli jest otwarta.<br />
<br />
;'''Ignore [nick]''': To nie będzie wyświetlać dowolny tekst wpisany przez gracza, który chcesz ignorować. Aby zatrzymać ignorowanie gracza, typ'''ignore [nick]''' ponownie.<br />
<br />
'''Wskazówka:''' Możesz używać tych poleceń w chat przez umieszczenie / (ukośnik) przed nimi.<br />
<br />
Lista komend konsoli można zobaczyć wpisując'''''help' w konsoli i naciskając Enter. Aktualną mapę może mieć również dodatkowe komendy, które będą dostępne po wpisaniu'''polecenia''' w konsoli.<br />
<br />
==Kody błędów i ich znaczenie==<br />
=== Błędy pobierania ===<br />
:{| class="wikitable sortable" style="width: auto; table-layout: fixed;"<br />
|-<br />
!Code<br />
!scope="col" class="unsortable" | Meaning<br />
|-<br />
|0<br />
|UNKNOWN_ERROR<br />
|-<br />
|1<br />
|INVALID_FILE_DESCRIPTORS<br />
|-<br />
|2<br />
|INVALID_MAX_FILE_DESCRIPTOR<br />
|-<br />
|3<br />
|INVALID_SELECT_RETURN<br />
|-<br />
|4<br />
|INVALID_INITIAL_MULTI_PERFORM<br />
|-<br />
|5<br />
|INVALID_MULTI_PERFORM_CODE<br />
|-<br />
|6<br />
|INVALID_MULTI_PERFORM_CODE_NEW_DOWNLOADS<br />
|-<br />
|7<br />
|UNEXPECTED_CURL_MESSAGE<br />
|-<br />
|8<br />
|UNABLE_TO_CONNECT<br />
|-<br />
|9<br />
|UNABLE_TO_DOWNLOAD_FILE<br />
|-<br />
|10<br />
|FAILED_TO_INITIALIZE_DOWNLOAD<br />
|}<br />
===Błędy krytyczne===<br />
:{| class="wikitable sortable" style="width: auto; table-layout: fixed;"<br />
|-<br />
!Code<br />
!scope="col" class="unsortable" | Meaning<br />
|-<br />
|1<br />
|no local player model on ingame event<br />
|-<br />
|2<br />
|no local player on ingame event<br />
|-<br />
|3<br />
|server downloads disabled<br />
|-<br />
|4<br />
|no local player model on player-list packet<br />
|-<br />
|5<br />
|no local player on player-list packet<br />
|-<br />
|6<br />
|invalid custom data length on entity-add packet<br />
|-<br />
|7<br />
|invalid bitstream data on entity-add packet<br />
|-<br />
|8<br />
|system entity on entity-add packet<br />
|-<br />
|9<br />
|failed to create object on entity-add packet<br />
|-<br />
|10<br />
|failed to create pickup on entity-add packet<br />
|-<br />
|11<br />
|failed to create vehicle on entity-add packet<br />
|-<br />
|12<br />
|invalid team-name length on entity-add packet<br />
|-<br />
|13<br />
|invalid lua-event name length in lua-event packet<br />
|-<br />
|14<br />
|invalid resource name length in resource-start packet<br />
|}<br />
<br />
===Błędy 'Nie można wejść do pojazdu'===<br />
:{| class="wikitable sortable" style="width: auto; table-layout: fixed;"<br />
|-<br />
!Code<br />
!scope="col" class="unsortable" | Meaning<br />
|-<br />
|1<br />
|script cancelled<br />
|-<br />
|2<br />
|script cancelled (jack)<br />
|-<br />
|3<br />
|current occupier is entering/exiting<br />
|-<br />
|4<br />
|invalid seat<br />
|-<br />
|5<br />
|not close enough<br />
|-<br />
|6<br />
|already in a vehicle<br />
|-<br />
|7<br />
|already entering/exiting<br />
|-<br />
|8<br />
|invalid vehicle (trailer)<br />
|}<br />
<br />
[[en:Client Manual]]</div>Quirethttps://wiki.multitheftauto.com/index.php?title=Modules/FileSystem&diff=73848Modules/FileSystem2022-01-24T12:16:22Z<p>Quiret: added license document</p>
<hr />
<div><pageclass class="#62A033" subcaption="FileSystem module"></pageclass><br />
<br />
{{Module_Info|<br />
name = FileSystem |<br />
version = 2.0 |<br />
author = [[User:The_GTA|Martin Turski (The_GTA)]] |<br />
module_website = [http://eirfs.osdn.jp/ Here] |<br />
download_link = [https://green-candy.osdn.jp/external/releases/fileSystem_2_0_win32.zip Win32] Linux |<br />
license = [https://green-candy.osdn.jp/external/licenses/license_mtamodule.txt here] |<br />
written_in = C++ |<br />
operating_system = Cross-platform |<br />
compatible_with = 1.X |<br />
}}<br />
FileSystem is the [[MTA:Eir]] file management implementation exported as MTA:BLUE module. It is made for those people who are not satisfied with the standard MTA file functions. Its feature-set covers '''binary stream writing''', '''directory scanning''' and '''path resolution logic'''. It should satisfy all needs regarding file functionality. The modules' source code is released [https://osdn.net/projects/green-candy/scm/svn/tree/head/blueMods/fileSystem/ within the MTA:Eir SVN].<br />
<br />
It's documentation can be found [[MTA:Eir/FileSystem|here]]. To find coding examples, ''browse the individual class methods''.<br />
<br />
==Installing FileSystem into your Server==<br />
*Place the fileSystem*.dll module into your MTA server modules directory<br />
*Add the module into the mtaserver.conf module loading list (at the bottom of the file)<br />
*'''Edit the acl.xml in a way that resources require admin rights to call''' [[Modules/FileSystem/createFilesystemInterface|createFilesystemInterface]]''<br />
<br />
==System Access Possibilities==<br />
*Accessing whole system<br />
*Listing and editing all server resources<br />
*Modifying MTA Server configuration<br />
<br />
'''Be careful how you expose the FileSystem module to your server resources!'''<br />
<br />
==OOP-style API==<br />
Since version 2.0 of this library the API has been changed to match the MTA OOP-style API. This means that object methods are now accessed solely using the '''colon operator''' instead of the '''dot operator'''. If you have old FileSystem code (pre 2.0) then you may have to adjust it.<br />
<br />
==Support==<br />
If you are looking for direct support about this module then contact [https://forum.mtasa.com/profile/9756-the_gta/ The_GTA on the MTA forums]. The official MTA forums support topic can be found [https://forum.mtasa.com/topic/133936-filesystem-module-for-mtablue/ here].<br />
<br />
*[[Modules/FileSystem/Porting_Between_Clientside_and_Serverside|Porting Clientside and Serverside code]]<br />
<br />
{{:Modules/FileSystem/functions}}<br />
<br />
[[Category:Modules]]</div>Quirethttps://wiki.multitheftauto.com/index.php?title=Modules/FileSystem/file/tell&diff=73720Modules/FileSystem/file/tell2022-01-20T22:51:08Z<p>Quiret: /* Example */</p>
<hr />
<div>__NOTOC__<br />
This function returns the current absolute position inside of the file/stream object. It should be the number of bytes that the current stream pointer is set from the beginning of the object. Not all stream classes have to support this operation.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
int file:tell ()<br />
</syntaxhighlight><br />
<br />
==Returns==<br />
Returns the amount of bytes that this file/stream object has already traversed. If the operation is not supported by the underlying stream class, it returns '''false'''.<br />
<br />
==Example==<br />
<section name="Server" class="server" show="true"><br />
This snippet seeks back to the beginning of the file by going back the current stream pointer byte offset.<br />
<syntaxhighlight lang="lua"><br />
local function alternativeFileReset( theFile )<br />
-- Get the current stream position.<br />
local streamOffset = theFile:tell();<br />
<br />
-- Check whether this operation is supported.<br />
if not ( streamOffset ) then<br />
return false, "not supported";<br />
end<br />
<br />
-- Reset the file to its beginning.<br />
theFile:seek( -streamOffset, "cur" );<br />
return true;<br />
end<br />
</syntaxhighlight><br />
</section><br />
{{:Modules/FileSystem/file/functions}}</div>Quirethttps://wiki.multitheftauto.com/index.php?title=Modules/FileSystem/file/tell&diff=73719Modules/FileSystem/file/tell2022-01-20T22:50:51Z<p>Quiret: /* Example */</p>
<hr />
<div>__NOTOC__<br />
This function returns the current absolute position inside of the file/stream object. It should be the number of bytes that the current stream pointer is set from the beginning of the object. Not all stream classes have to support this operation.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
int file:tell ()<br />
</syntaxhighlight><br />
<br />
==Returns==<br />
Returns the amount of bytes that this file/stream object has already traversed. If the operation is not supported by the underlying stream class, it returns '''false'''.<br />
<br />
==Example==<br />
<section name="Server" class="client" show="true"><br />
This snippet seeks back to the beginning of the file by going back the current stream pointer byte offset.<br />
<syntaxhighlight lang="lua"><br />
local function alternativeFileReset( theFile )<br />
-- Get the current stream position.<br />
local streamOffset = theFile:tell();<br />
<br />
-- Check whether this operation is supported.<br />
if not ( streamOffset ) then<br />
return false, "not supported";<br />
end<br />
<br />
-- Reset the file to its beginning.<br />
theFile:seek( -streamOffset, "cur" );<br />
return true;<br />
end<br />
</syntaxhighlight><br />
</section><br />
{{:Modules/FileSystem/file/functions}}</div>Quirethttps://wiki.multitheftauto.com/index.php?title=Modules/FileSystem/copyFile&diff=73718Modules/FileSystem/copyFile2022-01-20T22:48:28Z<p>Quiret: </p>
<hr />
<div>__NOTOC__<br />
This function copies files between two translators.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
bool fsnamespace.copyFile( translator srcTrans, string srcPath, translator dstTrans, string dstPath )<br />
</syntaxhighlight><br />
<br />
==Arguments==<br />
*'''srcTrans:''' source translator for the file of origin<br />
*'''srcPath:''' path into the source translator<br />
*'''dstTrans:''' target translator<br />
*'''dstPath:''' path into the target translator<br />
<br />
==Returns==<br />
This function returns true if the copy has succeeded, false otherwise.<br />
<br />
==Example==<br />
<syntaxhighlight lang="lua"><br />
-- TODO<br />
</syntaxhighlight><br />
{{:Modules/FileSystem/namespace/functions}}<br />
<br />
{{:Modules/FileSystem/translator/functions}}</div>Quirethttps://wiki.multitheftauto.com/index.php?title=Modules/FileSystem/pathToFilename&diff=73717Modules/FileSystem/pathToFilename2022-01-20T22:47:34Z<p>Quiret: </p>
<hr />
<div>__NOTOC__<br />
This function returns the filename and the directory portions of a filepath, separated into two strings.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
string, string fsnamespace.pathToFilename( string path, bool includeExtention )<br />
</syntaxhighlight><br />
<br />
==Arguments==<br />
*'''path''': the file path to extract from<br />
*'''includeExtention''': if true then the filename extention is included in the result<br />
<br />
==Returns==<br />
This function returns the filename and directory of the provided file path.<br />
<br />
==Example==<br />
<syntaxhighlight lang="lua"><br />
-- TODO<br />
</syntaxhighlight><br />
{{:Modules/FileSystem/namespace/functions}}</div>Quirethttps://wiki.multitheftauto.com/index.php?title=Modules/FileSystem/pathToFilename&diff=73713Modules/FileSystem/pathToFilename2022-01-20T15:42:34Z<p>Quiret: </p>
<hr />
<div>__NOTOC__<br />
This function returns the filename and the directory portions of a filepath, separated into two strings.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
string, string fsnamespace.pathToFilename( string path, bool includeExtention )<br />
</syntaxhighlight><br />
<br />
==Arguments==<br />
*'''path''': the file path to extract from<br />
*'''includeExtention''': if true then the filename extention is included in the result<br />
<br />
==Returns==<br />
This function returns the filename and directory of the provided file path.<br />
<br />
==Example==<br />
<syntaxhighlight lang="lua"><br />
-- TODO<br />
</syntaxhighlight><br />
{{:Modules/FileSystem/namespace/functions}}<br />
<br />
{{:Modules/FileSystem/file/functions}}</div>Quirethttps://wiki.multitheftauto.com/index.php?title=Modules/FileSystem/createFileIterative&diff=73712Modules/FileSystem/createFileIterative2022-01-20T15:39:31Z<p>Quiret: /* Arguments */</p>
<hr />
<div>__NOTOC__<br />
This function attempts to create a file with numeric iteration for filename collision avoidance. If a specific filename is taken then the algorithm will try to create the next file with increased numeric insert.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
file fsnamespace.createFileIterative( translator target, string prefix, string suffix, int maxIterations )<br />
</syntaxhighlight><br />
<br />
==Arguments==<br />
*'''target''': the file translator based on which to create the file<br />
*'''prefix''': part of file path before the numeric insert<br />
*'''suffix''': part of file path after the numeric insert (for example the file extention)<br />
*'''maxIterations''': integral number of tries for the existing filename collisions (greater than 0)<br />
<br />
==Returns==<br />
This function returns a newly created file handle distinct from any other colliding one if successful, false otherwise.<br />
<br />
==Example==<br />
<syntaxhighlight lang="lua"><br />
-- TODO<br />
</syntaxhighlight><br />
{{:Modules/FileSystem/namespace/functions}}<br />
<br />
{{:Modules/FileSystem/file/functions}}<br />
<br />
{{:Modules/FileSystem/translator/functions}}</div>Quirethttps://wiki.multitheftauto.com/index.php?title=Modules/FileSystem/createFileIterative&diff=73711Modules/FileSystem/createFileIterative2022-01-20T15:38:16Z<p>Quiret: </p>
<hr />
<div>__NOTOC__<br />
This function attempts to create a file with numeric iteration for filename collision avoidance. If a specific filename is taken then the algorithm will try to create the next file with increased numeric insert.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
file fsnamespace.createFileIterative( translator target, string prefix, string suffix, int maxIterations )<br />
</syntaxhighlight><br />
<br />
==Arguments==<br />
*'''target''': the file translator based on which to create the file<br />
*'''prefix''': part of file path before the numeric insert<br />
*'''suffix''': part of file path after the numeric insert (for example the file extention)<br />
*'''maxIterations''': integral number of tries for the existing filename collisions<br />
<br />
==Returns==<br />
This function returns a newly created file handle distinct from any other colliding one if successful, false otherwise.<br />
<br />
==Example==<br />
<syntaxhighlight lang="lua"><br />
-- TODO<br />
</syntaxhighlight><br />
{{:Modules/FileSystem/namespace/functions}}<br />
<br />
{{:Modules/FileSystem/file/functions}}<br />
<br />
{{:Modules/FileSystem/translator/functions}}</div>Quirethttps://wiki.multitheftauto.com/index.php?title=Talk:Modules/FileSystem&diff=73710Talk:Modules/FileSystem2022-01-20T13:34:20Z<p>Quiret: </p>
<hr />
<div>==Linux version is being held back==<br />
Due to a GCC bug related to a new-ish C++ feature the Linux version of the Eir FileSystem module has to be held back until further notice by the GCC developers. You can find the status of the bug here:<br />
<br />
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104079<br />
<br />
I truly wish for a very quick resolution of all impeding GCC issues but I do recognize that it is not a paid product. Although it is free there could be an entire IT industry that depends on this compiler thus any bug amounts to a betrayal to developers. But let's not be harsh to these people. I share this bug in the hopes that more people realize the importance of well-working software, the importance of testing and the internet community that surrounds the software. [[User:Quiret|Quiret]] ([[User talk:Quiret|talk]]) 13:34, 20 January 2022 (UTC)</div>Quirethttps://wiki.multitheftauto.com/index.php?title=Talk:Modules/FileSystem&diff=73709Talk:Modules/FileSystem2022-01-20T13:33:49Z<p>Quiret: Created page with "==Linux version is being held back== Due to a GCC bug related to a new-ish C++ feature the Linux version of the Eir FileSystem module has to be held back until further notice by the GCC developers. You can find the status of the bug here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104079 I truly wish for a very quick resolution of all impeding GCC issues but I do recognize that it is not a paid product. Although it is free there could be an entire IT industry that de..."</p>
<hr />
<div>==Linux version is being held back==<br />
Due to a GCC bug related to a new-ish C++ feature the Linux version of the Eir FileSystem module has to be held back until further notice by the GCC developers. You can find the status of the bug here:<br />
<br />
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104079<br />
<br />
I truly wish for a very quick resolution of all impeding GCC issues but I do recognize that it is not a paid product. Although it is free there could be an entire IT industry that depends on this compiler thus any bug amounts to a betrayal to developers. But let's not be harsh to these people. I share this bug in the hopes that more people realize the importance of well-working software, the importance of testing and the internet community that surrounds the software.</div>Quirethttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/FileSystem&diff=73708MTA:Eir/FileSystem2022-01-20T13:27:39Z<p>Quiret: /* References */</p>
<hr />
<div>The '''MTA:Eir FileSystem''' is the framework used for accessing persistent data in [[MTA:Eir]] on places like the harddisk and .zip archives. It is a cross-platform library that currently supports Windows and Unix operating systems. It is based on browsing file system directories after named file entries. A directory can be accessed using a '''translator'''. Each file entry has a path which can be accessed from '''translators'''. To open a file, a '''binary stream handle''' is created and returned to the runtime (CFile native class). Each translator has a '''root directory''' and '''current directory''' that it bases all operations on. It is only allowed to access file system objects from '''its directory tree'''.<br />
<br />
==Definition of Paths==<br />
A '''path''' is a string that is used to '''browse a file system''' with. It can consist of multiple namespaces that resolve into folders on the underlying file system. Every path has a ''target location'' that it points to on a translator file system.<br />
<br />
===Distinction between paths===<br />
A '''directory path''' is a path that ends with either '''/''' or '''\'''. Functions that expect directory paths are allowed to '''trim away the filename at the end of the path'''.<br />
<br />
A '''file path''' is a path that does '''not''' end with either '''/''' or '''\'''. These paths are accepted by functions that '''open binary streams''' or '''handle binary data directly'''. There has to be a '''filename''' at the end of the '''file path'''. It is a string whose size is greater than 0 and contains the name of a '''file object'''.<br />
<br />
The '''null path''' is the path whose '''size is zero'''. This path has to be accepted by all functions. It should cause '''no additional browsing''' other than the '''translators current status'''. If passed to '''translator path resolution functions''', these functions should return the path that they base operations on (i.e. the current directory of the translator).<br />
<br />
A '''relative path''' is a directory or file path that is resolved based on the '''translators current directory''' (unless otherwise specified). Two relative paths are only equal if their translators current directory at the time of resolution was the same.<br />
<br />
An '''absolute path''' is a directory or file path that is resolved based on the '''translators current directory''' (unless otherwise specified). Two absolute paths can be equal independent from the '''translator status'''.<br />
<br />
An '''unique path''' is a path that is returned by '''translator path resolution functions'''. It must not contain '''path scripting symbols'''. If two unique paths are compared for equality, then they '''point to the same file system object''' if the ''context of the comparison'' stays the same (i.e. the translator current directory).<br />
<br />
[[File:Path derivation tree.png|x540px|center]]<br />
<br />
===Windows===<br />
On Windows, a file path is '''case-'''in'''sensitive'''. This means that paths can be checked for equality by comparing the lower-case version of their '''unique absolute path'''. Paths do not allow the symbols '''<''', '''>''', '''"''', '''|''', '''?''' and '''*'''. File paths cannot allow the symbols '''/''' and '''\'''.<br />
<br />
===Linux===<br />
On Linux, a file path is '''case-sensitive'''. Paths can be checked for equality by '''comparing their characters directly'''. In Lua, this is a simple string reference comparison.<br />
<br />
==Browsing a File System using Paths==<br />
A '''file system''' is a structure that consists of named and partitioned '''file system objects'''. It is a '''tree structure''' that has a ''root directory''. From the root directory each file system object should be addressable using '''paths'''. There are infinite variations of paths to address file system objects using '''path scripting''', unless the path is an '''unique path'''.<br />
<br />
Translators behave in a similar way in that they have a root directory where every file system object is addressable from. Hence a translator is a ''special derivation'' of a file system. Like in file systems the runtime '''cannot address file system objects that are outside of the root directory''' (a process called up-rooting). Using scanning functions translators can request the contents of directories. The returned list of names is OS specific. In general, if the OS sets a ''hidden-flag'' onto a file object, its name should not be returned.<br />
<br />
===Translator Access on Windows===<br />
{| class="wikitable"<br />
|-<br />
|Path Syntax<br />
|Description<br />
|-<br />
|''*drive_letter*'':/''*path*''<br />
|Format of an '''absolute path''' that is based from the '''drive root''' (OS specific).<br />
|-<br />
|/''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator root'''.<br />
|-<br />
|//''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator root'''.<br />
|-<br />
|''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator current directory'''.<br />
|-<br />
|\\''*unc-name*''\''*path*''<br />
|Format of a [https://docs.microsoft.com/en-us/dotnet/standard/io/file-path-formats#unc-paths UNC-path] (OS specific)<br />
|}<br />
<br />
'''Hint:''' to specify UNC-paths in Lua programs it is a good idea to make use of the '''multi-line-string''' literal, for example.<br />
<br />
<syntaxhighlight lang="lua"><br />
fs.root:setOutbreakEnabled(true)<br />
local logFile = fs.root:open([[\\wsl$\Ubuntu-20.04\var\log\dpkg.log]], "rb")<br />
</syntaxhighlight><br />
<br />
===Translator Access on Unix===<br />
{| class="wikitable"<br />
|-<br />
|Path Syntax<br />
|Description<br />
|-<br />
|/''*path*''<br />
|Format of an '''absolute path''' that is based from the '''Unix file system root''' (OS specific).<br />
|-<br />
|//''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator root'''.<br />
|-<br />
|''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator current directory'''.<br />
|}<br />
<br />
==Path Scripting and Path Resolution==<br />
Paths can contain the following scripting and formating symbols.<br />
{| class="wikitable"<br />
|Symbol<br />
|Description<br />
|-<br />
|/ or \<br />
|'''Namespace separator'''. If a string of valid file system characters is put before it or the string is a ''special namespace'', then that string is recognized as a namespace.<br />
|-<br />
|.<br />
|'''Current-directory pointer'''. If this character is recognized as a namespace, then it stands for the ''current directory at parsing level''. Effectively, this symbol does nothing.<br />
|-<br />
|..<br />
|'''Previous-directory pointer'''. If this character is recognized as a namespace, then the ''parser changes context'' to the ''upper directory'' on the translator file system tree.<br />
|}<br />
<br />
==References==<br />
*[[Modules/FileSystem/functions|FileSystem module Lua functions]]<br />
*[[Modules/FileSystem|MTA:BLUE FileSystem Module Port]]</div>Quirethttps://wiki.multitheftauto.com/index.php?title=Modules/FileSystem/translator/stat&diff=73702Modules/FileSystem/translator/stat2022-01-19T23:37:01Z<p>Quiret: </p>
<hr />
<div>__NOTOC__<br />
This function queries common information about a filesystem object and returns it as a dictionary. Example of it's return value:<br />
<syntaxhighlight lang="lua"><br />
{<br />
accessTime = 1390997951, -- OS specific time information<br />
creationTime = 1381999749, -- OS specific time information<br />
modTime = 1381872826, -- OS specific time information<br />
size = 1441280, -- size of the filesystem object in bytes<br />
};<br />
</syntaxhighlight><br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
dictionary translator:stat ( string filePath )<br />
</syntaxhighlight><br />
<br />
==Arguments==<br />
*'''filePath:''' the path to the filesystem object that you want to get the statistics of<br />
<br />
==Returns==<br />
This function returns a statistics structure of the filesystem object pointed at by '''filePath''', '''false''' if '''filePath''' is not a valid path in the translator or the filesystem object pointed at by it is not accessible.<br />
<br />
==Example==<br />
<section name="Client" class="client" show="true"><br />
This snippet returns information about the currently running script. It can be used to know when the script has been updated by MTA.<br />
<syntaxhighlight lang="lua"><br />
-- Grab a generic translator of resource instance directory.<br />
local resRoot = fileCreateTranslator( "/" );<br />
<br />
-- Get the information of this script file.<br />
local scriptStats = resRoot:stat( "thisScript.lua" );<br />
<br />
-- todo: use this information somehow.<br />
</syntaxhighlight><br />
</section><br />
{{:Modules/FileSystem/translator/functions}}</div>Quirethttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/FileSystem&diff=73701MTA:Eir/FileSystem2022-01-19T23:35:28Z<p>Quiret: /* Translator Access on Windows */</p>
<hr />
<div>The '''MTA:Eir FileSystem''' is the framework used for accessing persistent data in [[MTA:Eir]] on places like the harddisk and .zip archives. It is a cross-platform library that currently supports Windows and Unix operating systems. It is based on browsing file system directories after named file entries. A directory can be accessed using a '''translator'''. Each file entry has a path which can be accessed from '''translators'''. To open a file, a '''binary stream handle''' is created and returned to the runtime (CFile native class). Each translator has a '''root directory''' and '''current directory''' that it bases all operations on. It is only allowed to access file system objects from '''its directory tree'''.<br />
<br />
==Definition of Paths==<br />
A '''path''' is a string that is used to '''browse a file system''' with. It can consist of multiple namespaces that resolve into folders on the underlying file system. Every path has a ''target location'' that it points to on a translator file system.<br />
<br />
===Distinction between paths===<br />
A '''directory path''' is a path that ends with either '''/''' or '''\'''. Functions that expect directory paths are allowed to '''trim away the filename at the end of the path'''.<br />
<br />
A '''file path''' is a path that does '''not''' end with either '''/''' or '''\'''. These paths are accepted by functions that '''open binary streams''' or '''handle binary data directly'''. There has to be a '''filename''' at the end of the '''file path'''. It is a string whose size is greater than 0 and contains the name of a '''file object'''.<br />
<br />
The '''null path''' is the path whose '''size is zero'''. This path has to be accepted by all functions. It should cause '''no additional browsing''' other than the '''translators current status'''. If passed to '''translator path resolution functions''', these functions should return the path that they base operations on (i.e. the current directory of the translator).<br />
<br />
A '''relative path''' is a directory or file path that is resolved based on the '''translators current directory''' (unless otherwise specified). Two relative paths are only equal if their translators current directory at the time of resolution was the same.<br />
<br />
An '''absolute path''' is a directory or file path that is resolved based on the '''translators current directory''' (unless otherwise specified). Two absolute paths can be equal independent from the '''translator status'''.<br />
<br />
An '''unique path''' is a path that is returned by '''translator path resolution functions'''. It must not contain '''path scripting symbols'''. If two unique paths are compared for equality, then they '''point to the same file system object''' if the ''context of the comparison'' stays the same (i.e. the translator current directory).<br />
<br />
[[File:Path derivation tree.png|x540px|center]]<br />
<br />
===Windows===<br />
On Windows, a file path is '''case-'''in'''sensitive'''. This means that paths can be checked for equality by comparing the lower-case version of their '''unique absolute path'''. Paths do not allow the symbols '''<''', '''>''', '''"''', '''|''', '''?''' and '''*'''. File paths cannot allow the symbols '''/''' and '''\'''.<br />
<br />
===Linux===<br />
On Linux, a file path is '''case-sensitive'''. Paths can be checked for equality by '''comparing their characters directly'''. In Lua, this is a simple string reference comparison.<br />
<br />
==Browsing a File System using Paths==<br />
A '''file system''' is a structure that consists of named and partitioned '''file system objects'''. It is a '''tree structure''' that has a ''root directory''. From the root directory each file system object should be addressable using '''paths'''. There are infinite variations of paths to address file system objects using '''path scripting''', unless the path is an '''unique path'''.<br />
<br />
Translators behave in a similar way in that they have a root directory where every file system object is addressable from. Hence a translator is a ''special derivation'' of a file system. Like in file systems the runtime '''cannot address file system objects that are outside of the root directory''' (a process called up-rooting). Using scanning functions translators can request the contents of directories. The returned list of names is OS specific. In general, if the OS sets a ''hidden-flag'' onto a file object, its name should not be returned.<br />
<br />
===Translator Access on Windows===<br />
{| class="wikitable"<br />
|-<br />
|Path Syntax<br />
|Description<br />
|-<br />
|''*drive_letter*'':/''*path*''<br />
|Format of an '''absolute path''' that is based from the '''drive root''' (OS specific).<br />
|-<br />
|/''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator root'''.<br />
|-<br />
|//''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator root'''.<br />
|-<br />
|''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator current directory'''.<br />
|-<br />
|\\''*unc-name*''\''*path*''<br />
|Format of a [https://docs.microsoft.com/en-us/dotnet/standard/io/file-path-formats#unc-paths UNC-path] (OS specific)<br />
|}<br />
<br />
'''Hint:''' to specify UNC-paths in Lua programs it is a good idea to make use of the '''multi-line-string''' literal, for example.<br />
<br />
<syntaxhighlight lang="lua"><br />
fs.root:setOutbreakEnabled(true)<br />
local logFile = fs.root:open([[\\wsl$\Ubuntu-20.04\var\log\dpkg.log]], "rb")<br />
</syntaxhighlight><br />
<br />
===Translator Access on Unix===<br />
{| class="wikitable"<br />
|-<br />
|Path Syntax<br />
|Description<br />
|-<br />
|/''*path*''<br />
|Format of an '''absolute path''' that is based from the '''Unix file system root''' (OS specific).<br />
|-<br />
|//''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator root'''.<br />
|-<br />
|''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator current directory'''.<br />
|}<br />
<br />
==Path Scripting and Path Resolution==<br />
Paths can contain the following scripting and formating symbols.<br />
{| class="wikitable"<br />
|Symbol<br />
|Description<br />
|-<br />
|/ or \<br />
|'''Namespace separator'''. If a string of valid file system characters is put before it or the string is a ''special namespace'', then that string is recognized as a namespace.<br />
|-<br />
|.<br />
|'''Current-directory pointer'''. If this character is recognized as a namespace, then it stands for the ''current directory at parsing level''. Effectively, this symbol does nothing.<br />
|-<br />
|..<br />
|'''Previous-directory pointer'''. If this character is recognized as a namespace, then the ''parser changes context'' to the ''upper directory'' on the translator file system tree.<br />
|}<br />
<br />
==References==<br />
*[[MTA:Eir/FileSystem/functions|FileSystem module Lua functions]]<br />
*[[Modules/FileSystem|MTA:BLUE FileSystem Module Port]]</div>Quirethttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/FileSystem&diff=73700MTA:Eir/FileSystem2022-01-19T23:34:52Z<p>Quiret: /* Translator Access on Windows */</p>
<hr />
<div>The '''MTA:Eir FileSystem''' is the framework used for accessing persistent data in [[MTA:Eir]] on places like the harddisk and .zip archives. It is a cross-platform library that currently supports Windows and Unix operating systems. It is based on browsing file system directories after named file entries. A directory can be accessed using a '''translator'''. Each file entry has a path which can be accessed from '''translators'''. To open a file, a '''binary stream handle''' is created and returned to the runtime (CFile native class). Each translator has a '''root directory''' and '''current directory''' that it bases all operations on. It is only allowed to access file system objects from '''its directory tree'''.<br />
<br />
==Definition of Paths==<br />
A '''path''' is a string that is used to '''browse a file system''' with. It can consist of multiple namespaces that resolve into folders on the underlying file system. Every path has a ''target location'' that it points to on a translator file system.<br />
<br />
===Distinction between paths===<br />
A '''directory path''' is a path that ends with either '''/''' or '''\'''. Functions that expect directory paths are allowed to '''trim away the filename at the end of the path'''.<br />
<br />
A '''file path''' is a path that does '''not''' end with either '''/''' or '''\'''. These paths are accepted by functions that '''open binary streams''' or '''handle binary data directly'''. There has to be a '''filename''' at the end of the '''file path'''. It is a string whose size is greater than 0 and contains the name of a '''file object'''.<br />
<br />
The '''null path''' is the path whose '''size is zero'''. This path has to be accepted by all functions. It should cause '''no additional browsing''' other than the '''translators current status'''. If passed to '''translator path resolution functions''', these functions should return the path that they base operations on (i.e. the current directory of the translator).<br />
<br />
A '''relative path''' is a directory or file path that is resolved based on the '''translators current directory''' (unless otherwise specified). Two relative paths are only equal if their translators current directory at the time of resolution was the same.<br />
<br />
An '''absolute path''' is a directory or file path that is resolved based on the '''translators current directory''' (unless otherwise specified). Two absolute paths can be equal independent from the '''translator status'''.<br />
<br />
An '''unique path''' is a path that is returned by '''translator path resolution functions'''. It must not contain '''path scripting symbols'''. If two unique paths are compared for equality, then they '''point to the same file system object''' if the ''context of the comparison'' stays the same (i.e. the translator current directory).<br />
<br />
[[File:Path derivation tree.png|x540px|center]]<br />
<br />
===Windows===<br />
On Windows, a file path is '''case-'''in'''sensitive'''. This means that paths can be checked for equality by comparing the lower-case version of their '''unique absolute path'''. Paths do not allow the symbols '''<''', '''>''', '''"''', '''|''', '''?''' and '''*'''. File paths cannot allow the symbols '''/''' and '''\'''.<br />
<br />
===Linux===<br />
On Linux, a file path is '''case-sensitive'''. Paths can be checked for equality by '''comparing their characters directly'''. In Lua, this is a simple string reference comparison.<br />
<br />
==Browsing a File System using Paths==<br />
A '''file system''' is a structure that consists of named and partitioned '''file system objects'''. It is a '''tree structure''' that has a ''root directory''. From the root directory each file system object should be addressable using '''paths'''. There are infinite variations of paths to address file system objects using '''path scripting''', unless the path is an '''unique path'''.<br />
<br />
Translators behave in a similar way in that they have a root directory where every file system object is addressable from. Hence a translator is a ''special derivation'' of a file system. Like in file systems the runtime '''cannot address file system objects that are outside of the root directory''' (a process called up-rooting). Using scanning functions translators can request the contents of directories. The returned list of names is OS specific. In general, if the OS sets a ''hidden-flag'' onto a file object, its name should not be returned.<br />
<br />
===Translator Access on Windows===<br />
{| class="wikitable"<br />
|-<br />
|Path Syntax<br />
|Description<br />
|-<br />
|''*drive_letter*'':/''*path*''<br />
|Format of an '''absolute path''' that is based from the '''drive root''' (OS specific).<br />
|-<br />
|/''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator root'''.<br />
|-<br />
|//''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator root'''.<br />
|-<br />
|''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator current directory'''.<br />
|-<br />
|\\''*unc-name*''\''*path*''<br />
|Format of a [https://docs.microsoft.com/en-us/dotnet/standard/io/file-path-formats#unc-paths UNC-path] (OS specific)<br />
|}<br />
<br />
'''Hint:''' to specify UNC-paths in Lua programs it is a good idea to make use of the '''multi-line-string''' literal, for example.<br />
<br />
<syntaxhighlight lang="lua"><br />
fs.root:setOutbreakEnabled(true)<br />
local logFile = fs.root:open([[\\wsl$\Ubuntu-20.04\var\log\dpkg.log]])<br />
</syntaxhighlight><br />
<br />
===Translator Access on Unix===<br />
{| class="wikitable"<br />
|-<br />
|Path Syntax<br />
|Description<br />
|-<br />
|/''*path*''<br />
|Format of an '''absolute path''' that is based from the '''Unix file system root''' (OS specific).<br />
|-<br />
|//''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator root'''.<br />
|-<br />
|''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator current directory'''.<br />
|}<br />
<br />
==Path Scripting and Path Resolution==<br />
Paths can contain the following scripting and formating symbols.<br />
{| class="wikitable"<br />
|Symbol<br />
|Description<br />
|-<br />
|/ or \<br />
|'''Namespace separator'''. If a string of valid file system characters is put before it or the string is a ''special namespace'', then that string is recognized as a namespace.<br />
|-<br />
|.<br />
|'''Current-directory pointer'''. If this character is recognized as a namespace, then it stands for the ''current directory at parsing level''. Effectively, this symbol does nothing.<br />
|-<br />
|..<br />
|'''Previous-directory pointer'''. If this character is recognized as a namespace, then the ''parser changes context'' to the ''upper directory'' on the translator file system tree.<br />
|}<br />
<br />
==References==<br />
*[[MTA:Eir/FileSystem/functions|FileSystem module Lua functions]]<br />
*[[Modules/FileSystem|MTA:BLUE FileSystem Module Port]]</div>Quirethttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/FileSystem&diff=73699MTA:Eir/FileSystem2022-01-19T23:33:36Z<p>Quiret: /* Translator Access on Windows */</p>
<hr />
<div>The '''MTA:Eir FileSystem''' is the framework used for accessing persistent data in [[MTA:Eir]] on places like the harddisk and .zip archives. It is a cross-platform library that currently supports Windows and Unix operating systems. It is based on browsing file system directories after named file entries. A directory can be accessed using a '''translator'''. Each file entry has a path which can be accessed from '''translators'''. To open a file, a '''binary stream handle''' is created and returned to the runtime (CFile native class). Each translator has a '''root directory''' and '''current directory''' that it bases all operations on. It is only allowed to access file system objects from '''its directory tree'''.<br />
<br />
==Definition of Paths==<br />
A '''path''' is a string that is used to '''browse a file system''' with. It can consist of multiple namespaces that resolve into folders on the underlying file system. Every path has a ''target location'' that it points to on a translator file system.<br />
<br />
===Distinction between paths===<br />
A '''directory path''' is a path that ends with either '''/''' or '''\'''. Functions that expect directory paths are allowed to '''trim away the filename at the end of the path'''.<br />
<br />
A '''file path''' is a path that does '''not''' end with either '''/''' or '''\'''. These paths are accepted by functions that '''open binary streams''' or '''handle binary data directly'''. There has to be a '''filename''' at the end of the '''file path'''. It is a string whose size is greater than 0 and contains the name of a '''file object'''.<br />
<br />
The '''null path''' is the path whose '''size is zero'''. This path has to be accepted by all functions. It should cause '''no additional browsing''' other than the '''translators current status'''. If passed to '''translator path resolution functions''', these functions should return the path that they base operations on (i.e. the current directory of the translator).<br />
<br />
A '''relative path''' is a directory or file path that is resolved based on the '''translators current directory''' (unless otherwise specified). Two relative paths are only equal if their translators current directory at the time of resolution was the same.<br />
<br />
An '''absolute path''' is a directory or file path that is resolved based on the '''translators current directory''' (unless otherwise specified). Two absolute paths can be equal independent from the '''translator status'''.<br />
<br />
An '''unique path''' is a path that is returned by '''translator path resolution functions'''. It must not contain '''path scripting symbols'''. If two unique paths are compared for equality, then they '''point to the same file system object''' if the ''context of the comparison'' stays the same (i.e. the translator current directory).<br />
<br />
[[File:Path derivation tree.png|x540px|center]]<br />
<br />
===Windows===<br />
On Windows, a file path is '''case-'''in'''sensitive'''. This means that paths can be checked for equality by comparing the lower-case version of their '''unique absolute path'''. Paths do not allow the symbols '''<''', '''>''', '''"''', '''|''', '''?''' and '''*'''. File paths cannot allow the symbols '''/''' and '''\'''.<br />
<br />
===Linux===<br />
On Linux, a file path is '''case-sensitive'''. Paths can be checked for equality by '''comparing their characters directly'''. In Lua, this is a simple string reference comparison.<br />
<br />
==Browsing a File System using Paths==<br />
A '''file system''' is a structure that consists of named and partitioned '''file system objects'''. It is a '''tree structure''' that has a ''root directory''. From the root directory each file system object should be addressable using '''paths'''. There are infinite variations of paths to address file system objects using '''path scripting''', unless the path is an '''unique path'''.<br />
<br />
Translators behave in a similar way in that they have a root directory where every file system object is addressable from. Hence a translator is a ''special derivation'' of a file system. Like in file systems the runtime '''cannot address file system objects that are outside of the root directory''' (a process called up-rooting). Using scanning functions translators can request the contents of directories. The returned list of names is OS specific. In general, if the OS sets a ''hidden-flag'' onto a file object, its name should not be returned.<br />
<br />
===Translator Access on Windows===<br />
{| class="wikitable"<br />
|-<br />
|Path Syntax<br />
|Description<br />
|-<br />
|''*drive_letter*'':/''*path*''<br />
|Format of an '''absolute path''' that is based from the '''drive root''' (OS specific).<br />
|-<br />
|/''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator root'''.<br />
|-<br />
|//''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator root'''.<br />
|-<br />
|''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator current directory'''.<br />
|-<br />
|\\''*unc-name*''\''*path*''<br />
|Format of a [https://docs.microsoft.com/en-us/dotnet/standard/io/file-path-formats#unc-paths UNC-path] (OS specific)<br />
|}<br />
<br />
'''Hint:''' to specify UNC-paths in Lua programs it is a good idea to make use of the '''multi-line-string''' literal, for example.<br />
<br />
<syntaxhighlight lang="lua"><br />
local logFile = fs.root:open([[\\wsl$\Ubuntu-20.04\var\log\dpkg.log]])<br />
</syntaxhighlight><br />
<br />
===Translator Access on Unix===<br />
{| class="wikitable"<br />
|-<br />
|Path Syntax<br />
|Description<br />
|-<br />
|/''*path*''<br />
|Format of an '''absolute path''' that is based from the '''Unix file system root''' (OS specific).<br />
|-<br />
|//''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator root'''.<br />
|-<br />
|''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator current directory'''.<br />
|}<br />
<br />
==Path Scripting and Path Resolution==<br />
Paths can contain the following scripting and formating symbols.<br />
{| class="wikitable"<br />
|Symbol<br />
|Description<br />
|-<br />
|/ or \<br />
|'''Namespace separator'''. If a string of valid file system characters is put before it or the string is a ''special namespace'', then that string is recognized as a namespace.<br />
|-<br />
|.<br />
|'''Current-directory pointer'''. If this character is recognized as a namespace, then it stands for the ''current directory at parsing level''. Effectively, this symbol does nothing.<br />
|-<br />
|..<br />
|'''Previous-directory pointer'''. If this character is recognized as a namespace, then the ''parser changes context'' to the ''upper directory'' on the translator file system tree.<br />
|}<br />
<br />
==References==<br />
*[[MTA:Eir/FileSystem/functions|FileSystem module Lua functions]]<br />
*[[Modules/FileSystem|MTA:BLUE FileSystem Module Port]]</div>Quirethttps://wiki.multitheftauto.com/index.php?title=Modules/FileSystem/translator/open&diff=73698Modules/FileSystem/translator/open2022-01-19T23:26:58Z<p>Quiret: </p>
<hr />
<div>__NOTOC__<br />
This function opens a link to a file instance on a given Eir FileSystem translator. Using a file link you can write and/or receive data from filesystems.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
file, string translator:open ( string filePath, string fileMode )<br />
</syntaxhighlight><br />
<br />
==Arguments==<br />
*'''filePath:''' the path to the file that should be opened<br />
*'''fileMode:''' an ANSI file mode descriptor (can be 'w', 'r' or 'a', with 'b' and/or '+' appended)<br />
<br />
==Returns==<br />
This function returns the '''FileSystem file''' class that can be used to retrieve or store data persistently. Returns '''false''' if the file failed to open and the '''reason of failure as string'''.<br />
<br />
===Failure reasons===<br />
* unknown error<br />
* path out of scope<br />
* invalid parameters<br />
* resources exhausted<br />
* access denied<br />
* not found<br />
* already exists<br />
<br />
==Example==<br />
<section name="Server" class="server" show="true"><br />
This snippet lists information about the registered MTA server modules. This information can be retrieved through a command.<br />
<syntaxhighlight lang="lua"><br />
-- The table that will contain all module information.<br />
local moduleInfo = {};<br />
<br />
-- Attempt to get a handle to the FileSystem module namespace.<br />
local fsys = createFilesystemInterface();<br />
<br />
-- Could fail if the server restrictions are set tight.<br />
if not ( fsys ) then<br />
outputDebugString( "could not get a handle to the FileSystem module namespace" );<br />
return false;<br />
end<br />
<br />
local function moduleFileIterator( filePath )<br />
-- Create an entry for this module.<br />
local moduleName = fsys.root:relPath( filePath );<br />
local moduleStats = fsys.root:stat( filePath );<br />
<br />
local entry = {<br />
name = moduleName,<br />
stats = moduleStats<br />
};<br />
<br />
-- Add the entry into the registry.<br />
table.insert( moduleInfo, entry );<br />
end<br />
<br />
-- Loop through all server modules.<br />
fsys.root:chdir( "mods/deathmatch/modules/" );<br />
fsys.root:scanDirEx( "", "*", nil, moduleFileIterator, false );<br />
<br />
-- Function to get a module into by name.<br />
local function getModuleByName( name )<br />
for m,n in ipairs( moduleInfo ) do<br />
if ( n.name == name ) then<br />
return n;<br />
end<br />
end<br />
<br />
return false;<br />
end<br />
<br />
-- Command to request server module information.<br />
addCommandHandler( "modules",<br />
function(player, moduleName)<br />
-- Output module information to the player.<br />
local module = getModuleByName( moduleName );<br />
<br />
if not ( module ) then<br />
outputChatBox( "could not find module named " .. tostring( moduleName ), player );<br />
return false;<br />
end<br />
<br />
-- Output it.<br />
outputChatBox( "module-name: " .. module.name );<br />
outputChatBox( "module-size: " .. module.stats.size );<br />
<br />
-- todo: add more info about the module.<br />
end<br />
);<br />
</syntaxhighlight><br />
</section><br />
<section name="Client" class="client" show="true"><br />
This snippet attempts to open a file and output its contents inside of a CEGUI memo.<br />
<syntaxhighlight lang="lua"><br />
-- Get the screen size so we can scale the memo properly<br />
local screenWidth, screenHeight = guiGetScreenSize();<br />
<br />
-- Make the memo cover nearly the entire screen.<br />
local myMemo = guiCreateMemo( 20, 20, screenWidth - 40, screenHeight - 40, "", false );<br />
<br />
-- Read the contents of some file.<br />
local fileContents = "";<br />
<br />
local fileHandle = fileOpen( "someFile.txt", "rb" );<br />
<br />
if ( fileHandle ) then<br />
fileContents = fileHandle:read( fileHandle.size() );<br />
<br />
-- Clean up our file handle.<br />
fileHandle:destroy();<br />
end<br />
<br />
-- Update the memo.<br />
guiSetText( myMemo, fileContents );<br />
</syntaxhighlight><br />
</section><br />
{{:Modules/FileSystem/translator/functions}}<br />
<br />
{{:Modules/FileSystem/file/functions}}</div>Quirethttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/FileSystem&diff=73697MTA:Eir/FileSystem2022-01-19T23:25:05Z<p>Quiret: /* Translator Access on Windows */</p>
<hr />
<div>The '''MTA:Eir FileSystem''' is the framework used for accessing persistent data in [[MTA:Eir]] on places like the harddisk and .zip archives. It is a cross-platform library that currently supports Windows and Unix operating systems. It is based on browsing file system directories after named file entries. A directory can be accessed using a '''translator'''. Each file entry has a path which can be accessed from '''translators'''. To open a file, a '''binary stream handle''' is created and returned to the runtime (CFile native class). Each translator has a '''root directory''' and '''current directory''' that it bases all operations on. It is only allowed to access file system objects from '''its directory tree'''.<br />
<br />
==Definition of Paths==<br />
A '''path''' is a string that is used to '''browse a file system''' with. It can consist of multiple namespaces that resolve into folders on the underlying file system. Every path has a ''target location'' that it points to on a translator file system.<br />
<br />
===Distinction between paths===<br />
A '''directory path''' is a path that ends with either '''/''' or '''\'''. Functions that expect directory paths are allowed to '''trim away the filename at the end of the path'''.<br />
<br />
A '''file path''' is a path that does '''not''' end with either '''/''' or '''\'''. These paths are accepted by functions that '''open binary streams''' or '''handle binary data directly'''. There has to be a '''filename''' at the end of the '''file path'''. It is a string whose size is greater than 0 and contains the name of a '''file object'''.<br />
<br />
The '''null path''' is the path whose '''size is zero'''. This path has to be accepted by all functions. It should cause '''no additional browsing''' other than the '''translators current status'''. If passed to '''translator path resolution functions''', these functions should return the path that they base operations on (i.e. the current directory of the translator).<br />
<br />
A '''relative path''' is a directory or file path that is resolved based on the '''translators current directory''' (unless otherwise specified). Two relative paths are only equal if their translators current directory at the time of resolution was the same.<br />
<br />
An '''absolute path''' is a directory or file path that is resolved based on the '''translators current directory''' (unless otherwise specified). Two absolute paths can be equal independent from the '''translator status'''.<br />
<br />
An '''unique path''' is a path that is returned by '''translator path resolution functions'''. It must not contain '''path scripting symbols'''. If two unique paths are compared for equality, then they '''point to the same file system object''' if the ''context of the comparison'' stays the same (i.e. the translator current directory).<br />
<br />
[[File:Path derivation tree.png|x540px|center]]<br />
<br />
===Windows===<br />
On Windows, a file path is '''case-'''in'''sensitive'''. This means that paths can be checked for equality by comparing the lower-case version of their '''unique absolute path'''. Paths do not allow the symbols '''<''', '''>''', '''"''', '''|''', '''?''' and '''*'''. File paths cannot allow the symbols '''/''' and '''\'''.<br />
<br />
===Linux===<br />
On Linux, a file path is '''case-sensitive'''. Paths can be checked for equality by '''comparing their characters directly'''. In Lua, this is a simple string reference comparison.<br />
<br />
==Browsing a File System using Paths==<br />
A '''file system''' is a structure that consists of named and partitioned '''file system objects'''. It is a '''tree structure''' that has a ''root directory''. From the root directory each file system object should be addressable using '''paths'''. There are infinite variations of paths to address file system objects using '''path scripting''', unless the path is an '''unique path'''.<br />
<br />
Translators behave in a similar way in that they have a root directory where every file system object is addressable from. Hence a translator is a ''special derivation'' of a file system. Like in file systems the runtime '''cannot address file system objects that are outside of the root directory''' (a process called up-rooting). Using scanning functions translators can request the contents of directories. The returned list of names is OS specific. In general, if the OS sets a ''hidden-flag'' onto a file object, its name should not be returned.<br />
<br />
===Translator Access on Windows===<br />
{| class="wikitable"<br />
|-<br />
|Path Syntax<br />
|Description<br />
|-<br />
|''*drive_letter*'':/''*path*''<br />
|Format of an '''absolute path''' that is based from the '''drive root''' (OS specific).<br />
|-<br />
|/''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator root'''.<br />
|-<br />
|//''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator root'''.<br />
|-<br />
|''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator current directory'''.<br />
|-<br />
|\\''*unc-name*''\''*path*''<br />
|Format of a [https://docs.microsoft.com/en-us/dotnet/standard/io/file-path-formats#unc-paths UNC-path] (OS specific)<br />
|}<br />
<br />
===Translator Access on Unix===<br />
{| class="wikitable"<br />
|-<br />
|Path Syntax<br />
|Description<br />
|-<br />
|/''*path*''<br />
|Format of an '''absolute path''' that is based from the '''Unix file system root''' (OS specific).<br />
|-<br />
|//''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator root'''.<br />
|-<br />
|''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator current directory'''.<br />
|}<br />
<br />
==Path Scripting and Path Resolution==<br />
Paths can contain the following scripting and formating symbols.<br />
{| class="wikitable"<br />
|Symbol<br />
|Description<br />
|-<br />
|/ or \<br />
|'''Namespace separator'''. If a string of valid file system characters is put before it or the string is a ''special namespace'', then that string is recognized as a namespace.<br />
|-<br />
|.<br />
|'''Current-directory pointer'''. If this character is recognized as a namespace, then it stands for the ''current directory at parsing level''. Effectively, this symbol does nothing.<br />
|-<br />
|..<br />
|'''Previous-directory pointer'''. If this character is recognized as a namespace, then the ''parser changes context'' to the ''upper directory'' on the translator file system tree.<br />
|}<br />
<br />
==References==<br />
*[[MTA:Eir/FileSystem/functions|FileSystem module Lua functions]]<br />
*[[Modules/FileSystem|MTA:BLUE FileSystem Module Port]]</div>Quirethttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/FileSystem&diff=73696MTA:Eir/FileSystem2022-01-19T23:24:51Z<p>Quiret: /* Translator Access on Windows */</p>
<hr />
<div>The '''MTA:Eir FileSystem''' is the framework used for accessing persistent data in [[MTA:Eir]] on places like the harddisk and .zip archives. It is a cross-platform library that currently supports Windows and Unix operating systems. It is based on browsing file system directories after named file entries. A directory can be accessed using a '''translator'''. Each file entry has a path which can be accessed from '''translators'''. To open a file, a '''binary stream handle''' is created and returned to the runtime (CFile native class). Each translator has a '''root directory''' and '''current directory''' that it bases all operations on. It is only allowed to access file system objects from '''its directory tree'''.<br />
<br />
==Definition of Paths==<br />
A '''path''' is a string that is used to '''browse a file system''' with. It can consist of multiple namespaces that resolve into folders on the underlying file system. Every path has a ''target location'' that it points to on a translator file system.<br />
<br />
===Distinction between paths===<br />
A '''directory path''' is a path that ends with either '''/''' or '''\'''. Functions that expect directory paths are allowed to '''trim away the filename at the end of the path'''.<br />
<br />
A '''file path''' is a path that does '''not''' end with either '''/''' or '''\'''. These paths are accepted by functions that '''open binary streams''' or '''handle binary data directly'''. There has to be a '''filename''' at the end of the '''file path'''. It is a string whose size is greater than 0 and contains the name of a '''file object'''.<br />
<br />
The '''null path''' is the path whose '''size is zero'''. This path has to be accepted by all functions. It should cause '''no additional browsing''' other than the '''translators current status'''. If passed to '''translator path resolution functions''', these functions should return the path that they base operations on (i.e. the current directory of the translator).<br />
<br />
A '''relative path''' is a directory or file path that is resolved based on the '''translators current directory''' (unless otherwise specified). Two relative paths are only equal if their translators current directory at the time of resolution was the same.<br />
<br />
An '''absolute path''' is a directory or file path that is resolved based on the '''translators current directory''' (unless otherwise specified). Two absolute paths can be equal independent from the '''translator status'''.<br />
<br />
An '''unique path''' is a path that is returned by '''translator path resolution functions'''. It must not contain '''path scripting symbols'''. If two unique paths are compared for equality, then they '''point to the same file system object''' if the ''context of the comparison'' stays the same (i.e. the translator current directory).<br />
<br />
[[File:Path derivation tree.png|x540px|center]]<br />
<br />
===Windows===<br />
On Windows, a file path is '''case-'''in'''sensitive'''. This means that paths can be checked for equality by comparing the lower-case version of their '''unique absolute path'''. Paths do not allow the symbols '''<''', '''>''', '''"''', '''|''', '''?''' and '''*'''. File paths cannot allow the symbols '''/''' and '''\'''.<br />
<br />
===Linux===<br />
On Linux, a file path is '''case-sensitive'''. Paths can be checked for equality by '''comparing their characters directly'''. In Lua, this is a simple string reference comparison.<br />
<br />
==Browsing a File System using Paths==<br />
A '''file system''' is a structure that consists of named and partitioned '''file system objects'''. It is a '''tree structure''' that has a ''root directory''. From the root directory each file system object should be addressable using '''paths'''. There are infinite variations of paths to address file system objects using '''path scripting''', unless the path is an '''unique path'''.<br />
<br />
Translators behave in a similar way in that they have a root directory where every file system object is addressable from. Hence a translator is a ''special derivation'' of a file system. Like in file systems the runtime '''cannot address file system objects that are outside of the root directory''' (a process called up-rooting). Using scanning functions translators can request the contents of directories. The returned list of names is OS specific. In general, if the OS sets a ''hidden-flag'' onto a file object, its name should not be returned.<br />
<br />
===Translator Access on Windows===<br />
{| class="wikitable"<br />
|-<br />
|Path Syntax<br />
|Description<br />
|-<br />
|''*drive_letter*'':/''*path*''<br />
|Format of an '''absolute path''' that is based from the '''drive root''' (OS specific).<br />
|-<br />
|/''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator root'''.<br />
|-<br />
|//''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator root'''.<br />
|-<br />
|''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator current directory'''.<br />
|-<br />
|\\''*unc-name*''\''*path*''<br />
|Format of a [[https://docs.microsoft.com/en-us/dotnet/standard/io/file-path-formats#unc-paths UNC-path]] (OS specific)<br />
|}<br />
<br />
===Translator Access on Unix===<br />
{| class="wikitable"<br />
|-<br />
|Path Syntax<br />
|Description<br />
|-<br />
|/''*path*''<br />
|Format of an '''absolute path''' that is based from the '''Unix file system root''' (OS specific).<br />
|-<br />
|//''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator root'''.<br />
|-<br />
|''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator current directory'''.<br />
|}<br />
<br />
==Path Scripting and Path Resolution==<br />
Paths can contain the following scripting and formating symbols.<br />
{| class="wikitable"<br />
|Symbol<br />
|Description<br />
|-<br />
|/ or \<br />
|'''Namespace separator'''. If a string of valid file system characters is put before it or the string is a ''special namespace'', then that string is recognized as a namespace.<br />
|-<br />
|.<br />
|'''Current-directory pointer'''. If this character is recognized as a namespace, then it stands for the ''current directory at parsing level''. Effectively, this symbol does nothing.<br />
|-<br />
|..<br />
|'''Previous-directory pointer'''. If this character is recognized as a namespace, then the ''parser changes context'' to the ''upper directory'' on the translator file system tree.<br />
|}<br />
<br />
==References==<br />
*[[MTA:Eir/FileSystem/functions|FileSystem module Lua functions]]<br />
*[[Modules/FileSystem|MTA:BLUE FileSystem Module Port]]</div>Quirethttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/FileSystem&diff=73695MTA:Eir/FileSystem2022-01-19T23:23:27Z<p>Quiret: /* Translator Access on Windows */</p>
<hr />
<div>The '''MTA:Eir FileSystem''' is the framework used for accessing persistent data in [[MTA:Eir]] on places like the harddisk and .zip archives. It is a cross-platform library that currently supports Windows and Unix operating systems. It is based on browsing file system directories after named file entries. A directory can be accessed using a '''translator'''. Each file entry has a path which can be accessed from '''translators'''. To open a file, a '''binary stream handle''' is created and returned to the runtime (CFile native class). Each translator has a '''root directory''' and '''current directory''' that it bases all operations on. It is only allowed to access file system objects from '''its directory tree'''.<br />
<br />
==Definition of Paths==<br />
A '''path''' is a string that is used to '''browse a file system''' with. It can consist of multiple namespaces that resolve into folders on the underlying file system. Every path has a ''target location'' that it points to on a translator file system.<br />
<br />
===Distinction between paths===<br />
A '''directory path''' is a path that ends with either '''/''' or '''\'''. Functions that expect directory paths are allowed to '''trim away the filename at the end of the path'''.<br />
<br />
A '''file path''' is a path that does '''not''' end with either '''/''' or '''\'''. These paths are accepted by functions that '''open binary streams''' or '''handle binary data directly'''. There has to be a '''filename''' at the end of the '''file path'''. It is a string whose size is greater than 0 and contains the name of a '''file object'''.<br />
<br />
The '''null path''' is the path whose '''size is zero'''. This path has to be accepted by all functions. It should cause '''no additional browsing''' other than the '''translators current status'''. If passed to '''translator path resolution functions''', these functions should return the path that they base operations on (i.e. the current directory of the translator).<br />
<br />
A '''relative path''' is a directory or file path that is resolved based on the '''translators current directory''' (unless otherwise specified). Two relative paths are only equal if their translators current directory at the time of resolution was the same.<br />
<br />
An '''absolute path''' is a directory or file path that is resolved based on the '''translators current directory''' (unless otherwise specified). Two absolute paths can be equal independent from the '''translator status'''.<br />
<br />
An '''unique path''' is a path that is returned by '''translator path resolution functions'''. It must not contain '''path scripting symbols'''. If two unique paths are compared for equality, then they '''point to the same file system object''' if the ''context of the comparison'' stays the same (i.e. the translator current directory).<br />
<br />
[[File:Path derivation tree.png|x540px|center]]<br />
<br />
===Windows===<br />
On Windows, a file path is '''case-'''in'''sensitive'''. This means that paths can be checked for equality by comparing the lower-case version of their '''unique absolute path'''. Paths do not allow the symbols '''<''', '''>''', '''"''', '''|''', '''?''' and '''*'''. File paths cannot allow the symbols '''/''' and '''\'''.<br />
<br />
===Linux===<br />
On Linux, a file path is '''case-sensitive'''. Paths can be checked for equality by '''comparing their characters directly'''. In Lua, this is a simple string reference comparison.<br />
<br />
==Browsing a File System using Paths==<br />
A '''file system''' is a structure that consists of named and partitioned '''file system objects'''. It is a '''tree structure''' that has a ''root directory''. From the root directory each file system object should be addressable using '''paths'''. There are infinite variations of paths to address file system objects using '''path scripting''', unless the path is an '''unique path'''.<br />
<br />
Translators behave in a similar way in that they have a root directory where every file system object is addressable from. Hence a translator is a ''special derivation'' of a file system. Like in file systems the runtime '''cannot address file system objects that are outside of the root directory''' (a process called up-rooting). Using scanning functions translators can request the contents of directories. The returned list of names is OS specific. In general, if the OS sets a ''hidden-flag'' onto a file object, its name should not be returned.<br />
<br />
===Translator Access on Windows===<br />
{| class="wikitable"<br />
|-<br />
|Path Syntax<br />
|Description<br />
|-<br />
|''*drive_letter*'':/''*path*''<br />
|Format of an '''absolute path''' that is based from the '''drive root''' (OS specific).<br />
|-<br />
|/''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator root'''.<br />
|-<br />
|//''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator root'''.<br />
|-<br />
|''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator current directory'''.<br />
|-<br />
|''\\*unc-name*\*path*''<br />
|Format of a [[https://docs.microsoft.com/en-us/dotnet/standard/io/file-path-formats#unc-paths UNC-path]] (OS specific)<br />
|}<br />
<br />
===Translator Access on Unix===<br />
{| class="wikitable"<br />
|-<br />
|Path Syntax<br />
|Description<br />
|-<br />
|/''*path*''<br />
|Format of an '''absolute path''' that is based from the '''Unix file system root''' (OS specific).<br />
|-<br />
|//''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator root'''.<br />
|-<br />
|''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator current directory'''.<br />
|}<br />
<br />
==Path Scripting and Path Resolution==<br />
Paths can contain the following scripting and formating symbols.<br />
{| class="wikitable"<br />
|Symbol<br />
|Description<br />
|-<br />
|/ or \<br />
|'''Namespace separator'''. If a string of valid file system characters is put before it or the string is a ''special namespace'', then that string is recognized as a namespace.<br />
|-<br />
|.<br />
|'''Current-directory pointer'''. If this character is recognized as a namespace, then it stands for the ''current directory at parsing level''. Effectively, this symbol does nothing.<br />
|-<br />
|..<br />
|'''Previous-directory pointer'''. If this character is recognized as a namespace, then the ''parser changes context'' to the ''upper directory'' on the translator file system tree.<br />
|}<br />
<br />
==References==<br />
*[[MTA:Eir/FileSystem/functions|FileSystem module Lua functions]]<br />
*[[Modules/FileSystem|MTA:BLUE FileSystem Module Port]]</div>Quirethttps://wiki.multitheftauto.com/index.php?title=Modules/FileSystem/translator/open&diff=73694Modules/FileSystem/translator/open2022-01-19T23:11:41Z<p>Quiret: </p>
<hr />
<div>__NOTOC__<br />
This function opens a link to a file instance on a given Eir FileSystem translator. Using a file link, you can write and/or receive data from filesystems.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
file, string translator:open ( string filePath, string fileMode )<br />
</syntaxhighlight><br />
<br />
==Arguments==<br />
*'''filePath:''' the path to the file that should be opened<br />
*'''fileMode:''' an ANSI file mode descriptor (can be 'w', 'r' or 'a', with 'b' and/or '+' appended)<br />
<br />
==Returns==<br />
This function returns the '''FileSystem file''' class that can be used to retrieve or store data persistently. Returns '''false''' if the file failed to open and the '''reason of failure as string'''.<br />
<br />
===Failure reasons===<br />
* unknown error<br />
* path out of scope<br />
* invalid parameters<br />
* resources exhausted<br />
* access denied<br />
* not found<br />
* already exists<br />
<br />
==Example==<br />
<section name="Server" class="server" show="true"><br />
This snippet lists information about the registered MTA server modules. This information can be retrieved through a command.<br />
<syntaxhighlight lang="lua"><br />
-- The table that will contain all module information.<br />
local moduleInfo = {};<br />
<br />
-- Attempt to get a handle to the FileSystem module namespace.<br />
local fsys = createFilesystemInterface();<br />
<br />
-- Could fail if the server restrictions are set tight.<br />
if not ( fsys ) then<br />
outputDebugString( "could not get a handle to the FileSystem module namespace" );<br />
return false;<br />
end<br />
<br />
local function moduleFileIterator( filePath )<br />
-- Create an entry for this module.<br />
local moduleName = fsys.root:relPath( filePath );<br />
local moduleStats = fsys.root:stat( filePath );<br />
<br />
local entry = {<br />
name = moduleName,<br />
stats = moduleStats<br />
};<br />
<br />
-- Add the entry into the registry.<br />
table.insert( moduleInfo, entry );<br />
end<br />
<br />
-- Loop through all server modules.<br />
fsys.root:chdir( "mods/deathmatch/modules/" );<br />
fsys.root:scanDirEx( "", "*", nil, moduleFileIterator, false );<br />
<br />
-- Function to get a module into by name.<br />
local function getModuleByName( name )<br />
for m,n in ipairs( moduleInfo ) do<br />
if ( n.name == name ) then<br />
return n;<br />
end<br />
end<br />
<br />
return false;<br />
end<br />
<br />
-- Command to request server module information.<br />
addCommandHandler( "modules",<br />
function(player, moduleName)<br />
-- Output module information to the player.<br />
local module = getModuleByName( moduleName );<br />
<br />
if not ( module ) then<br />
outputChatBox( "could not find module named " .. tostring( moduleName ), player );<br />
return false;<br />
end<br />
<br />
-- Output it.<br />
outputChatBox( "module-name: " .. module.name );<br />
outputChatBox( "module-size: " .. module.stats.size );<br />
<br />
-- todo: add more info about the module.<br />
end<br />
);<br />
</syntaxhighlight><br />
</section><br />
<section name="Client" class="client" show="true"><br />
This snippet attempts to open a file and output its contents inside of a CEGUI memo.<br />
<syntaxhighlight lang="lua"><br />
-- Get the screen size so we can scale the memo properly<br />
local screenWidth, screenHeight = guiGetScreenSize();<br />
<br />
-- Make the memo cover nearly the entire screen.<br />
local myMemo = guiCreateMemo( 20, 20, screenWidth - 40, screenHeight - 40, "", false );<br />
<br />
-- Read the contents of some file.<br />
local fileContents = "";<br />
<br />
local fileHandle = fileOpen( "someFile.txt", "rb" );<br />
<br />
if ( fileHandle ) then<br />
fileContents = fileHandle:read( fileHandle.size() );<br />
<br />
-- Clean up our file handle.<br />
fileHandle:destroy();<br />
end<br />
<br />
-- Update the memo.<br />
guiSetText( myMemo, fileContents );<br />
</syntaxhighlight><br />
</section><br />
{{:Modules/FileSystem/translator/functions}}<br />
<br />
{{:Modules/FileSystem/file/functions}}</div>Quirethttps://wiki.multitheftauto.com/index.php?title=Modules/FileSystem/object/destroy&diff=73693Modules/FileSystem/object/destroy2022-01-19T23:04:42Z<p>Quiret: </p>
<hr />
<div>__NOTOC__<br />
This function destroys the underlying object passed to it, rendering all Lua references to it null and void. All OS handles that had been associated with it are released.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
nil fsobject:destroy ()<br />
</syntaxhighlight><br />
<br />
==Returns==<br />
This function returns nil.<br />
<br />
==Remarks==<br />
It is a good idea to call this function on all files or translators whose use has expired. This way the release of OS resources is guaranteed to happen at a predictable point in time. Since all Eir FileSystem objects are '''garbage collected by default''' it is strictly-speaking not a must, but a strong recommendation. Adhering to this recommendation is a strong guideline for clean programming practice.<br />
<br />
==Example==<br />
<syntaxhighlight lang="lua"><br />
-- TODO.<br />
</syntaxhighlight><br />
{{:Modules/FileSystem/object/functions}}<br />
<br />
{{:Modules/FileSystem/translator/functions}}<br />
<br />
{{:Modules/FileSystem/file/functions}}</div>Quirethttps://wiki.multitheftauto.com/index.php?title=Modules/FileSystem/object/destroy&diff=73692Modules/FileSystem/object/destroy2022-01-19T23:03:49Z<p>Quiret: </p>
<hr />
<div>__NOTOC__<br />
This function destroys the underlying object passed to it, rendering all Lua references to it null and void. All OS handles that had been associated with it are released.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
nil fsobject:destroy ()<br />
</syntaxhighlight><br />
<br />
==Returns==<br />
This function returns nil.<br />
<br />
==Remarks==<br />
It is a good idea to call this function on all files or translators whose use has expired. This way the release of OS resources is guaranteed to happen at a predictable point in time. Since all Eir FileSystem objects are '''garbage collected by default''' it is strictly-speaking not a must, but a strong recommendation. Adhering to this recommendation is a strong guideline for clean programming practice.<br />
<br />
==Example==<br />
<syntaxhighlight lang="lua"><br />
-- TODO.<br />
</syntaxhighlight><br />
{{:Modules/FileSystem/translator/functions}}<br />
<br />
{{:Modules/FileSystem/file/functions}}</div>Quirethttps://wiki.multitheftauto.com/index.php?title=Modules/FileSystem/object/destroy&diff=73691Modules/FileSystem/object/destroy2022-01-19T23:03:16Z<p>Quiret: /* Remarks */</p>
<hr />
<div>__NOTOC__<br />
This function destroys the underlying object passed to it, rendering all Lua references to it null and void. All OS handles that have been associated with it are released.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
nil fsobject:destroy ()<br />
</syntaxhighlight><br />
<br />
==Returns==<br />
This function returns nil.<br />
<br />
==Remarks==<br />
It is a good idea to call this function on all files or translators whose use has expired. This way the release of OS resources is guaranteed to happen at a predictable point in time. Since all Eir FileSystem objects are '''garbage collected by default''' it is strictly-speaking not a must, but a strong recommendation. Adhering to this recommendation is a strong guideline for clean programming practice.<br />
<br />
==Example==<br />
<syntaxhighlight lang="lua"><br />
-- TODO.<br />
</syntaxhighlight><br />
{{:Modules/FileSystem/translator/functions}}<br />
<br />
{{:Modules/FileSystem/file/functions}}</div>Quirethttps://wiki.multitheftauto.com/index.php?title=Modules/FileSystem/object/destroy&diff=73690Modules/FileSystem/object/destroy2022-01-19T23:02:38Z<p>Quiret: Created page with "__NOTOC__ This function destroys the underlying object passed to it, rendering all Lua references to it null and void. All OS handles that have been associated with it are released. ==Syntax== <syntaxhighlight lang="lua"> nil fsobject:destroy () </syntaxhighlight> ==Returns== This function returns nil. ==Remarks== It is a good idea to call this function on all files or translators whose use has expired. This way the release of OS resources is guarranteed to happen at..."</p>
<hr />
<div>__NOTOC__<br />
This function destroys the underlying object passed to it, rendering all Lua references to it null and void. All OS handles that have been associated with it are released.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
nil fsobject:destroy ()<br />
</syntaxhighlight><br />
<br />
==Returns==<br />
This function returns nil.<br />
<br />
==Remarks==<br />
It is a good idea to call this function on all files or translators whose use has expired. This way the release of OS resources is guarranteed to happen at a predictable point in time. Since all Eir FileSystem objects are '''garbage collected by default''' it is strictly-speaking not a must, but a strong recommendation. Adhering to this recommendation is a strong guideline for clean programming practice.<br />
<br />
==Example==<br />
<syntaxhighlight lang="lua"><br />
-- TODO.<br />
</syntaxhighlight><br />
{{:Modules/FileSystem/translator/functions}}<br />
<br />
{{:Modules/FileSystem/file/functions}}</div>Quirethttps://wiki.multitheftauto.com/index.php?title=Modules/FileSystem/functions&diff=73689Modules/FileSystem/functions2022-01-19T22:55:44Z<p>Quiret: /* FileSystem Library Functions */</p>
<hr />
<div>==[[Modules/FileSystem|FileSystem]] Library Functions==<br />
*[[Modules/FileSystem/createFilesystemInterface|createFilesystemInterface]]<br />
{{:Modules/FileSystem/namespace/functions}}<br />
<br />
{{:Modules/FileSystem/object/functions}}<br />
<br />
{{:Modules/FileSystem/translator/functions}}<br />
<br />
{{:Modules/FileSystem/file/functions}}</div>Quirethttps://wiki.multitheftauto.com/index.php?title=Modules/FileSystem/object/functions&diff=73688Modules/FileSystem/object/functions2022-01-19T22:55:24Z<p>Quiret: Created page with "==FileSystem Object Functions== *destroy"</p>
<hr />
<div>==[[Modules/FileSystem|FileSystem]] Object Functions==<br />
*[[Modules/FileSystem/object/destroy|destroy]]</div>Quirethttps://wiki.multitheftauto.com/index.php?title=Modules/FileSystem/file/stat&diff=73687Modules/FileSystem/file/stat2022-01-19T22:52:39Z<p>Quiret: </p>
<hr />
<div>__NOTOC__<br />
This function returns immediate statistics about this file/stream object. The output should be of same structure like that of [[Modules/FileSystem/translator/stat|translator:stat]].<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
dictionary file:stat ()<br />
</syntaxhighlight><br />
<br />
==Returns==<br />
Returns a dictionary that contains the immediate file statistics.<br />
<br />
==Example==<br />
todo.<br />
{{:Modules/FileSystem/file/functions}}</div>Quirethttps://wiki.multitheftauto.com/index.php?title=Modules/FileSystem/file/readUByte&diff=73686Modules/FileSystem/file/readUByte2022-01-19T22:49:15Z<p>Quiret: </p>
<hr />
<div>__NOTOC__<br />
This function attempts to read an unsigned byte (native type) from a file and returns it. The amount of bytes read should be one.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
unsigned_byte file:readUByte ()<br />
</syntaxhighlight><br />
<br />
==Returns==<br />
Returns the unsigned byte if it was successfully read from the file, '''false''' otherwise.<br />
<br />
==Example==<br />
<section name="Client" class="client" show="true"><br />
This snippet writes a Lua type into a file stream. The lua type can be anything that can be traversed over the network. It must be context-less data.<br />
<syntaxhighlight lang="lua"><br />
-- A table specifying descriptor information about Lua types.<br />
local typeDescriptors = {<br />
["boolean"] = { networkId = 0 },<br />
["number"] = { networkId = 1 },<br />
["string"] = { networkId = 2 },<br />
["table"] = { networkId = 3 },<br />
["nil"] = { networkId = 4 }<br />
};<br />
<br />
local function isValidNetworkType( typeName )<br />
return not ( typeDescriptors[typeName] == nil );<br />
end<br />
<br />
local function writeLuaData( theFile, data )<br />
-- Get the descriptor for the type.<br />
local typeName = rawtype(data);<br />
local info = typeDescriptors[typeName];<br />
<br />
-- Some types cannot be transfered over the network.<br />
if not ( info ) then return; end;<br />
<br />
-- Write the network identifier.<br />
theFile:writeUByte( info.networkId );<br />
<br />
-- Check what we are dealing with.<br />
if ( typeName == "boolean") then<br />
theFile:writeBoolean( data );<br />
elseif ( typeName == "number" ) then<br />
theFile:writeDouble( data );<br />
elseif ( typeName == "string" ) then<br />
theFile:writeUShort( #data );<br />
theFile:write( data );<br />
elseif ( typeName == "table" ) then<br />
-- First write iterated entries of the table.<br />
local numIteration = #data;<br />
do<br />
theFile:writeUInt( numIteration );<br />
<br />
local n = 1;<br />
<br />
while ( n <= numIteration ) do<br />
writeLuaData( data[n] );<br />
n = n + 1;<br />
end<br />
end<br />
<br />
-- Next write the data entries.<br />
do<br />
-- Construct a data entry table.<br />
local dataTable = {};<br />
local entryCount = 0;<br />
<br />
for m,n in pairs( data ) do<br />
if ( isValidNetworkType( rawtype( n ) ) ) then<br />
if not ( rawtype( n ) == "number" ) or ( n <= 0 ) or ( n > numIteration ) then<br />
entryCount = entryCount + 1;<br />
<br />
dataTable[entryCount] = {<br />
key = m,<br />
value = n<br />
};<br />
end<br />
end<br />
end<br />
<br />
-- Write the amount of data entries.<br />
theFile:writeUInt( entryCount );<br />
<br />
-- Write all data entries.<br />
for m,n in ipairs( dataTable ) do<br />
writeLuaData( n.key );<br />
writeLuaData( n.value );<br />
end<br />
end<br />
elseif ( typeName == "nil" ) then<br />
-- Do nothing.<br />
end<br />
end<br />
<br />
-- task for the reader: write a function to read the Lua data again.<br />
</syntaxhighlight><br />
</section><br />
{{:Modules/FileSystem/file/functions}}</div>Quirethttps://wiki.multitheftauto.com/index.php?title=Modules/FileSystem/file/read&diff=73685Modules/FileSystem/file/read2022-01-19T22:48:21Z<p>Quiret: </p>
<hr />
<div>__NOTOC__<br />
This function attempts to read the specified amount of bytes from the file. The actual amount of bytes read equals to the length of the Lua string.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
string file:read ( int readCount )<br />
</syntaxhighlight><br />
<br />
==Arguments==<br />
*'''readCount:''' the amount of bytes to read from the file<br />
<br />
==Returns==<br />
This function returns a string that contains the bytes that have been read from the file.<br />
<br />
==Example==<br />
<section name="Client" class="client" show="true"><br />
This snippet returns whether the file that is passed to it looks like a collision file.<br />
<syntaxhighlight lang="lua"><br />
local function isCollisionFile( file )<br />
-- Check whether the file is big enough to be a collision file.<br />
if ( ( file:size() - file:tell() ) <= 8 ) then<br />
return false;<br />
end<br />
<br />
-- Read the header checksum from the file.<br />
local checksum = file:read( 4 );<br />
<br />
-- Check whether the checksum is correct.<br />
return ( checksum == "COLL" ) or ( checksum == "COL2" ) or ( checksum == "COL3" ) or ( checksum == "COL4" );<br />
end<br />
<br />
-- Verify a collision file.<br />
local myColFile = fileOpen( "collisions/fence.col" );<br />
local result = false;<br />
<br />
if ( myColFile ) then<br />
result = isCollisionFile( myColFile );<br />
<br />
myColFile:destroy();<br />
end<br />
<br />
outputChatBox( "proper collision of fence model: " .. result );<br />
</syntaxhighlight><br />
</section><br />
{{:Modules/FileSystem/file/functions}}</div>Quirethttps://wiki.multitheftauto.com/index.php?title=Modules/FileSystem&diff=73684Modules/FileSystem2022-01-19T22:47:02Z<p>Quiret: /* Installing FileSystem into your Server */</p>
<hr />
<div><pageclass class="#62A033" subcaption="FileSystem module"></pageclass><br />
<br />
{{Module_Info|<br />
name = FileSystem |<br />
version = 2.0 |<br />
author = [[User:The_GTA|Martin Turski (The_GTA)]] |<br />
module_website = [http://eirfs.osdn.jp/ Here] |<br />
download_link = [https://green-candy.osdn.jp/external/releases/fileSystem_2_0_win32.zip Win32] Linux |<br />
license = none |<br />
written_in = C++ |<br />
operating_system = Cross-platform |<br />
compatible_with = 1.X |<br />
}}<br />
FileSystem is the [[MTA:Eir]] file management implementation exported as MTA:BLUE module. It is made for those people who are not satisfied with the standard MTA file functions. Its feature-set covers '''binary stream writing''', '''directory scanning''' and '''path resolution logic'''. It should satisfy all needs regarding file functionality. The modules' source code is released [https://osdn.net/projects/green-candy/scm/svn/tree/head/blueMods/fileSystem/ within the MTA:Eir SVN].<br />
<br />
It's documentation can be found [[MTA:Eir/FileSystem|here]]. To find coding examples, ''browse the individual class methods''.<br />
<br />
==Installing FileSystem into your Server==<br />
*Place the fileSystem*.dll module into your MTA server modules directory<br />
*Add the module into the mtaserver.conf module loading list (at the bottom of the file)<br />
*'''Edit the acl.xml in a way that resources require admin rights to call''' [[Modules/FileSystem/createFilesystemInterface|createFilesystemInterface]]''<br />
<br />
==System Access Possibilities==<br />
*Accessing whole system<br />
*Listing and editing all server resources<br />
*Modifying MTA Server configuration<br />
<br />
'''Be careful how you expose the FileSystem module to your server resources!'''<br />
<br />
==OOP-style API==<br />
Since version 2.0 of this library the API has been changed to match the MTA OOP-style API. This means that object methods are now accessed solely using the '''colon operator''' instead of the '''dot operator'''. If you have old FileSystem code (pre 2.0) then you may have to adjust it.<br />
<br />
==Support==<br />
If you are looking for direct support about this module then contact [https://forum.mtasa.com/profile/9756-the_gta/ The_GTA on the MTA forums]. The official MTA forums support topic can be found [https://forum.mtasa.com/topic/133936-filesystem-module-for-mtablue/ here].<br />
<br />
*[[Modules/FileSystem/Porting_Between_Clientside_and_Serverside|Porting Clientside and Serverside code]]<br />
<br />
{{:Modules/FileSystem/functions}}<br />
<br />
[[Category:Modules]]</div>Quirethttps://wiki.multitheftauto.com/index.php?title=Modules/FileSystem/file/functions&diff=73683Modules/FileSystem/file/functions2022-01-19T22:42:22Z<p>Quiret: /* FileSystem File Functions */</p>
<hr />
<div>==[[Modules/FileSystem|FileSystem]] File Functions==<br />
*[[Modules/FileSystem/file/read|read]]<br />
*[[Modules/FileSystem/file/readByte|readByte]]<br />
*[[Modules/FileSystem/file/readUByte|readUByte]]<br />
*[[Modules/FileSystem/file/readShort|readShort]]<br />
*[[Modules/FileSystem/file/readUShort|readUShort]]<br />
*[[Modules/FileSystem/file/readInt|readInt]]<br />
*[[Modules/FileSystem/file/readUInt|readUInt]]<br />
*[[Modules/FileSystem/file/readFloat|readFloat]]<br />
*[[Modules/FileSystem/file/readDouble|readDouble]]<br />
*[[Modules/FileSystem/file/readBoolean|readBoolean]]<br />
*[[Modules/FileSystem/file/write|write]]<br />
*[[Modules/FileSystem/file/writeByte|writeByte]]<br />
*[[Modules/FileSystem/file/writeUByte|writeUByte]]<br />
*[[Modules/FileSystem/file/writeShort|writeShort]]<br />
*[[Modules/FileSystem/file/writeUShort|writeUShort]]<br />
*[[Modules/FileSystem/file/writeInt|writeInt]]<br />
*[[Modules/FileSystem/file/writeUInt|writeUInt]]<br />
*[[Modules/FileSystem/file/writeFloat|writeFloat]]<br />
*[[Modules/FileSystem/file/writeDouble|writeDouble]]<br />
*[[Modules/FileSystem/file/writeBoolean|writeBoolean]]<br />
*[[Modules/FileSystem/file/size|size]]<br />
*[[Modules/FileSystem/file/stat|stat]]<br />
*[[Modules/FileSystem/file/tell|tell]]<br />
*[[Modules/FileSystem/file/seek|seek]]<br />
*[[Modules/FileSystem/file/eof|eof]]<br />
*[[Modules/FileSystem/file/flush|flush]]<br />
*[[Modules/FileSystem/file/isWritable|isWritable]]<br />
*[[Modules/FileSystem/file/isReadable|isReadable]]</div>Quirethttps://wiki.multitheftauto.com/index.php?title=Modules/FileSystem/translator/functions&diff=73682Modules/FileSystem/translator/functions2022-01-19T22:42:02Z<p>Quiret: /* FileSystem Translator Functions */</p>
<hr />
<div>==[[Modules/FileSystem|FileSystem]] Translator Functions==<br />
*[[Modules/FileSystem/translator/open|open]]<br />
*[[Modules/FileSystem/translator/exists|exists]]<br />
*[[Modules/FileSystem/translator/createDir|createDir]]<br />
*[[Modules/FileSystem/translator/chdir|chdir]]<br />
*[[Modules/FileSystem/translator/delete|delete]]<br />
*[[Modules/FileSystem/translator/copy|copy]]<br />
*[[Modules/FileSystem/translator/rename|rename]]<br />
*[[Modules/FileSystem/translator/size|size]]<br />
*[[Modules/FileSystem/translator/stat|stat]]<br />
*[[Modules/FileSystem/translator/relPath|relPath]]<br />
*[[Modules/FileSystem/translator/relPathRoot|relPathRoot]]<br />
*[[Modules/FileSystem/translator/absPath|absPath]]<br />
*[[Modules/FileSystem/translator/absPathRoot|absPathRoot]]<br />
*[[Modules/FileSystem/translator/scanDir|scanDir]]<br />
*[[Modules/FileSystem/translator/scanDirEx|scanDirEx]]<br />
*[[Modules/FileSystem/translator/getDirs|getDirs]]<br />
*[[Modules/FileSystem/translator/getFiles|getFiles]]<br />
*[[Modules/FileSystem/translator/setOutbreakEnabled|setOutbreakEnabled]]<br />
*[[Modules/FileSystem/translator/getOutbreakEnabled|getOutbreakEnabled]]<br />
*[[Modules/FileSystem/translator/setPathProcessingMode|setPathProcessingMode]]<br />
*[[Modules/FileSystem/translator/getPathProcessingMode|getPathProcessingMode]]</div>Quirethttps://wiki.multitheftauto.com/index.php?title=Modules/FileSystem/namespace/functions&diff=73681Modules/FileSystem/namespace/functions2022-01-19T22:41:39Z<p>Quiret: /* FileSystem Namespace Functions */</p>
<hr />
<div><br />
==[[Modules/FileSystem|FileSystem]] Namespace Functions==<br />
*[[Modules/FileSystem/createTranslator|createTranslator]]<br />
*[[Modules/FileSystem/createRAMDisk|createRAMDisk]]<br />
*[[Modules/FileSystem/createMemoryFile|createMemoryFile]]<br />
*[[Modules/FileSystem/createFileIterative|createFileIterative]]<br />
*[[Modules/FileSystem/copyFile|copyFile]]<br />
*[[Modules/FileSystem/copyStream|copyStream]]<br />
*[[Modules/FileSystem/copyStreamCount|copyStreamCount]]<br />
*[[Modules/FileSystem/pathToFilename|pathToFilename]]<br />
*[[Modules/FileSystem/streamCompare|streamCompare]]<br />
*[[Modules/FileSystem/topointer|topointer]]<br />
*[[Modules/FileSystem/type|type]]<br />
*[[Modules/FileSystem/setDoBufferAllRaw|setDoBufferAllRaw]]<br />
*[[Modules/FileSystem/getDoBufferAllRaw|getDoBufferAllRaw]]</div>Quirethttps://wiki.multitheftauto.com/index.php?title=Modules/FileSystem/functions&diff=73680Modules/FileSystem/functions2022-01-19T22:41:21Z<p>Quiret: /* FileSystem Library Functions */</p>
<hr />
<div>==[[Modules/FileSystem|FileSystem]] Library Functions==<br />
*[[Modules/FileSystem/createFilesystemInterface|createFilesystemInterface]]<br />
{{:Modules/FileSystem/namespace/functions}}<br />
<br />
{{:Modules/FileSystem/translator/functions}}<br />
<br />
{{:Modules/FileSystem/file/functions}}</div>Quirethttps://wiki.multitheftauto.com/index.php?title=Modules/FileSystem&diff=73595Modules/FileSystem2022-01-17T16:05:17Z<p>Quiret: </p>
<hr />
<div><pageclass class="#62A033" subcaption="FileSystem module"></pageclass><br />
<br />
{{Module_Info|<br />
name = FileSystem |<br />
version = 2.0 |<br />
author = [[User:The_GTA|Martin Turski (The_GTA)]] |<br />
module_website = [http://eirfs.osdn.jp/ Here] |<br />
download_link = [https://green-candy.osdn.jp/external/releases/fileSystem_2_0_win32.zip Win32] Linux |<br />
license = none |<br />
written_in = C++ |<br />
operating_system = Cross-platform |<br />
compatible_with = 1.X |<br />
}}<br />
FileSystem is the [[MTA:Eir]] file management implementation exported as MTA:BLUE module. It is made for those people who are not satisfied with the standard MTA file functions. Its feature-set covers '''binary stream writing''', '''directory scanning''' and '''path resolution logic'''. It should satisfy all needs regarding file functionality. The modules' source code is released [https://osdn.net/projects/green-candy/scm/svn/tree/head/blueMods/fileSystem/ within the MTA:Eir SVN].<br />
<br />
It's documentation can be found [[MTA:Eir/FileSystem|here]]. To find coding examples, ''browse the individual class methods''.<br />
<br />
==Installing FileSystem into your Server==<br />
*Place the fileSystem*.dll module into your MTA server modules directory<br />
*Add the module into the mtaserver.conf module loading list (at the bottom of the file)<br />
*'''Edit the acl.xml in a way that resources require admin rights to call''' [[MTA:Eir/FileSystem/createFilesystemInterface|createFilesystemInterface]]''<br />
<br />
==System Access Possibilities==<br />
*Accessing whole system<br />
*Listing and editing all server resources<br />
*Modifying MTA Server configuration<br />
<br />
'''Be careful how you expose the FileSystem module to your server resources!'''<br />
<br />
==OOP-style API==<br />
Since version 2.0 of this library the API has been changed to match the MTA OOP-style API. This means that object methods are now accessed solely using the '''colon operator''' instead of the '''dot operator'''. If you have old FileSystem code (pre 2.0) then you may have to adjust it.<br />
<br />
==Support==<br />
If you are looking for direct support about this module then contact [https://forum.mtasa.com/profile/9756-the_gta/ The_GTA on the MTA forums]. The official MTA forums support topic can be found [https://forum.mtasa.com/topic/133936-filesystem-module-for-mtablue/ here].<br />
<br />
*[[Modules/FileSystem/Porting_Between_Clientside_and_Serverside|Porting Clientside and Serverside code]]<br />
<br />
{{:MTA:Eir/FileSystem/functions}}<br />
<br />
[[Category:Modules]]</div>Quirethttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/FileSystem/functions&diff=73594MTA:Eir/FileSystem/functions2022-01-17T15:48:50Z<p>Quiret: /* FileSystem Library Functions */</p>
<hr />
<div>__NOTOC__<br />
==[[MTA:Eir/FileSystem|FileSystem]] Library Functions==<br />
*[[MTA:Eir/FileSystem/createFilesystemInterface|createFilesystemInterface]] (module only)<br />
<br />
{{:MTA:Eir/FileSystem/namespace/functions}}<br />
<br />
{{:MTA:Eir/FileSystem/translator/functions}}<br />
<br />
{{:MTA:Eir/FileSystem/atranslator/functions}}<br />
<br />
{{:MTA:Eir/FileSystem/file/functions}}</div>Quirethttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/FileSystem/translator/copy&diff=73592MTA:Eir/FileSystem/translator/copy2022-01-17T08:38:48Z<p>Quiret: </p>
<hr />
<div>__NOTOC__<br />
This function copies a file from a source location to a file at the destination. The contents of the source file are copied, so that source and destination have the same content. Since the transactions happen through kernel-calls, this function is faster than performing the copying yourself through Lua strings.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
bool translator:copy ( string srcPath, string dstPath )<br />
</syntaxhighlight><br />
<br />
==Arguments==<br />
*'''srcPath:''' a path to the source file<br />
*'''dstPath:''' the path to the new file that should be copied into<br />
<br />
==Returns==<br />
This function returns '''true''' if the file pointed at by '''srcPath''' is an accessible file that can be read from and the requested file a '''dstPath''' could be created and written to, '''false''' otherwise.<br />
<br />
==Example==<br />
<section name="Client" class="client" show="true"><br />
This snippet backups a copy of client-side configuration for safety purposes.<br />
<syntaxhighlight lang="lua"><br />
-- Create a generic translator.<br />
local resRoot = fileCreateTranslator( "/" );<br />
<br />
resRoot:copy( "config.xml", "backup/config.xml" );<br />
</syntaxhighlight><br />
</section><br />
{{:MTA:Eir/FileSystem/translator/functions}}</div>Quirethttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/FileSystem/translator/absPath&diff=73591MTA:Eir/FileSystem/translator/absPath2022-01-17T08:34:28Z<p>Quiret: /* Arguments */</p>
<hr />
<div>__NOTOC__<br />
This function resolves a specified path into its absolute version. This function can be used to get a unique version of a path (without scripting symbols such as '..').<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
string translator:absPath ( string path )<br />
</syntaxhighlight><br />
<br />
==Arguments==<br />
*'''path:''' the path that should be resolved into an absolute path; can be nil to return the absolute location of the current directory.<br />
<br />
==Returns==<br />
This function returns the absolute version of the path that is passed to it, '''false''' if the specified path is not accessible by the translator.<br />
<br />
==Example==<br />
<section name="Client" class="client" show="true"><br />
This snippet prints the absolute location of the shared client-side resource folder.<br />
<syntaxhighlight lang="lua"><br />
-- Get the absolute path to our resource.<br />
local absResourceLocation = fileCreateTranslator( "/" ):absPath();<br />
<br />
-- Print it out to the user.<br />
outputChatBox( "running resource from: " .. absResourceLocation );<br />
</syntaxhighlight><br />
</section><br />
{{:MTA:Eir/FileSystem/translator/functions}}</div>Quiret