https://wiki.multitheftauto.com/api.php?action=feedcontributions&user=Ceeser&feedformat=atomMulti Theft Auto: Wiki - User contributions [en]2024-03-28T13:02:09ZUser contributionsMediaWiki 1.39.3https://wiki.multitheftauto.com/index.php?title=XmlDeleteData&diff=64327XmlDeleteData2019-09-13T16:36:14Z<p>Ceeser: </p>
<hr />
<div><pageclass class="#228B22" subcaption="Useful Function - Shared"></pageclass><br />
<lowercasetitle></lowercasetitle><br />
<br />
__NOTOC__<br />
<br />
{{Important Note|<br />
This is an unofficial MTA function, so its not included into the game by default.<br><br />
Its an exported function of the [[xmlData]] resource.<br><br />
To access this function you need to have the resource running on your server.}}<br />
<br />
<br />
This function provides a way of deleting a [[XML]] file created by [[xmlSaveData]] <br><br />
To call it, see the [[call]] function or the tip in this resources page: [https://wiki.multitheftauto.com/wiki/XmlData#Simplifying_the_export Simplifying the export]<br />
<br />
<br />
= Info =<br />
'''For proper deletion you need to pass the same booleans / securityLevel as you did on xmlSaveData.'''<br><br />
'''If you called [[xmlSaveData]] with passing the securityLevel its recommended to pick securityLevel as function paremeter for the deletion as well.'''<br />
<br />
<br />
= Syntax =<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlDeleteData ( string fileName [, bool serverProtected = true, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlDeleteData ( string fileName [, int securityLevel = 4 ] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to delete.<br />
<br />
====Optional Arguments====<br />
*'''serverProtected:''' If set to ''true'' it can only delete the file of the creator-server, otherwise it doesn't care which server created it.<br />
*'''resourceProtected:''' If set to ''true'' it can only delete the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which your data is stored at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns ''true'' if successful, ''false'' and a debug output in case if failure.<br />
<br />
'''Note: There is no encryption parameter in this function, because xmlDeleteData will auto-search for and delete the key of encrypted files.'''<br />
</section><br />
<br />
<section name="Server" class="server" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlDeleteData ( string fileName [, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlDeleteData ( string fileName [, int securityLevel = 4 ] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to delete.<br />
<br />
====Optional Arguments====<br />
*'''resourceProtected:''' If set to ''true'' it can only delete the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which your data is stored at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns ''true'' if successful, ''false'' and a debug output in case if failure.<br />
<br />
'''Note: There is no encryption parameter in this function, because xmlDeleteData will auto-search for and delete the key of encrypted files.'''<br />
'''Note2: There is no serverProtected parameter, because its server-side already anyways.<br />
</section><br />
<br />
<br />
== Example ==<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
-- Lets assume we have created a resourceProtected-only file called "settings" already.<br />
local xml = exports.xmlData<br />
xml:xmlDeleteData("settings", false, true) -- not serverProtected, but resourceProtected<br />
-- OR<br />
xml:xmlDeleteData("settings", 1) -- securityLevel 1 equals not serverProtected, unencrypted, but resouceProtected - the encryption bool will be ignored at xmlDeleteData<br />
</syntaxhighlight><br />
</section><br />
<br />
<br />
==See Also==<br />
{{Template:Shared_xml_functions}}<br />
<br />
[[Category:Useful Functions]]</div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlLoadData&diff=64326XmlLoadData2019-09-13T16:36:05Z<p>Ceeser: </p>
<hr />
<div><pageclass class="#228B22" subcaption="Useful Function - Shared"></pageclass><br />
<lowercasetitle></lowercasetitle><br />
<br />
__NOTOC__<br />
<br />
{{Important Note|<br />
This is an unofficial MTA function, so its not included into the game by default.<br><br />
Its an exported function of the [[xmlData]] resource.<br><br />
To access this function you need to have the resource running on your server.}}<br />
<br />
<br />
This function provides an automated way of loading your data from an [[XML]] file created by [[xmlSaveData]] <br><br />
To call it, see the [[call]] function or the tip in this resources page: [https://wiki.multitheftauto.com/wiki/XmlData#Simplifying_the_export Simplifying the export]<br />
<br />
<br />
= Info =<br />
'''For proper data loading you need to pass the same booleans / securityLevel as you did on xmlSaveData.'''<br><br />
'''If you called [[xmlSaveData]] with passing the securityLevel its recommended to pick securityLevel as function paremeter for the loading as well.'''<br />
<br />
<br />
= Syntax =<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, bool serverProtected = true, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, int securityLevel = 4 ] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to load.<br />
<br />
====Optional Arguments====<br />
*'''serverProtected:''' If set to ''true'' it can only read the file of the creator-server, otherwise it doesn't care which server created it.<br />
*'''resourceProtected:''' If set to ''true'' it can only read the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which your data is stored at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns a ''table'' containing the files data, an empty ''table'' if there is no data stored inside the file, ''false'' and debug output in case if failure.<br />
<br />
'''Note: There is no encryption parameter in this function, because xmlLoadData will load and use a files key if it is encrypted.'''<br />
</section><br />
<br />
<section name="Server" class="server" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to load.<br />
<br />
====Optional Arguments====<br />
*'''resourceProtected:''' If set to ''true'' it can only read the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which your data is stored at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns a ''table'' containing the files data, an empty ''table'' if there is no data stored inside the file, ''false'' and debug output in case if failure.<br />
<br />
'''Note1: There is no encryption parameter, because xmlLoadData will load and use a files key if it is encrypted.'''<br><br />
'''Note2: There is no serverProtected parameter, because its server-side already anyways.<br />
</section><br />
<br />
<br />
== Example ==<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
-- Lets assume we created a encrypted, serverProtected file called "settings" already.<br />
local xml = exports.xmlData<br />
local tblSettings = xml:xmlLoadData("settings" true) -- serverProtected is true, resourceProtected false - false doesnt need to get passed here<br />
-- OR you can do this:<br />
local tblSettings = xml:xmlLoadData("settings" 6) -- securityLevel 6 equals serverProtected, encrypted, not resouceProtected - the encryption bool will be ignored at xmlLoadData<br />
</syntaxhighlight><br />
</section><br />
<br />
<br />
==See Also==<br />
{{Template:Shared_xml_functions}}<br />
<br />
[[Category:Useful Functions]]</div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlSaveData&diff=64325XmlSaveData2019-09-13T16:35:54Z<p>Ceeser: </p>
<hr />
<div><pageclass class="#228B22" subcaption="Useful Function - Shared"></pageclass><br />
<lowercasetitle></lowercasetitle><br />
<br />
__NOTOC__<br />
<br />
{{Important Note|<br />
This is an unofficial MTA function, so its not included into the game by default.<br><br />
Its an exported function of the [[xmlData]] resource.<br><br />
To access this function you need to have the resource running on your server.}}<br />
<br />
<br />
This function provides an automated way of loading your data from an [[XML]] file created by [[xmlSaveData]] <br><br />
To call it, see the [[call]] function or the tip in this resources page: [https://wiki.multitheftauto.com/wiki/XmlData#Simplifying_the_export Simplifying the export]<br />
<br />
<br />
= Syntax =<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, bool serverProtected = true, bool encryptData = false, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to create<br />
*'''data:''' The data you want to save (must be a table!)<br />
<br />
====Optional Arguments====<br />
*'''serverProtected:''' If set to ''true'' the script will protect the file so, that can only the creator server can access it.'''<br />
*'''encryptData:''' If set to ''true'' the script will generate a random key and use it to encrypt your stored data. '''Note: If you want to store "sensitive data", always use encryption!'''<br />
*'''resourceProtected:''' If set to ''true'' the script will add the sourceResource name (so the name of the resource from which it got called) to the fileName, preventing it from getting read/overwritten/deleted by any other resource. If set to ''false'' you can use this script to call/send/modify tables from different resources without the use of events/other export functions.<br />
or<br />
*'''securityLevel:''' The level of security on which you want to store your data at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns ''true'' if successful, ''false'' otherwise.<br />
</section><br />
<br />
<section name="Server" class="server" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, bool encryptData = false, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to create<br />
*'''data:''' The data you want to save (must be a table!)<br />
<br />
====Optional Arguments====<br />
*'''encryptData:''' If set to ''true'' the script will generate a random key and use it to encrypt your stored data. '''Note: If you want to store "sensitive data", always use encryption! (Account data should never be stored in serverside files - use a database instead!)'''<br />
*'''resourceProtected:''' If set to ''true'' the script will add the sourceResource name (so the name of the resource from which it got called) to the fileName, preventing it from getting read/overwritten/deleted by any other resource. If set to ''false'' you can use this script to call/send/modify tables from different resources without the use of events/other export functions.<br />
or<br />
*'''securityLevel:''' The level of security on which you want to store your data at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns ''true'' if successful, ''false'' otherwise.<br />
</section><br />
<br />
<br />
== Example ==<br />
<section name="Client" class="client" show="true"><br />
This is the script where we specify the export shortcut and the data table which we want to store.<br />
<syntaxhighlight lang="lua"><br />
local xml = exports.xmlData<br />
local tblScriptSettings = {posX = 800, posY = 500, sizeX = 500, sizeY = 300, settings = {show = true, tab = 1}}<br />
<br />
xml:xmlSaveData("myFileName", tblScriptSettings , true, true) -- Save the data as "myFileName"<br />
</syntaxhighlight><br />
<br />
This will create a server-protected, encrypted file on the clients computer called "myFileName.xml". Also it will generate a random generated key and stores it.<br><br />
The created file will -(could, because encrypted with a random key)- like this:<br />
<br />
<syntaxhighlight lang="xml"><br />
<root posY="VgEN0+TERhg=" posX="mjX4Tj5u6oM=" sizeX="VgEN0+TERhg=" sizeY="htgOMaZurQQ="><br />
<settings show="yeiNs/ne1Ks=" tab="OpijtdPvYqQ="></settings><br />
</root><br />
</syntaxhighlight><br />
</section><br />
<br />
<br />
==See Also==<br />
{{Template:Shared_xml_functions}}<br />
<br />
[[Category:Useful Functions]]</div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlData&diff=64324XmlData2019-09-13T16:35:42Z<p>Ceeser: </p>
<hr />
<div><pageclass class="resource" subcaption="Resource"></pageclass><br />
<lowercasetitle /><br />
<br />
{| style="background: #F9F9F9; border: 1px solid #AAA; padding: 5px; width: 250px; float:right;"<br />
|-<br />
| colspan="2" style="text-align: center;"|'''xmlData v1.1'''<br />
|-<br />
| colspan="2" align="center" |{{#if: {{{image|}}}|{{{image}}}}}<br />
|-<br />
|'''Status:'''<br />
|Up to date<br />
|-<br />
|'''Latest Release:'''<br />
|13.09.2019<br />
|-<br />
|'''Working on:'''<br />
|MTA v1.5.7<br />
|-<br />
|}<br />
<br />
<br />
== Resource Information ==<br />
This resource let you save and load data in an [[XML]] File.<br><br />
It's an easy to use resource, providing 3 exported functions.<br><br />
<br />
<br />
== Download ==<br />
'''Note: You have to put all the files of the .zip into a folder called "xmlData" and then upload the folder to your server!'''<br><br />
Download can be found at the [https://community.multitheftauto.com/index.php?p=resources&s=details&id=16187 MTA Community Page].<br><br />
Resource developed by: [https://community.multitheftauto.com/index.php?p=profile&id=477820 Ceeser]<br />
<br />
<br />
== Exported functions ==<br />
'''Note: These functions are available for Server and Client'''<br />
* [[XmlSaveData|xmlSaveData]]<br />
* [[xmlLoadData|xmlLoadData]]<br />
* [[xmlDeleteData|xmlDeleteData]]<br />
<br />
<br />
== Security ==<br />
Next to the point of easy access this resource has its focus on security.<br />
You can specify how much protection you want to have for your data:<br />
* '''Server protection''' - With this only the server that has created the file will be able to read/modify/delete it.<br />
* '''Encryption''' - With this the stored data will be encrypted by a generated key, making it unreadable and unmodifyable by humans.<br />
* '''Resource protection''' - With this only the resource that has created the file will be able to read/modify/delete it.<br />
<br />
Note: No matter what settings you use - no server will have access to any file without its specific filename.<br />
<br />
<br />
=== Key generation / Data encryption ===<br />
If you want to save your data encrypted the script will generate a random key and stores it, so that the file can get read again.<br />
If you enable server protection for the file, the key can also only be read by the same server that has generated the data file.<br />
The same also goes for the resource protection.<br />
<br />
<br />
=== Security Levels ===<br />
Instead of manually adding bool parameters to the functions you can also just pass the security level you want to use for each function:<br />
* '''0''' - No protection (any server, any resource or humans could read/modify)<br />
* '''1''' - Very low protection (creator resource on any server or humans could read/modify)<br />
* '''2''' - Very low protection (any resource on any server could read/modify, humans cant)<br />
* '''3''' - Low protection (only creator resource on any server could read/modify, humans cant)<br />
* '''4''' - Medium protection (any resource on the creator server or humans could read/modify) - DEFAULT<br />
* '''5''' - Medium protection (only creator resource on the creator server or humans could read/modify)<br />
* '''6''' - High protection (any resource on the creator server could read/modify, humans cant)<br />
* '''7''' - Very high protection (only creator resource on creator server could read/modify, humans cant.<br />
<br />
<br />
== Simplifying the export ==<br />
For simplifying reasons I recommend the use this shortcut variable to call the exported functions:<br />
<br />
<syntaxhighlight lang="lua"><br />
local xml = exports.xmlData -- Define this variable at the top of your script<br />
<br />
-- And then use it like this for example:<br />
xml:xmlSaveData("yourFileName", yourData)<br />
</syntaxhighlight><br />
<br />
<br />
== Variables and Specified Names ==<br />
In the exported functions are some names which I will explain here to keep the function pages as clean and small as possible.<br />
<br />
=== serverProtected / Creator-Server ===<br />
With '''creator-server''' I mean the server that has created a file.<br />
So if a file is serverProtected only the server that called the function is able to read/modify/delete it.<br><br />
This includes client-side: The function call have been on the client-side of any server, so the link to the server exist anyways.<br />
<br />
=== resourceProtected / Creator-Resource ===<br />
With '''creator-resource''' I mean the resource that has created a file.<br />
Example how it works: If you call xmlSaveData with resourceProtection from resource "login", only "login" will then be able to read that xml file.<br><br />
If you don't use serverProtection in combination to this, every "login" resource on any server COULD read that file if it calls xmlLoadData with the correct file name.<br />
<br />
<br />
== Data type warning ==<br />
'''This resource will save everything, no matter what you give as data input.'''<br><br />
So be sure that there is no userdata stored inside the table you are passing to the xmlSaveData function.<br />
In case you have any kind of userdata it will output warnings in the debugscript - you should fix that by removing all userdata from the input table, because: Any Userdata is temporary. It will change after a script restart, reconnect, server restart.. or even while a resource is running/ you are playing.<br />
<br />
<br />
== See Also ==<br />
{{Template:Shared_xml_functions}}<br />
<br />
[[Category:Resource]]</div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=Template:Shared_xml_functions&diff=64323Template:Shared xml functions2019-09-13T16:30:24Z<p>Ceeser: </p>
<hr />
<div>*[[xmlCopyFile]]<br />
*[[xmlCreateChild]]<br />
*[[xmlCreateFile]]<br />
*[[xmlDestroyNode]]<br />
*[[xmlFindChild]]<br />
*[[xmlLoadFile]]<br />
{{New items|3.0160|1.5.7|<br />
*[[xmlLoadString]]<br />
|19626}}<br />
*[[xmlNodeGetAttribute]]<br />
*[[xmlNodeGetAttributes]]<br />
*[[xmlNodeGetChildren]]<br />
*[[xmlNodeGetName]]<br />
*[[xmlNodeGetParent]]<br />
*[[xmlNodeGetValue]]<br />
*[[xmlNodeSetAttribute]]<br />
*[[xmlNodeSetName]]<br />
*[[xmlNodeSetValue]]<br />
*[[xmlSaveFile]]<br />
*[[xmlUnloadFile]]<br />
*[[xmlData]]<br />
<ul><br />
*[[xmlSaveData]]<br />
*[[xmlLoadData]]<br />
*[[xmlDeleteData]]<br />
</ul></div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlDeleteData&diff=64322XmlDeleteData2019-09-13T16:30:01Z<p>Ceeser: </p>
<hr />
<div><pageclass class="#228B22" subcaption="Useful Function - Shared"></pageclass><br />
<lowercasetitle></lowercasetitle><br />
<br />
__NOTOC__<br />
<br />
{{Important Note|<br />
This is an unofficial MTA function, so its not included into the game by default.<br><br />
Its an exported function of the [[xmlData]] resource.<br><br />
To access this function you need to have the resource running on your server.}}<br />
<br />
<br />
This function provides a way of deleting a [[XML]] file created by [[xmlSaveData]] <br><br />
To call it, see the [[call]] function or the tip in this resources page: [https://wiki.multitheftauto.com/wiki/XmlData#Simplifying_the_export Simplifying the export]<br />
<br />
<br />
= Info =<br />
'''For proper deletion you need to pass the same booleans / securityLevel as you did on xmlSaveData.'''<br><br />
'''If you called [[xmlSaveData]] with passing the securityLevel its recommended to pick securityLevel as function paremeter for the deletion as well.'''<br />
<br />
<br />
= Syntax =<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlDeleteData ( string fileName [, bool serverProtected = true, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlDeleteData ( string fileName [, int securityLevel = 4 ] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to delete.<br />
<br />
====Optional Arguments====<br />
*'''serverProtected:''' If set to ''true'' it can only delete the file of the creator-server, otherwise it doesn't care which server created it.<br />
*'''resourceProtected:''' If set to ''true'' it can only delete the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which your data is stored at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns ''true'' if successful, ''false'' and a debug output in case if failure.<br />
<br />
'''Note: There is no encryption parameter in this function, because xmlDeleteData will auto-search for and delete the key of encrypted files.'''<br />
</section><br />
<br />
<section name="Server" class="server" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlDeleteData ( string fileName [, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlDeleteData ( string fileName [, int securityLevel = 4 ] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to delete.<br />
<br />
====Optional Arguments====<br />
*'''resourceProtected:''' If set to ''true'' it can only delete the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which your data is stored at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns ''true'' if successful, ''false'' and a debug output in case if failure.<br />
<br />
'''Note: There is no encryption parameter in this function, because xmlDeleteData will auto-search for and delete the key of encrypted files.'''<br />
'''Note2: There is no serverProtected parameter, because its server-side already anyways.<br />
</section><br />
<br />
<br />
== Example ==<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
-- Lets assume we have created a resourceProtected-only file called "settings" already.<br />
local xml = exports.xmlData<br />
xml:xmlDeleteData("settings", false, true) -- not serverProtected, but resourceProtected<br />
-- OR<br />
xml:xmlDeleteData("settings", 1) -- securityLevel 1 equals not serverProtected, unencrypted, but resouceProtected - the encryption bool will be ignored at xmlDeleteData<br />
</syntaxhighlight><br />
</section><br />
<br />
<br />
==See Also==<br />
{{XML_functions}}<br />
<br />
[[Category:Useful Functions]]</div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlLoadData&diff=64321XmlLoadData2019-09-13T16:29:39Z<p>Ceeser: </p>
<hr />
<div><pageclass class="#228B22" subcaption="Useful Function - Shared"></pageclass><br />
<lowercasetitle></lowercasetitle><br />
<br />
__NOTOC__<br />
<br />
{{Important Note|<br />
This is an unofficial MTA function, so its not included into the game by default.<br><br />
Its an exported function of the [[xmlData]] resource.<br><br />
To access this function you need to have the resource running on your server.}}<br />
<br />
<br />
This function provides an automated way of loading your data from an [[XML]] file created by [[xmlSaveData]] <br><br />
To call it, see the [[call]] function or the tip in this resources page: [https://wiki.multitheftauto.com/wiki/XmlData#Simplifying_the_export Simplifying the export]<br />
<br />
<br />
= Info =<br />
'''For proper data loading you need to pass the same booleans / securityLevel as you did on xmlSaveData.'''<br><br />
'''If you called [[xmlSaveData]] with passing the securityLevel its recommended to pick securityLevel as function paremeter for the loading as well.'''<br />
<br />
<br />
= Syntax =<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, bool serverProtected = true, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, int securityLevel = 4 ] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to load.<br />
<br />
====Optional Arguments====<br />
*'''serverProtected:''' If set to ''true'' it can only read the file of the creator-server, otherwise it doesn't care which server created it.<br />
*'''resourceProtected:''' If set to ''true'' it can only read the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which your data is stored at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns a ''table'' containing the files data, an empty ''table'' if there is no data stored inside the file, ''false'' and debug output in case if failure.<br />
<br />
'''Note: There is no encryption parameter in this function, because xmlLoadData will load and use a files key if it is encrypted.'''<br />
</section><br />
<br />
<section name="Server" class="server" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to load.<br />
<br />
====Optional Arguments====<br />
*'''resourceProtected:''' If set to ''true'' it can only read the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which your data is stored at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns a ''table'' containing the files data, an empty ''table'' if there is no data stored inside the file, ''false'' and debug output in case if failure.<br />
<br />
'''Note1: There is no encryption parameter, because xmlLoadData will load and use a files key if it is encrypted.'''<br><br />
'''Note2: There is no serverProtected parameter, because its server-side already anyways.<br />
</section><br />
<br />
<br />
== Example ==<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
-- Lets assume we created a encrypted, serverProtected file called "settings" already.<br />
local xml = exports.xmlData<br />
local tblSettings = xml:xmlLoadData("settings" true) -- serverProtected is true, resourceProtected false - false doesnt need to get passed here<br />
-- OR you can do this:<br />
local tblSettings = xml:xmlLoadData("settings" 6) -- securityLevel 6 equals serverProtected, encrypted, not resouceProtected - the encryption bool will be ignored at xmlLoadData<br />
</syntaxhighlight><br />
</section><br />
<br />
<br />
==See Also==<br />
{{XML_functions}}<br />
<br />
[[Category:Useful Functions]]</div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlSaveData&diff=64320XmlSaveData2019-09-13T16:29:18Z<p>Ceeser: </p>
<hr />
<div><pageclass class="#228B22" subcaption="Useful Function - Shared"></pageclass><br />
<lowercasetitle></lowercasetitle><br />
<br />
__NOTOC__<br />
<br />
{{Important Note|<br />
This is an unofficial MTA function, so its not included into the game by default.<br><br />
Its an exported function of the [[xmlData]] resource.<br><br />
To access this function you need to have the resource running on your server.}}<br />
<br />
<br />
This function provides an automated way of loading your data from an [[XML]] file created by [[xmlSaveData]] <br><br />
To call it, see the [[call]] function or the tip in this resources page: [https://wiki.multitheftauto.com/wiki/XmlData#Simplifying_the_export Simplifying the export]<br />
<br />
<br />
= Syntax =<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, bool serverProtected = true, bool encryptData = false, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to create<br />
*'''data:''' The data you want to save (must be a table!)<br />
<br />
====Optional Arguments====<br />
*'''serverProtected:''' If set to ''true'' the script will protect the file so, that can only the creator server can access it.'''<br />
*'''encryptData:''' If set to ''true'' the script will generate a random key and use it to encrypt your stored data. '''Note: If you want to store "sensitive data", always use encryption!'''<br />
*'''resourceProtected:''' If set to ''true'' the script will add the sourceResource name (so the name of the resource from which it got called) to the fileName, preventing it from getting read/overwritten/deleted by any other resource. If set to ''false'' you can use this script to call/send/modify tables from different resources without the use of events/other export functions.<br />
or<br />
*'''securityLevel:''' The level of security on which you want to store your data at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns ''true'' if successful, ''false'' otherwise.<br />
</section><br />
<br />
<section name="Server" class="server" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, bool encryptData = false, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to create<br />
*'''data:''' The data you want to save (must be a table!)<br />
<br />
====Optional Arguments====<br />
*'''encryptData:''' If set to ''true'' the script will generate a random key and use it to encrypt your stored data. '''Note: If you want to store "sensitive data", always use encryption! (Account data should never be stored in serverside files - use a database instead!)'''<br />
*'''resourceProtected:''' If set to ''true'' the script will add the sourceResource name (so the name of the resource from which it got called) to the fileName, preventing it from getting read/overwritten/deleted by any other resource. If set to ''false'' you can use this script to call/send/modify tables from different resources without the use of events/other export functions.<br />
or<br />
*'''securityLevel:''' The level of security on which you want to store your data at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns ''true'' if successful, ''false'' otherwise.<br />
</section><br />
<br />
<br />
== Example ==<br />
<section name="Client" class="client" show="true"><br />
This is the script where we specify the export shortcut and the data table which we want to store.<br />
<syntaxhighlight lang="lua"><br />
local xml = exports.xmlData<br />
local tblScriptSettings = {posX = 800, posY = 500, sizeX = 500, sizeY = 300, settings = {show = true, tab = 1}}<br />
<br />
xml:xmlSaveData("myFileName", tblScriptSettings , true, true) -- Save the data as "myFileName"<br />
</syntaxhighlight><br />
<br />
This will create a server-protected, encrypted file on the clients computer called "myFileName.xml". Also it will generate a random generated key and stores it.<br><br />
The created file will -(could, because encrypted with a random key)- like this:<br />
<br />
<syntaxhighlight lang="xml"><br />
<root posY="VgEN0+TERhg=" posX="mjX4Tj5u6oM=" sizeX="VgEN0+TERhg=" sizeY="htgOMaZurQQ="><br />
<settings show="yeiNs/ne1Ks=" tab="OpijtdPvYqQ="></settings><br />
</root><br />
</syntaxhighlight><br />
</section><br />
<br />
<br />
==See Also==<br />
{{XML_functions}}<br />
<br />
[[Category:Useful Functions]]</div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlData&diff=64319XmlData2019-09-13T16:28:36Z<p>Ceeser: </p>
<hr />
<div><pageclass class="resource" subcaption="Resource"></pageclass><br />
<lowercasetitle /><br />
<br />
{| style="background: #F9F9F9; border: 1px solid #AAA; padding: 5px; width: 250px; float:right;"<br />
|-<br />
| colspan="2" style="text-align: center;"|'''xmlData v1.1'''<br />
|-<br />
| colspan="2" align="center" |{{#if: {{{image|}}}|{{{image}}}}}<br />
|-<br />
|'''Status:'''<br />
|Up to date<br />
|-<br />
|'''Latest Release:'''<br />
|13.09.2019<br />
|-<br />
|'''Working on:'''<br />
|MTA v1.5.7<br />
|-<br />
|}<br />
<br />
<br />
== Resource Information ==<br />
This resource let you save and load data in an [[XML]] File.<br><br />
It's an easy to use resource, providing 3 exported functions.<br><br />
<br />
<br />
== Download ==<br />
'''Note: You have to put all the files of the .zip into a folder called "xmlData" and then upload the folder to your server!'''<br><br />
Download can be found at the [https://community.multitheftauto.com/index.php?p=resources&s=details&id=16187 MTA Community Page].<br><br />
Resource developed by: [https://community.multitheftauto.com/index.php?p=profile&id=477820 Ceeser]<br />
<br />
<br />
== Exported functions ==<br />
'''Note: These functions are available for Server and Client'''<br />
* [[XmlSaveData|xmlSaveData]]<br />
* [[xmlLoadData|xmlLoadData]]<br />
* [[xmlDeleteData|xmlDeleteData]]<br />
<br />
<br />
== Security ==<br />
Next to the point of easy access this resource has its focus on security.<br />
You can specify how much protection you want to have for your data:<br />
* '''Server protection''' - With this only the server that has created the file will be able to read/modify/delete it.<br />
* '''Encryption''' - With this the stored data will be encrypted by a generated key, making it unreadable and unmodifyable by humans.<br />
* '''Resource protection''' - With this only the resource that has created the file will be able to read/modify/delete it.<br />
<br />
Note: No matter what settings you use - no server will have access to any file without its specific filename.<br />
<br />
<br />
=== Key generation / Data encryption ===<br />
If you want to save your data encrypted the script will generate a random key and stores it, so that the file can get read again.<br />
If you enable server protection for the file, the key can also only be read by the same server that has generated the data file.<br />
The same also goes for the resource protection.<br />
<br />
<br />
=== Security Levels ===<br />
Instead of manually adding bool parameters to the functions you can also just pass the security level you want to use for each function:<br />
* '''0''' - No protection (any server, any resource or humans could read/modify)<br />
* '''1''' - Very low protection (creator resource on any server or humans could read/modify)<br />
* '''2''' - Very low protection (any resource on any server could read/modify, humans cant)<br />
* '''3''' - Low protection (only creator resource on any server could read/modify, humans cant)<br />
* '''4''' - Medium protection (any resource on the creator server or humans could read/modify) - DEFAULT<br />
* '''5''' - Medium protection (only creator resource on the creator server or humans could read/modify)<br />
* '''6''' - High protection (any resource on the creator server could read/modify, humans cant)<br />
* '''7''' - Very high protection (only creator resource on creator server could read/modify, humans cant.<br />
<br />
<br />
== Simplifying the export ==<br />
For simplifying reasons I recommend the use this shortcut variable to call the exported functions:<br />
<br />
<syntaxhighlight lang="lua"><br />
local xml = exports.xmlData -- Define this variable at the top of your script<br />
<br />
-- And then use it like this for example:<br />
xml:xmlSaveData("yourFileName", yourData)<br />
</syntaxhighlight><br />
<br />
<br />
== Variables and Specified Names ==<br />
In the exported functions are some names which I will explain here to keep the function pages as clean and small as possible.<br />
<br />
=== serverProtected / Creator-Server ===<br />
With '''creator-server''' I mean the server that has created a file.<br />
So if a file is serverProtected only the server that called the function is able to read/modify/delete it.<br><br />
This includes client-side: The function call have been on the client-side of any server, so the link to the server exist anyways.<br />
<br />
=== resourceProtected / Creator-Resource ===<br />
With '''creator-resource''' I mean the resource that has created a file.<br />
Example how it works: If you call xmlSaveData with resourceProtection from resource "login", only "login" will then be able to read that xml file.<br><br />
If you don't use serverProtection in combination to this, every "login" resource on any server COULD read that file if it calls xmlLoadData with the correct file name.<br />
<br />
<br />
== Data type warning ==<br />
'''This resource will save everything, no matter what you give as data input.'''<br><br />
So be sure that there is no userdata stored inside the table you are passing to the xmlSaveData function.<br />
In case you have any kind of userdata it will output warnings in the debugscript - you should fix that by removing all userdata from the input table, because: Any Userdata is temporary. It will change after a script restart, reconnect, server restart.. or even while a resource is running/ you are playing.<br />
<br />
<br />
== See Also ==<br />
{{XML_functions}}<br />
<br />
[[Category:Resource]]</div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlData&diff=64318XmlData2019-09-13T16:25:49Z<p>Ceeser: </p>
<hr />
<div><pageclass class="resource" subcaption="Resource"></pageclass><br />
<lowercasetitle /><br />
<br />
{| style="background: #F9F9F9; border: 1px solid #AAA; padding: 5px; width: 250px; float:right;"<br />
|-<br />
| colspan="2" style="text-align: center;"|'''xmlData v1.1'''<br />
|-<br />
| colspan="2" align="center" |{{#if: {{{image|}}}|{{{image}}}}}<br />
|-<br />
|'''Status:'''<br />
|Up to date<br />
|-<br />
|'''Latest Release:'''<br />
|13.09.2019<br />
|-<br />
|'''Working on:'''<br />
|MTA v1.5.7<br />
|-<br />
|}<br />
<br />
<br />
== Resource Information ==<br />
This resource let you save and load data in an [[XML]] File.<br><br />
It's an easy to use resource, providing 3 exported functions.<br><br />
<br />
<br />
== Download ==<br />
'''Note: You have to put all the files of the .zip into a folder called "xmlData" and then upload the folder to your server!'''<br><br />
Download can be found at the [https://community.multitheftauto.com/index.php?p=resources&s=details&id=16187 MTA Community Page].<br><br />
Resource developed by: [https://community.multitheftauto.com/index.php?p=profile&id=477820 Ceeser]<br />
<br />
<br />
== Exported functions ==<br />
'''Note: These functions are available for Server and Client'''<br />
* [[XmlSaveData|xmlSaveData]]<br />
* [[xmlLoadData|xmlLoadData]]<br />
* [[xmlDeleteData|xmlDeleteData]]<br />
<br />
<br />
== Security ==<br />
Next to the point of easy access this resource has its focus on security.<br />
You can specify how much protection you want to have for your data:<br />
* '''Server protection''' - With this only the server that has created the file will be able to read/modify/delete it.<br />
* '''Encryption''' - With this the stored data will be encrypted by a generated key, making it unreadable and unmodifyable by humans.<br />
* '''Resource protection''' - With this only the resource that has created the file will be able to read/modify/delete it.<br />
<br />
Note: No matter what settings you use - no server will have access to any file without its specific filename.<br />
<br />
<br />
=== Key generation / Data encryption ===<br />
If you want to save your data encrypted the script will generate a random key and stores it, so that the file can get read again.<br />
If you enable server protection for the file, the key can also only be read by the same server that has generated the data file.<br />
The same also goes for the resource protection.<br />
<br />
<br />
=== Security Levels ===<br />
Instead of manually adding bool parameters to the functions you can also just pass the security level you want to use for each function:<br />
* '''0''' - No protection (any server, any resource or humans could read/modify)<br />
* '''1''' - Very low protection (creator resource on any server or humans could read/modify)<br />
* '''2''' - Very low protection (any resource on any server could read/modify, humans cant)<br />
* '''3''' - Low protection (only creator resource on any server could read/modify, humans cant)<br />
* '''4''' - Medium protection (any resource on the creator server or humans could read/modify) - DEFAULT<br />
* '''5''' - Medium protection (only creator resource on the creator server or humans could read/modify)<br />
* '''6''' - High protection (any resource on the creator server could read/modify, humans cant)<br />
* '''7''' - Very high protection (only creator resource on creator server could read/modify, humans cant.<br />
<br />
<br />
== Simplifying the export ==<br />
For simplifying reasons I recommend the use this shortcut variable to call the exported functions:<br />
<br />
<syntaxhighlight lang="lua"><br />
local xml = exports.xmlData -- Define this variable at the top of your script<br />
<br />
-- And then use it like this for example:<br />
xml:xmlSaveData("yourFileName", yourData)<br />
</syntaxhighlight><br />
<br />
<br />
== Variables and Specified Names ==<br />
In the exported functions are some names which I will explain here to keep the function pages as clean and small as possible.<br />
<br />
=== serverProtected / Creator-Server ===<br />
With '''creator-server''' I mean the server that has created a file.<br />
So if a file is serverProtected only the server that called the function is able to read/modify/delete it.<br><br />
This includes client-side: The function call have been on the client-side of any server, so the link to the server exist anyways.<br />
<br />
=== resourceProtected / Creator-Resource ===<br />
With '''creator-resource''' I mean the resource that has created a file.<br />
Example how it works: If you call xmlSaveData with resourceProtection from resource "login", only "login" will then be able to read that xml file.<br><br />
If you don't use serverProtection in combination to this, every "login" resource on any server COULD read that file if it calls xmlLoadData with the correct file name.<br />
<br />
<br />
== Data type warning ==<br />
'''This resource will save everything, no matter what you give as data input.'''<br><br />
So be sure that there is no userdata stored inside the table you are passing to the xmlSaveData function.<br />
In case you have any kind of userdata it will output warnings in the debugscript - you should fix that by removing all userdata from the input table, because: Any Userdata is temporary. It will change after a script restart, reconnect, server restart.. or even while a resource is running/ you are playing.<br />
<br />
<br />
== See Also ==<br />
{{XML_functions}}<br />
<br />
*[[xmlSaveData]]<br />
*[[xmlLoadData]]<br />
*[[xmlDeleteData]]<br />
<br />
[[Category:Resource]]</div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlDeleteData&diff=64317XmlDeleteData2019-09-13T16:25:17Z<p>Ceeser: </p>
<hr />
<div><pageclass class="#228B22" subcaption="Useful Function - Shared"></pageclass><br />
<lowercasetitle></lowercasetitle><br />
<br />
__NOTOC__<br />
<br />
{{Important Note|<br />
This is an unofficial MTA function, so its not included into the game by default.<br><br />
Its an exported function of the [[xmlData]] resource.<br><br />
To access this function you need to have the resource running on your server.}}<br />
<br />
<br />
This function provides a way of deleting a [[XML]] file created by [[xmlSaveData]] <br><br />
To call it, see the [[call]] function or the tip in this resources page: [https://wiki.multitheftauto.com/wiki/XmlData#Simplifying_the_export Simplifying the export]<br />
<br />
<br />
= Info =<br />
'''For proper deletion you need to pass the same booleans / securityLevel as you did on xmlSaveData.'''<br><br />
'''If you called [[xmlSaveData]] with passing the securityLevel its recommended to pick securityLevel as function paremeter for the deletion as well.'''<br />
<br />
<br />
= Syntax =<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlDeleteData ( string fileName [, bool serverProtected = true, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlDeleteData ( string fileName [, int securityLevel = 4 ] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to delete.<br />
<br />
====Optional Arguments====<br />
*'''serverProtected:''' If set to ''true'' it can only delete the file of the creator-server, otherwise it doesn't care which server created it.<br />
*'''resourceProtected:''' If set to ''true'' it can only delete the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which your data is stored at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns ''true'' if successful, ''false'' and a debug output in case if failure.<br />
<br />
'''Note: There is no encryption parameter in this function, because xmlDeleteData will auto-search for and delete the key of encrypted files.'''<br />
</section><br />
<br />
<section name="Server" class="server" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlDeleteData ( string fileName [, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlDeleteData ( string fileName [, int securityLevel = 4 ] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to delete.<br />
<br />
====Optional Arguments====<br />
*'''resourceProtected:''' If set to ''true'' it can only delete the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which your data is stored at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns ''true'' if successful, ''false'' and a debug output in case if failure.<br />
<br />
'''Note: There is no encryption parameter in this function, because xmlDeleteData will auto-search for and delete the key of encrypted files.'''<br />
'''Note2: There is no serverProtected parameter, because its server-side already anyways.<br />
</section><br />
<br />
<br />
== Example ==<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
-- Lets assume we have created a resourceProtected-only file called "settings" already.<br />
local xml = exports.xmlData<br />
xml:xmlDeleteData("settings", false, true) -- not serverProtected, but resourceProtected<br />
-- OR<br />
xml:xmlDeleteData("settings", 1) -- securityLevel 1 equals not serverProtected, unencrypted, but resouceProtected - the encryption bool will be ignored at xmlDeleteData<br />
</syntaxhighlight><br />
</section><br />
<br />
<br />
==See Also==<br />
{{XML_functions}}<br />
<br />
*[[xmlData]]<br />
*[[xmlSaveData]]<br />
*[[xmlLoadData]]<br />
<br />
[[Category:Useful Functions]]</div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlData&diff=64313XmlData2019-09-13T13:30:59Z<p>Ceeser: </p>
<hr />
<div><pageclass class="resource" subcaption="Resource"></pageclass><br />
<lowercasetitle /><br />
<br />
{| style="background: #F9F9F9; border: 1px solid #AAA; padding: 5px; width: 250px; float:right;"<br />
|-<br />
| colspan="2" style="text-align: center;"|'''xmlData v1.1'''<br />
|-<br />
| colspan="2" align="center" |{{#if: {{{image|}}}|{{{image}}}}}<br />
|-<br />
|'''Status:'''<br />
|Up to date<br />
|-<br />
|'''Latest Release:'''<br />
|13.09.2019<br />
|-<br />
|'''Working on:'''<br />
|MTA v1.5.7<br />
|-<br />
|}<br />
<br />
<br />
== Resource Information ==<br />
This resource let you save and load data in an [[XML]] File.<br><br />
It's an easy to use resource, providing 3 exported functions.<br><br />
<br />
<br />
== Download ==<br />
'''Note: You have to put all the files of the .zip into a folder called "xmlData" and then upload the folder to your server!'''<br><br />
Download can be found at the [https://community.multitheftauto.com/index.php?p=resources&s=details&id=16187 MTA Community Page].<br><br />
Resource developed by: [https://community.multitheftauto.com/index.php?p=profile&id=477820 Ceeser]<br />
<br />
<br />
== Exported functions ==<br />
'''Note: These functions are available for Server and Client'''<br />
* [[XmlSaveData|xmlSaveData]]<br />
* [[xmlLoadData|xmlLoadData]]<br />
* [[xmlDeleteData|xmlDeleteData]]<br />
<br />
<br />
== Security ==<br />
Next to the point of easy access this resource has its focus on security.<br />
You can specify how much protection you want to have for your data:<br />
* '''Server protection''' - With this only the server that has created the file will be able to read/modify/delete it.<br />
* '''Encryption''' - With this the stored data will be encrypted by a generated key, making it unreadable and unmodifyable by humans.<br />
* '''Resource protection''' - With this only the resource that has created the file will be able to read/modify/delete it.<br />
<br />
Note: No matter what settings you use - no server will have access to any file without its specific filename.<br />
<br />
<br />
=== Key generation / Data encryption ===<br />
If you want to save your data encrypted the script will generate a random key and stores it, so that the file can get read again.<br />
If you enable server protection for the file, the key can also only be read by the same server that has generated the data file.<br />
The same also goes for the resource protection.<br />
<br />
<br />
=== Security Levels ===<br />
Instead of manually adding bool parameters to the functions you can also just pass the security level you want to use for each function:<br />
* '''0''' - No protection (any server, any resource or humans could read/modify)<br />
* '''1''' - Very low protection (creator resource on any server or humans could read/modify)<br />
* '''2''' - Very low protection (any resource on any server could read/modify, humans cant)<br />
* '''3''' - Low protection (only creator resource on any server could read/modify, humans cant)<br />
* '''4''' - Medium protection (any resource on the creator server or humans could read/modify) - DEFAULT<br />
* '''5''' - Medium protection (only creator resource on the creator server or humans could read/modify)<br />
* '''6''' - High protection (any resource on the creator server could read/modify, humans cant)<br />
* '''7''' - Very high protection (only creator resource on creator server could read/modify, humans cant.<br />
<br />
<br />
== Simplifying the export ==<br />
For simplifying reasons I recommend the use this shortcut variable to call the exported functions:<br />
<br />
<syntaxhighlight lang="lua"><br />
local xml = exports.xmlData -- Define this variable at the top of your script<br />
<br />
-- And then use it like this for example:<br />
xml:xmlSaveData("yourFileName", yourData)<br />
</syntaxhighlight><br />
<br />
<br />
== Variables and Specified Names ==<br />
In the exported functions are some names which I will explain here to keep the function pages as clean and small as possible.<br />
<br />
=== serverProtected / Creator-Server ===<br />
With '''creator-server''' I mean the server that has created a file.<br />
So if a file is serverProtected only the server that called the function is able to read/modify/delete it.<br><br />
This includes client-side: The function call have been on the client-side of any server, so the link to the server exist anyways.<br />
<br />
=== resourceProtected / Creator-Resource ===<br />
With '''creator-resource''' I mean the resource that has created a file.<br />
Example how it works: If you call xmlSaveData with resourceProtection from resource "login", only "login" will then be able to read that xml file.<br><br />
If you don't use serverProtection in combination to this, every "login" resource on any server COULD read that file if it calls xmlLoadData with the correct file name.<br />
<br />
<br />
== Data type warning ==<br />
'''This resource will save everything, no matter what you give as data input.'''<br><br />
So be sure that there is no userdata stored inside the table you are passing to the xmlSaveData function.<br />
In case you have any kind of userdata it will output warnings in the debugscript - you should fix that by removing all userdata from the input table, because: Any Userdata is temporary. It will change after a script restart, reconnect, server restart.. or even while a resource is running/ you are playing.<br />
<br />
<br />
[[Category:Resource]]</div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlData&diff=64312XmlData2019-09-13T13:30:37Z<p>Ceeser: </p>
<hr />
<div><pageclass class="resource" subcaption="Resource"></pageclass><br />
<lowercasetitle /><br />
<br />
{| style="background: #F9F9F9; border: 1px solid #AAA; padding: 5px; width: 250px; float:right;"<br />
|-<br />
| colspan="2" style="text-align: center;"|'''xmlData v1.1'''<br />
|-<br />
| colspan="2" align="center" |{{#if: {{{image|}}}|{{{image}}}}}<br />
|-<br />
|'''Status:'''<br />
|Up to date<br />
|-<br />
|'''Latest Release:'''<br />
|13.09.2019<br />
|-<br />
|'''Working on:'''<br />
|MTA v1.5.7<br />
|-<br />
|}<br />
<br />
<br />
== Resource Information ==<br />
This resource let you save and load data in an [[XML]] File.<br><br />
It's an easy to use resource, providing 3 exported functions.<br><br />
<br />
<br />
== Download ==<br />
'''Note: You have to put all the files of the .zip into a folder called "xmlData" and then upload the folder to your server!'''<br />
Download can be found at the [https://community.multitheftauto.com/index.php?p=resources&s=details&id=16187 MTA Community Page].<br><br />
Resource developed by: [https://community.multitheftauto.com/index.php?p=profile&id=477820 Ceeser]<br />
<br />
<br />
== Exported functions ==<br />
'''Note: These functions are available for Server and Client'''<br />
* [[XmlSaveData|xmlSaveData]]<br />
* [[xmlLoadData|xmlLoadData]]<br />
* [[xmlDeleteData|xmlDeleteData]]<br />
<br />
<br />
== Security ==<br />
Next to the point of easy access this resource has its focus on security.<br />
You can specify how much protection you want to have for your data:<br />
* '''Server protection''' - With this only the server that has created the file will be able to read/modify/delete it.<br />
* '''Encryption''' - With this the stored data will be encrypted by a generated key, making it unreadable and unmodifyable by humans.<br />
* '''Resource protection''' - With this only the resource that has created the file will be able to read/modify/delete it.<br />
<br />
Note: No matter what settings you use - no server will have access to any file without its specific filename.<br />
<br />
<br />
=== Key generation / Data encryption ===<br />
If you want to save your data encrypted the script will generate a random key and stores it, so that the file can get read again.<br />
If you enable server protection for the file, the key can also only be read by the same server that has generated the data file.<br />
The same also goes for the resource protection.<br />
<br />
<br />
=== Security Levels ===<br />
Instead of manually adding bool parameters to the functions you can also just pass the security level you want to use for each function:<br />
* '''0''' - No protection (any server, any resource or humans could read/modify)<br />
* '''1''' - Very low protection (creator resource on any server or humans could read/modify)<br />
* '''2''' - Very low protection (any resource on any server could read/modify, humans cant)<br />
* '''3''' - Low protection (only creator resource on any server could read/modify, humans cant)<br />
* '''4''' - Medium protection (any resource on the creator server or humans could read/modify) - DEFAULT<br />
* '''5''' - Medium protection (only creator resource on the creator server or humans could read/modify)<br />
* '''6''' - High protection (any resource on the creator server could read/modify, humans cant)<br />
* '''7''' - Very high protection (only creator resource on creator server could read/modify, humans cant.<br />
<br />
<br />
== Simplifying the export ==<br />
For simplifying reasons I recommend the use this shortcut variable to call the exported functions:<br />
<br />
<syntaxhighlight lang="lua"><br />
local xml = exports.xmlData -- Define this variable at the top of your script<br />
<br />
-- And then use it like this for example:<br />
xml:xmlSaveData("yourFileName", yourData)<br />
</syntaxhighlight><br />
<br />
<br />
== Variables and Specified Names ==<br />
In the exported functions are some names which I will explain here to keep the function pages as clean and small as possible.<br />
<br />
=== serverProtected / Creator-Server ===<br />
With '''creator-server''' I mean the server that has created a file.<br />
So if a file is serverProtected only the server that called the function is able to read/modify/delete it.<br><br />
This includes client-side: The function call have been on the client-side of any server, so the link to the server exist anyways.<br />
<br />
=== resourceProtected / Creator-Resource ===<br />
With '''creator-resource''' I mean the resource that has created a file.<br />
Example how it works: If you call xmlSaveData with resourceProtection from resource "login", only "login" will then be able to read that xml file.<br><br />
If you don't use serverProtection in combination to this, every "login" resource on any server COULD read that file if it calls xmlLoadData with the correct file name.<br />
<br />
<br />
== Data type warning ==<br />
'''This resource will save everything, no matter what you give as data input.'''<br><br />
So be sure that there is no userdata stored inside the table you are passing to the xmlSaveData function.<br />
In case you have any kind of userdata it will output warnings in the debugscript - you should fix that by removing all userdata from the input table, because: Any Userdata is temporary. It will change after a script restart, reconnect, server restart.. or even while a resource is running/ you are playing.<br />
<br />
<br />
[[Category:Resource]]</div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlData&diff=64310XmlData2019-09-13T12:51:38Z<p>Ceeser: Added resource download</p>
<hr />
<div><pageclass class="resource" subcaption="Resource"></pageclass><br />
<lowercasetitle /><br />
<br />
{| style="background: #F9F9F9; border: 1px solid #AAA; padding: 5px; width: 250px; float:right;"<br />
|-<br />
| colspan="2" style="text-align: center;"|'''xmlData v1.0'''<br />
|-<br />
| colspan="2" align="center" |{{#if: {{{image|}}}|{{{image}}}}}<br />
|-<br />
|'''Status:'''<br />
|Up to date<br />
|-<br />
|'''Latest Release:'''<br />
|13.09.2019<br />
|-<br />
|'''Working on:'''<br />
|MTA v1.5.7<br />
|-<br />
|}<br />
<br />
<br />
== Resource Information ==<br />
This resource let you save and load data in an [[XML]] File.<br><br />
It's an easy to use resource, providing 3 exported functions.<br><br />
<br />
<br />
== Download ==<br />
Download can be found at the [https://community.multitheftauto.com/index.php?p=resources&s=details&id=16187 MTA Community Page].<br><br />
Resource developed by: [https://community.multitheftauto.com/index.php?p=profile&id=477820 Ceeser]<br />
<br />
<br />
== Exported functions ==<br />
'''Note: These functions are available for Server and Client'''<br />
* [[XmlSaveData|xmlSaveData]]<br />
* [[xmlLoadData|xmlLoadData]]<br />
* [[xmlDeleteData|xmlDeleteData]]<br />
<br />
<br />
== Security ==<br />
Next to the point of easy access this resource has its focus on security.<br />
You can specify how much protection you want to have for your data:<br />
* '''Server protection''' - With this only the server that has created the file will be able to read/modify/delete it.<br />
* '''Encryption''' - With this the stored data will be encrypted by a generated key, making it unreadable and unmodifyable by humans.<br />
* '''Resource protection''' - With this only the resource that has created the file will be able to read/modify/delete it.<br />
<br />
Note: No matter what settings you use - no server will have access to any file without its specific filename.<br />
<br />
<br />
=== Key generation / Data encryption ===<br />
If you want to save your data encrypted the script will generate a random key and stores it, so that the file can get read again.<br />
If you enable server protection for the file, the key can also only be read by the same server that has generated the data file.<br />
The same also goes for the resource protection.<br />
<br />
<br />
=== Security Levels ===<br />
Instead of manually adding bool parameters to the functions you can also just pass the security level you want to use for each function:<br />
* '''0''' - No protection (any server, any resource or humans could read/modify)<br />
* '''1''' - Very low protection (creator resource on any server or humans could read/modify)<br />
* '''2''' - Very low protection (any resource on any server could read/modify, humans cant)<br />
* '''3''' - Low protection (only creator resource on any server could read/modify, humans cant)<br />
* '''4''' - Medium protection (any resource on the creator server or humans could read/modify) - DEFAULT<br />
* '''5''' - Medium protection (only creator resource on the creator server or humans could read/modify)<br />
* '''6''' - High protection (any resource on the creator server could read/modify, humans cant)<br />
* '''7''' - Very high protection (only creator resource on creator server could read/modify, humans cant.<br />
<br />
<br />
== Simplifying the export ==<br />
For simplifying reasons I recommend the use this shortcut variable to call the exported functions:<br />
<br />
<syntaxhighlight lang="lua"><br />
local xml = exports.xmlData -- Define this variable at the top of your script<br />
<br />
-- And then use it like this for example:<br />
xml:xmlSaveData("yourFileName", yourData)<br />
</syntaxhighlight><br />
<br />
<br />
== Variables and Specified Names ==<br />
In the exported functions are some names which I will explain here to keep the function pages as clean and small as possible.<br />
<br />
=== serverProtected / Creator-Server ===<br />
With '''creator-server''' I mean the server that has created a file.<br />
So if a file is serverProtected only the server that called the function is able to read/modify/delete it.<br><br />
This includes client-side: The function call have been on the client-side of any server, so the link to the server exist anyways.<br />
<br />
=== resourceProtected / Creator-Resource ===<br />
With '''creator-resource''' I mean the resource that has created a file.<br />
Example how it works: If you call xmlSaveData with resourceProtection from resource "login", only "login" will then be able to read that xml file.<br><br />
If you don't use serverProtection in combination to this, every "login" resource on any server COULD read that file if it calls xmlLoadData with the correct file name.<br />
<br />
<br />
== Data type warning ==<br />
'''This resource will save everything, no matter what you give as data input.'''<br><br />
So be sure that there is no userdata stored inside the table you are passing to the xmlSaveData function.<br />
In case you have any kind of userdata it will output warnings in the debugscript - you should fix that by removing all userdata from the input table, because: Any Userdata is temporary. It will change after a script restart, reconnect, server restart.. or even while a resource is running/ you are playing.<br />
<br />
<br />
[[Category:Resource]]</div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlData&diff=64309XmlData2019-09-13T12:37:54Z<p>Ceeser: </p>
<hr />
<div><pageclass class="resource" subcaption="Resource"></pageclass><br />
<lowercasetitle /><br />
<br />
{| style="background: #F9F9F9; border: 1px solid #AAA; padding: 5px; width: 250px; float:right;"<br />
|-<br />
| colspan="2" style="text-align: center;"|'''xmlData v1.0'''<br />
|-<br />
| colspan="2" align="center" |{{#if: {{{image|}}}|{{{image}}}}}<br />
|-<br />
|'''Status:'''<br />
|Up to date<br />
|-<br />
|'''Latest Release:'''<br />
|13.09.2019<br />
|-<br />
|'''Working on:'''<br />
|MTA v1.5.7<br />
|-<br />
|}<br />
<br />
<br />
== Resource Information ==<br />
This resource let you save and load data in an [[XML]] File.<br><br />
It's an easy to use resource, providing 3 exported functions.<br><br />
<br />
<br />
== Download ==<br />
Download can be found at the [https://community.multitheftauto.com/ MTA community page -- LINK FOLLOWS].<br><br />
Resource developed by: [https://community.multitheftauto.com/index.php?p=profile&id=477820 Ceeser]<br />
<br />
<br />
== Exported functions ==<br />
'''Note: These functions are available for Server and Client'''<br />
* [[XmlSaveData|xmlSaveData]]<br />
* [[xmlLoadData|xmlLoadData]]<br />
* [[xmlDeleteData|xmlDeleteData]]<br />
<br />
<br />
== Security ==<br />
Next to the point of easy access this resource has its focus on security.<br />
You can specify how much protection you want to have for your data:<br />
* '''Server protection''' - With this only the server that has created the file will be able to read/modify/delete it.<br />
* '''Encryption''' - With this the stored data will be encrypted by a generated key, making it unreadable and unmodifyable by humans.<br />
* '''Resource protection''' - With this only the resource that has created the file will be able to read/modify/delete it.<br />
<br />
Note: No matter what settings you use - no server will have access to any file without its specific filename.<br />
<br />
<br />
=== Key generation / Data encryption ===<br />
If you want to save your data encrypted the script will generate a random key and stores it, so that the file can get read again.<br />
If you enable server protection for the file, the key can also only be read by the same server that has generated the data file.<br />
The same also goes for the resource protection.<br />
<br />
<br />
=== Security Levels ===<br />
Instead of manually adding bool parameters to the functions you can also just pass the security level you want to use for each function:<br />
* '''0''' - No protection (any server, any resource or humans could read/modify)<br />
* '''1''' - Very low protection (creator resource on any server or humans could read/modify)<br />
* '''2''' - Very low protection (any resource on any server could read/modify, humans cant)<br />
* '''3''' - Low protection (only creator resource on any server could read/modify, humans cant)<br />
* '''4''' - Medium protection (any resource on the creator server or humans could read/modify) - DEFAULT<br />
* '''5''' - Medium protection (only creator resource on the creator server or humans could read/modify)<br />
* '''6''' - High protection (any resource on the creator server could read/modify, humans cant)<br />
* '''7''' - Very high protection (only creator resource on creator server could read/modify, humans cant.<br />
<br />
<br />
== Simplifying the export ==<br />
For simplifying reasons I recommend the use this shortcut variable to call the exported functions:<br />
<br />
<syntaxhighlight lang="lua"><br />
local xml = exports.xmlData -- Define this variable at the top of your script<br />
<br />
-- And then use it like this for example:<br />
xml:xmlSaveData("yourFileName", yourData)<br />
</syntaxhighlight><br />
<br />
<br />
== Variables and Specified Names ==<br />
In the exported functions are some names which I will explain here to keep the function pages as clean and small as possible.<br />
<br />
=== serverProtected / Creator-Server ===<br />
With '''creator-server''' I mean the server that has created a file.<br />
So if a file is serverProtected only the server that called the function is able to read/modify/delete it.<br><br />
This includes client-side: The function call have been on the client-side of any server, so the link to the server exist anyways.<br />
<br />
=== resourceProtected / Creator-Resource ===<br />
With '''creator-resource''' I mean the resource that has created a file.<br />
Example how it works: If you call xmlSaveData with resourceProtection from resource "login", only "login" will then be able to read that xml file.<br><br />
If you don't use serverProtection in combination to this, every "login" resource on any server COULD read that file if it calls xmlLoadData with the correct file name.<br />
<br />
<br />
== Data type warning ==<br />
'''This resource will save everything, no matter what you give as data input.'''<br><br />
So be sure that there is no userdata stored inside the table you are passing to the xmlSaveData function.<br />
In case you have any kind of userdata it will output warnings in the debugscript - you should fix that by removing all userdata from the input table, because: Any Userdata is temporary. It will change after a script restart, reconnect, server restart.. or even while a resource is running/ you are playing.<br />
<br />
<br />
[[Category:Resource]]</div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlData&diff=64308XmlData2019-09-13T11:37:43Z<p>Ceeser: </p>
<hr />
<div><pageclass class="resource" subcaption="Resource"></pageclass><br />
<lowercasetitle /><br />
<br />
== INFO ==<br />
'''The documentation about this resource and its functions is not complete yet and will be continued (12.09.19)'''<br />
<br />
<br />
== Resource Information ==<br />
This resource let you save and load data in an [[XML]] File.<br><br />
It's an easy to use resource, providing 3 exported functions.<br><br />
<br />
<br />
== Download ==<br />
Download can be found at the [https://community.multitheftauto.com/ MTA community page -- LINK FOLLOWS].<br><br />
Resource developed by: [https://community.multitheftauto.com/index.php?p=profile&id=477820 Ceeser]<br />
<br />
<br />
== Exported functions ==<br />
'''Note: These functions are available for Server and Client'''<br />
* [[XmlSaveData|xmlSaveData]]<br />
* [[xmlLoadData|xmlLoadData]]<br />
* [[xmlDeleteData|xmlDeleteData]]<br />
<br />
<br />
== Security ==<br />
Next to the point of easy access this resource has its focus on security.<br />
You can specify how much protection you want to have for your data:<br />
* '''Server protection''' - With this only the server that has created the file will be able to read/modify/delete it.<br />
* '''Encryption''' - With this the stored data will be encrypted by a generated key, making it unreadable and unmodifyable by humans.<br />
* '''Resource protection''' - With this only the resource that has created the file will be able to read/modify/delete it.<br />
<br />
Note: No matter what settings you use - no server will have access to any file without its specific filename.<br />
<br />
<br />
=== Key generation / Data encryption ===<br />
If you want to save your data encrypted the script will generate a random key and stores it, so that the file can get read again.<br />
If you enable server protection for the file, the key can also only be read by the same server that has generated the data file.<br />
The same also goes for the resource protection.<br />
<br />
<br />
=== Security Levels ===<br />
Instead of manually adding bool parameters to the functions you can also just pass the security level you want to use for each function:<br />
* '''0''' - No protection (any server, any resource or humans could read/modify)<br />
* '''1''' - Very low protection (creator resource on any server or humans could read/modify)<br />
* '''2''' - Very low protection (any resource on any server could read/modify, humans cant)<br />
* '''3''' - Low protection (only creator resource on any server could read/modify, humans cant)<br />
* '''4''' - Medium protection (any resource on the creator server or humans could read/modify) - DEFAULT<br />
* '''5''' - Medium protection (only creator resource on the creator server or humans could read/modify)<br />
* '''6''' - High protection (any resource on the creator server could read/modify, humans cant)<br />
* '''7''' - Very high protection (only creator resource on creator server could read/modify, humans cant.<br />
<br />
<br />
== Simplifying the export ==<br />
For simplifying reasons I recommend the use this shortcut variable to call the exported functions:<br />
<br />
<syntaxhighlight lang="lua"><br />
local xml = exports.xmlData -- Define this variable at the top of your script<br />
<br />
-- And then use it like this for example:<br />
xml:xmlSaveData("yourFileName", yourData)<br />
</syntaxhighlight><br />
<br />
<br />
== Variables and Specified Names ==<br />
In the exported functions are some names which I will explain here to keep the function pages as clean and small as possible.<br />
<br />
=== serverProtected / Creator-Server ===<br />
With '''creator-server''' I mean the server that has created a file.<br />
So if a file is serverProtected only the server that called the function is able to read/modify/delete it.<br><br />
This includes client-side: The function call have been on the client-side of any server, so the link to the server exist anyways.<br />
<br />
=== resourceProtected / Creator-Resource ===<br />
With '''creator-resource''' I mean the resource that has created a file.<br />
Example how it works: If you call xmlSaveData with resourceProtection from resource "login", only "login" will then be able to read that xml file.<br><br />
If you don't use serverProtection in combination to this, every "login" resource on any server COULD read that file if it calls xmlLoadData with the correct file name.<br />
<br />
<br />
== Data type warning ==<br />
'''This resource will save everything, no matter what you give as data input.'''<br><br />
So be sure that there is no userdata stored inside the table you are passing to the xmlSaveData function.<br />
In case you have any kind of userdata it will output warnings in the debugscript - you should fix that by removing all userdata from the input table, because: Any Userdata is temporary. It will change after a script restart, reconnect, server restart.. or even while a resource is running/ you are playing.<br />
<br />
<br />
[[Category:Resource]]</div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlDeleteData&diff=64307XmlDeleteData2019-09-13T11:37:17Z<p>Ceeser: Added xmlDeleteData</p>
<hr />
<div><pageclass class="#228B22" subcaption="Useful Function - Shared"></pageclass><br />
<lowercasetitle></lowercasetitle><br />
<br />
__NOTOC__<br />
<br />
{{Important Note|<br />
This is an unofficial MTA function, so its not included into the game by default.<br><br />
Its an exported function of the [[xmlData]] resource.<br><br />
To access this function you need to have the resource running on your server.}}<br />
<br />
<br />
This function provides a way of deleting a [[XML]] file created by [[xmlSaveData]] <br><br />
To call it, see the [[call]] function or the tip in this resources page: [https://wiki.multitheftauto.com/wiki/XmlData#Simplifying_the_export Simplifying the export]<br />
<br />
<br />
= Info =<br />
'''For proper deletion you need to pass the same booleans / securityLevel as you did on xmlSaveData.'''<br><br />
'''If you called [[xmlSaveData]] with passing the securityLevel its recommended to pick securityLevel as function paremeter for the deletion as well.'''<br />
<br />
<br />
= Syntax =<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlDeleteData ( string fileName [, bool serverProtected = true, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlDeleteData ( string fileName [, int securityLevel = 4 ] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to delete.<br />
<br />
====Optional Arguments====<br />
*'''serverProtected:''' If set to ''true'' it can only delete the file of the creator-server, otherwise it doesn't care which server created it.<br />
*'''resourceProtected:''' If set to ''true'' it can only delete the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which your data is stored at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns ''true'' if successful, ''false'' and a debug output in case if failure.<br />
<br />
'''Note: There is no encryption parameter in this function, because xmlDeleteData will auto-search for and delete the key of encrypted files.'''<br />
</section><br />
<br />
<section name="Server" class="server" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlDeleteData ( string fileName [, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlDeleteData ( string fileName [, int securityLevel = 4 ] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to delete.<br />
<br />
====Optional Arguments====<br />
*'''resourceProtected:''' If set to ''true'' it can only delete the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which your data is stored at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns ''true'' if successful, ''false'' and a debug output in case if failure.<br />
<br />
'''Note: There is no encryption parameter in this function, because xmlDeleteData will auto-search for and delete the key of encrypted files.'''<br />
'''Note2: There is no serverProtected parameter, because its server-side already anyways.<br />
</section><br />
<br />
<br />
== Example ==<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
-- Lets assume we have created a resourceProtected-only file called "settings" already.<br />
local xml = exports.xmlData<br />
xml:xmlDeleteData("settings", false, true) -- not serverProtected, but resourceProtected<br />
-- OR<br />
xml:xmlDeleteData("settings", 1) -- securityLevel 1 equals not serverProtected, unencrypted, but resouceProtected - the encryption bool will be ignored at xmlDeleteData<br />
</syntaxhighlight><br />
</section><br />
<br />
<br />
==See Also==<br />
{{XML_functions}}<br />
<br />
*[[xmlData]]<br />
*[[xmlSaveData]]<br />
*[[xmlDeleteData]]<br />
<br />
[[Category:Useful Functions]]</div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlSaveData&diff=64306XmlSaveData2019-09-12T19:07:44Z<p>Ceeser: </p>
<hr />
<div><pageclass class="#228B22" subcaption="Useful Function - Shared"></pageclass><br />
<lowercasetitle></lowercasetitle><br />
<br />
__NOTOC__<br />
<br />
{{Important Note|<br />
This is an unofficial MTA function, so its not included into the game by default.<br><br />
Its an exported function of the [[xmlData]] resource.<br><br />
To access this function you need to have the resource running on your server.}}<br />
<br />
<br />
This function provides an automated way of loading your data from an [[XML]] file created by [[xmlSaveData]] <br><br />
To call it, see the [[call]] function or the tip in this resources page: [https://wiki.multitheftauto.com/wiki/XmlData#Simplifying_the_export Simplifying the export]<br />
<br />
<br />
= Syntax =<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, bool serverProtected = true, bool encryptData = false, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to create<br />
*'''data:''' The data you want to save (must be a table!)<br />
<br />
====Optional Arguments====<br />
*'''serverProtected:''' If set to ''true'' the script will protect the file so, that can only the creator server can access it.'''<br />
*'''encryptData:''' If set to ''true'' the script will generate a random key and use it to encrypt your stored data. '''Note: If you want to store "sensitive data", always use encryption!'''<br />
*'''resourceProtected:''' If set to ''true'' the script will add the sourceResource name (so the name of the resource from which it got called) to the fileName, preventing it from getting read/overwritten/deleted by any other resource. If set to ''false'' you can use this script to call/send/modify tables from different resources without the use of events/other export functions.<br />
or<br />
*'''securityLevel:''' The level of security on which you want to store your data at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns ''true'' if successful, ''false'' otherwise.<br />
</section><br />
<br />
<section name="Server" class="server" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, bool encryptData = false, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to create<br />
*'''data:''' The data you want to save (must be a table!)<br />
<br />
====Optional Arguments====<br />
*'''encryptData:''' If set to ''true'' the script will generate a random key and use it to encrypt your stored data. '''Note: If you want to store "sensitive data", always use encryption! (Account data should never be stored in serverside files - use a database instead!)'''<br />
*'''resourceProtected:''' If set to ''true'' the script will add the sourceResource name (so the name of the resource from which it got called) to the fileName, preventing it from getting read/overwritten/deleted by any other resource. If set to ''false'' you can use this script to call/send/modify tables from different resources without the use of events/other export functions.<br />
or<br />
*'''securityLevel:''' The level of security on which you want to store your data at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns ''true'' if successful, ''false'' otherwise.<br />
</section><br />
<br />
<br />
== Example ==<br />
<section name="Client" class="client" show="true"><br />
This is the script where we specify the export shortcut and the data table which we want to store.<br />
<syntaxhighlight lang="lua"><br />
local xml = exports.xmlData<br />
local tblScriptSettings = {posX = 800, posY = 500, sizeX = 500, sizeY = 300, settings = {show = true, tab = 1}}<br />
<br />
xml:xmlSaveData("myFileName", tblScriptSettings , true, true) -- Save the data as "myFileName"<br />
</syntaxhighlight><br />
<br />
This will create a server-protected, encrypted file on the clients computer called "myFileName.xml". Also it will generate a random generated key and stores it.<br><br />
The created file will -(could, because encrypted with a random key)- like this:<br />
<br />
<syntaxhighlight lang="xml"><br />
<root posY="VgEN0+TERhg=" posX="mjX4Tj5u6oM=" sizeX="VgEN0+TERhg=" sizeY="htgOMaZurQQ="><br />
<settings show="yeiNs/ne1Ks=" tab="OpijtdPvYqQ="></settings><br />
</root><br />
</syntaxhighlight><br />
</section><br />
<br />
<br />
==See Also==<br />
{{XML_functions}}<br />
<br />
*[[xmlData]]<br />
*[[xmlLoadData]]<br />
*[[xmlDeleteData]]<br />
<br />
[[Category:Useful Functions]]</div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlLoadData&diff=64305XmlLoadData2019-09-12T19:07:26Z<p>Ceeser: </p>
<hr />
<div><pageclass class="#228B22" subcaption="Useful Function - Shared"></pageclass><br />
<lowercasetitle></lowercasetitle><br />
<br />
__NOTOC__<br />
<br />
{{Important Note|<br />
This is an unofficial MTA function, so its not included into the game by default.<br><br />
Its an exported function of the [[xmlData]] resource.<br><br />
To access this function you need to have the resource running on your server.}}<br />
<br />
<br />
This function provides an automated way of loading your data from an [[XML]] file created by [[xmlSaveData]] <br><br />
To call it, see the [[call]] function or the tip in this resources page: [https://wiki.multitheftauto.com/wiki/XmlData#Simplifying_the_export Simplifying the export]<br />
<br />
<br />
= Info =<br />
'''For proper data loading you need to pass the same booleans / securityLevel as you did on xmlSaveData.'''<br><br />
'''If you called [[xmlSaveData]] with passing the securityLevel its recommended to pick securityLevel as function paremeter for the loading as well.'''<br />
<br />
<br />
= Syntax =<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, bool serverProtected = true, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, int securityLevel = 4 ] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to load.<br />
<br />
====Optional Arguments====<br />
*'''serverProtected:''' If set to ''true'' it can only read the file of the creator-server, otherwise it doesn't care which server created it.<br />
*'''resourceProtected:''' If set to ''true'' it can only read the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which your data is stored at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns a ''table'' containing the files data, an empty ''table'' if there is no data stored inside the file, ''false'' and debug output in case if failure.<br />
<br />
'''Note: There is no encryption parameter in this function, because xmlLoadData will load and use a files key if it is encrypted.'''<br />
</section><br />
<br />
<section name="Server" class="server" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to load.<br />
<br />
====Optional Arguments====<br />
*'''resourceProtected:''' If set to ''true'' it can only read the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which your data is stored at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns a ''table'' containing the files data, an empty ''table'' if there is no data stored inside the file, ''false'' and debug output in case if failure.<br />
<br />
'''Note1: There is no encryption parameter, because xmlLoadData will load and use a files key if it is encrypted.'''<br><br />
'''Note2: There is no serverProtected parameter, because its server-side already anyways.<br />
</section><br />
<br />
<br />
== Example ==<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
-- Lets assume we created a encrypted, serverProtected file called "settings" already.<br />
local xml = exports.xmlData<br />
local tblSettings = xml:xmlLoadData("settings" true) -- serverProtected is true, resourceProtected false - false doesnt need to get passed here<br />
-- OR you can do this:<br />
local tblSettings = xml:xmlLoadData("settings" 6) -- securityLevel 6 equals serverProtected, encrypted, not resouceProtected - the encryption bool will be ignored at xmlLoadData<br />
</syntaxhighlight><br />
</section><br />
<br />
<br />
==See Also==<br />
{{XML_functions}}<br />
<br />
*[[xmlData]]<br />
*[[xmlSaveData]]<br />
*[[xmlDeleteData]]<br />
<br />
[[Category:Useful Functions]]</div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlLoadData&diff=64304XmlLoadData2019-09-12T19:07:03Z<p>Ceeser: </p>
<hr />
<div><pageclass class="#228B22" subcaption="Useful Function - Shared"></pageclass><br />
<lowercasetitle></lowercasetitle><br />
<br />
{{Important Note|<br />
This is an unofficial MTA function, so its not included into the game by default.<br><br />
Its an exported function of the [[xmlData]] resource.<br><br />
To access this function you need to have the resource running on your server.}}<br />
<br />
<br />
This function provides an automated way of loading your data from an [[XML]] file created by [[xmlSaveData]] <br><br />
To call it, see the [[call]] function or the tip in this resources page: [https://wiki.multitheftauto.com/wiki/XmlData#Simplifying_the_export Simplifying the export]<br />
<br />
<br />
= Info =<br />
'''For proper data loading you need to pass the same booleans / securityLevel as you did on xmlSaveData.'''<br><br />
'''If you called [[xmlSaveData]] with passing the securityLevel its recommended to pick securityLevel as function paremeter for the loading as well.'''<br />
<br />
<br />
= Syntax =<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, bool serverProtected = true, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, int securityLevel = 4 ] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to load.<br />
<br />
====Optional Arguments====<br />
*'''serverProtected:''' If set to ''true'' it can only read the file of the creator-server, otherwise it doesn't care which server created it.<br />
*'''resourceProtected:''' If set to ''true'' it can only read the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which your data is stored at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns a ''table'' containing the files data, an empty ''table'' if there is no data stored inside the file, ''false'' and debug output in case if failure.<br />
<br />
'''Note: There is no encryption parameter in this function, because xmlLoadData will load and use a files key if it is encrypted.'''<br />
</section><br />
<br />
<section name="Server" class="server" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to load.<br />
<br />
====Optional Arguments====<br />
*'''resourceProtected:''' If set to ''true'' it can only read the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which your data is stored at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns a ''table'' containing the files data, an empty ''table'' if there is no data stored inside the file, ''false'' and debug output in case if failure.<br />
<br />
'''Note1: There is no encryption parameter, because xmlLoadData will load and use a files key if it is encrypted.'''<br><br />
'''Note2: There is no serverProtected parameter, because its server-side already anyways.<br />
</section><br />
<br />
<br />
== Example ==<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
-- Lets assume we created a encrypted, serverProtected file called "settings" already.<br />
local xml = exports.xmlData<br />
local tblSettings = xml:xmlLoadData("settings" true) -- serverProtected is true, resourceProtected false - false doesnt need to get passed here<br />
-- OR you can do this:<br />
local tblSettings = xml:xmlLoadData("settings" 6) -- securityLevel 6 equals serverProtected, encrypted, not resouceProtected - the encryption bool will be ignored at xmlLoadData<br />
</syntaxhighlight><br />
</section><br />
<br />
<br />
==See Also==<br />
{{XML_functions}}<br />
<br />
*[[xmlData]]<br />
*[[xmlSaveData]]<br />
*[[xmlDeleteData]]<br />
<br />
[[Category:Useful Functions]]</div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlSaveData&diff=64303XmlSaveData2019-09-12T19:06:34Z<p>Ceeser: </p>
<hr />
<div><pageclass class="#228B22" subcaption="Useful Function - Shared"></pageclass><br />
<lowercasetitle></lowercasetitle><br />
<br />
{{Important Note|<br />
This is an unofficial MTA function, so its not included into the game by default.<br><br />
Its an exported function of the [[xmlData]] resource.<br><br />
To access this function you need to have the resource running on your server.}}<br />
<br />
<br />
This function provides an automated way of loading your data from an [[XML]] file created by [[xmlSaveData]] <br><br />
To call it, see the [[call]] function or the tip in this resources page: [https://wiki.multitheftauto.com/wiki/XmlData#Simplifying_the_export Simplifying the export]<br />
<br />
<br />
= Syntax =<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, bool serverProtected = true, bool encryptData = false, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to create<br />
*'''data:''' The data you want to save (must be a table!)<br />
<br />
====Optional Arguments====<br />
*'''serverProtected:''' If set to ''true'' the script will protect the file so, that can only the creator server can access it.'''<br />
*'''encryptData:''' If set to ''true'' the script will generate a random key and use it to encrypt your stored data. '''Note: If you want to store "sensitive data", always use encryption!'''<br />
*'''resourceProtected:''' If set to ''true'' the script will add the sourceResource name (so the name of the resource from which it got called) to the fileName, preventing it from getting read/overwritten/deleted by any other resource. If set to ''false'' you can use this script to call/send/modify tables from different resources without the use of events/other export functions.<br />
or<br />
*'''securityLevel:''' The level of security on which you want to store your data at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns ''true'' if successful, ''false'' otherwise.<br />
</section><br />
<br />
<section name="Server" class="server" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, bool encryptData = false, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to create<br />
*'''data:''' The data you want to save (must be a table!)<br />
<br />
====Optional Arguments====<br />
*'''encryptData:''' If set to ''true'' the script will generate a random key and use it to encrypt your stored data. '''Note: If you want to store "sensitive data", always use encryption! (Account data should never be stored in serverside files - use a database instead!)'''<br />
*'''resourceProtected:''' If set to ''true'' the script will add the sourceResource name (so the name of the resource from which it got called) to the fileName, preventing it from getting read/overwritten/deleted by any other resource. If set to ''false'' you can use this script to call/send/modify tables from different resources without the use of events/other export functions.<br />
or<br />
*'''securityLevel:''' The level of security on which you want to store your data at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns ''true'' if successful, ''false'' otherwise.<br />
</section><br />
<br />
<br />
== Example ==<br />
<section name="Client" class="client" show="true"><br />
This is the script where we specify the export shortcut and the data table which we want to store.<br />
<syntaxhighlight lang="lua"><br />
local xml = exports.xmlData<br />
local tblScriptSettings = {posX = 800, posY = 500, sizeX = 500, sizeY = 300, settings = {show = true, tab = 1}}<br />
<br />
xml:xmlSaveData("myFileName", tblScriptSettings , true, true) -- Save the data as "myFileName"<br />
</syntaxhighlight><br />
<br />
This will create a server-protected, encrypted file on the clients computer called "myFileName.xml". Also it will generate a random generated key and stores it.<br><br />
The created file will -(could, because encrypted with a random key)- like this:<br />
<br />
<syntaxhighlight lang="xml"><br />
<root posY="VgEN0+TERhg=" posX="mjX4Tj5u6oM=" sizeX="VgEN0+TERhg=" sizeY="htgOMaZurQQ="><br />
<settings show="yeiNs/ne1Ks=" tab="OpijtdPvYqQ="></settings><br />
</root><br />
</syntaxhighlight><br />
</section><br />
<br />
<br />
==See Also==<br />
{{XML_functions}}<br />
<br />
*[[xmlData]]<br />
*[[xmlLoadData]]<br />
*[[xmlDeleteData]]<br />
<br />
[[Category:Useful Functions]]</div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlLoadData&diff=64302XmlLoadData2019-09-12T19:03:34Z<p>Ceeser: </p>
<hr />
<div><pageclass class="#228B22" subcaption="Useful Function - Shared"></pageclass><br />
<lowercasetitle></lowercasetitle><br />
<br />
{{Important Note|<br />
This is an unofficial MTA function, so its not included into the game by default.<br><br />
Its an exported function of the [[xmlData]] resource.<br><br />
To access this function you need to have the resource running on your server.}}<br />
<br />
<br />
This function provides an automated way of loading your data from an [[XML]] file created by [[xmlSaveData]] <br><br />
To call it, see the [[call]] function or the tip in this resources page: [https://wiki.multitheftauto.com/wiki/XmlData#Simplifying_the_export Simplifying the export]<br />
<br />
<br />
= Info =<br />
'''For proper data loading you need to pass the same booleans / securityLevel as you did on xmlSaveData.'''<br><br />
'''If you called [[xmlSaveData]] with passing the securityLevel its recommended to pick securityLevel as function paremeter for the loading as well.'''<br />
<br />
<br />
= Syntax =<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, bool serverProtected = true, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, int securityLevel = 4 ] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to load.<br />
<br />
====Optional Arguments====<br />
*'''serverProtected:''' If set to ''true'' it can only read the file of the creator-server, otherwise it doesn't care which server created it.<br />
*'''resourceProtected:''' If set to ''true'' it can only read the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which your data is stored at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns a ''table'' containing the files data, an empty ''table'' if there is no data stored inside the file, ''false'' and debug output in case if failure.<br />
<br />
'''Note: There is no encryption parameter in this function, because xmlLoadData will load and use a files key if it is encrypted.'''<br />
</section><br />
<br />
<section name="Server" class="server" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to load.<br />
<br />
====Optional Arguments====<br />
*'''resourceProtected:''' If set to ''true'' it can only read the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which your data is stored at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns a ''table'' containing the files data, an empty ''table'' if there is no data stored inside the file, ''false'' and debug output in case if failure.<br />
<br />
'''Note1: There is no encryption parameter, because xmlLoadData will load and use a files key if it is encrypted.'''<br><br />
'''Note2: There is no serverProtected parameter, because its server-side already anyways.<br />
</section><br />
<br />
<br />
== Example ==<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
-- Lets assume we created a encrypted, serverProtected file called "settings" already.<br />
local xml = exports.xmlData<br />
local tblSettings = xml:xmlLoadData("settings" true) -- serverProtected is true, resourceProtected false - false doesnt need to get passed here<br />
-- OR you can do this:<br />
local tblSettings = xml:xmlLoadData("settings" 6) -- securityLevel 6 equals serverProtected, encrypted, not resouceProtected - the encryption bool will be ignored at xmlLoadData<br />
</syntaxhighlight><br />
</section><br />
<br />
<br />
==See Also==<br />
{{XML_functions}}<br />
<br />
[[Category:Useful Functions]]</div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlLoadData&diff=64301XmlLoadData2019-09-12T18:56:04Z<p>Ceeser: </p>
<hr />
<div><pageclass class="#228B22" subcaption="Useful Function - Shared"></pageclass><br />
<lowercasetitle></lowercasetitle><br />
<br />
{{Important Note|<br />
This is an unofficial MTA function, so its not included into the game by default.<br><br />
Its an exported function of the [[xmlData]] resource.<br><br />
To access this function you need to have the resource running on your server.}}<br />
<br />
<br />
This function provides an automated way of loading your data from an [[XML]] file created by [[xmlSaveData]] <br><br />
To call it, see the [[call]] function or the tip in this resources page: [https://wiki.multitheftauto.com/wiki/XmlData#Simplifying_the_export Simplifying the export]<br />
<br />
<br />
= Info =<br />
'''For proper data loading you need to pass the same booleans / securityLevel as you did on xmlSaveData.'''<br><br />
'''If you called [[xmlSaveData]] with passing the securityLevel its recommended to pick securityLevel as function paremeter for the loading as well.'''<br />
<br />
<br />
= Syntax =<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, bool serverProtected = true, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, int securityLevel = 4 ] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to load.<br />
<br />
====Optional Arguments====<br />
*'''serverProtected:''' If set to ''true'' it can only read the file of the creator-server, otherwise it doesn't care which server created it.<br />
*'''resourceProtected:''' If set to ''true'' it can only read the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which your data is stored at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns a ''table'' containing the files data, an empty ''table'' if there is no data stored inside the file, ''false'' and debug output in case if failure.<br />
<br />
'''Note: There is no encryption parameter in this function, because xmlLoadData will load and use a files key if it is encrypted.'''<br />
</section><br />
<br />
<section name="Server" class="server" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to load.<br />
<br />
====Optional Arguments====<br />
*'''resourceProtected:''' If set to ''true'' it can only read the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which your data is stored at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns a ''table'' containing the files data, an empty ''table'' if there is no data stored inside the file, ''false'' and debug output in case if failure.<br />
<br />
'''Note1: There is no encryption parameter, because xmlLoadData will load and use a files key if it is encrypted.'''<br><br />
'''Note2: There is no serverProtected parameter, because its server-side already anyways.<br />
</section><br />
<br />
<br />
== Example ==<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
-- Lets assume we created a encrypted, serverProtected file called "settings" already.<br />
local xml = exports.xmlData<br />
local tblSettings = xml:xmlLoadData("settings" true) -- serverProtected is true, resourceProtected false - false doesnt need to get passed here<br />
-- OR you can do this:<br />
local tblSettings = xml:xmlLoadData("settings" 6) -- securityLevel 6 equals serverProtected, encrypted, not resouceProtected - the encryption bool will be ignored at xmlLoadData<br />
</syntaxhighlight><br />
</section><br />
<br />
<br />
==See Also==<br />
{{XML_functions}}<br />
{{Shared_xml_functions}}<br />
<br />
[[Category:Useful Functions]]</div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlLoadData&diff=64300XmlLoadData2019-09-12T18:54:22Z<p>Ceeser: </p>
<hr />
<div><pageclass class="#228B22" subcaption="Useful Function - Shared"></pageclass><br />
<lowercasetitle></lowercasetitle><br />
<br />
{{Important Note|<br />
This is an unofficial MTA function, so its not included into the game by default.<br><br />
Its an exported function of the [[xmlData]] resource.<br><br />
To access this function you need to have the resource running on your server.}}<br />
<br />
<br />
This function provides an automated way of loading your data from an [[XML]] file created by [[xmlSaveData]] <br><br />
To call it, see the [[call]] function or the tip in this resources page: [https://wiki.multitheftauto.com/wiki/XmlData#Simplifying_the_export Simplifying the export]<br />
<br />
<br />
= Info =<br />
'''For proper data loading you need to pass the same booleans / securityLevel as you did on xmlSaveData.'''<br><br />
'''If you called [[xmlSaveData]] with passing the securityLevel its recommended to pick securityLevel as function paremeter for the loading as well.'''<br />
<br />
<br />
= Syntax =<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, bool serverProtected = true, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, int securityLevel = 4 ] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to load.<br />
<br />
====Optional Arguments====<br />
*'''serverProtected:''' If set to ''true'' it can only read the file of the creator-server, otherwise it doesn't care which server created it.<br />
*'''resourceProtected:''' If set to ''true'' it can only read the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which your data is stored at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns a ''table'' containing the files data, an empty ''table'' if there is no data stored inside the file, ''false'' and debug output in case if failure.<br />
<br />
'''Note: There is no encryption parameter in this function, because xmlLoadData will load and use a files key if it is encrypted.'''<br />
</section><br />
<br />
<section name="Server" class="server" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to load.<br />
<br />
====Optional Arguments====<br />
*'''resourceProtected:''' If set to ''true'' it can only read the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which your data is stored at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns a ''table'' containing the files data, an empty ''table'' if there is no data stored inside the file, ''false'' and debug output in case if failure.<br />
<br />
'''Note1: There is no encryption parameter, because xmlLoadData will load and use a files key if it is encrypted.'''<br><br />
'''Note2: There is no serverProtected parameter, because its server-side already anyways.<br />
</section><br />
<br />
<br />
== Example ==<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
-- Lets assume we created a encrypted, serverProtected file called "settings" already.<br />
local xml = exports.xmlData<br />
local tblSettings = xml:xmlLoadData("settings" true) -- serverProtected is true, resourceProtected false - false doesnt need to get passed here<br />
-- OR you can do this:<br />
local tblSettings = xml:xmlLoadData("settings" 6) -- securityLevel 6 equals serverProtected, encrypted, not resouceProtected - the encryption bool will be ignored at xmlLoadData<br />
</syntaxhighlight><br />
</section><br />
<br />
<br />
==See Also==<br />
{{XML_functions}}<br />
<br />
[[Category:Useful Functions]]</div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlSaveData&diff=64299XmlSaveData2019-09-12T18:52:55Z<p>Ceeser: </p>
<hr />
<div><pageclass class="#228B22" subcaption="Useful Function - Shared"></pageclass><br />
<lowercasetitle></lowercasetitle><br />
<br />
{{Important Note|<br />
This is an unofficial MTA function, so its not included into the game by default.<br><br />
Its an exported function of the [[xmlData]] resource.<br><br />
To access this function you need to have the resource running on your server.}}<br />
<br />
<br />
This function provides an automated way of loading your data from an [[XML]] file created by [[xmlSaveData]] <br><br />
To call it, see the [[call]] function or the tip in this resources page: [https://wiki.multitheftauto.com/wiki/XmlData#Simplifying_the_export Simplifying the export]<br />
<br />
<br />
= Syntax =<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, bool serverProtected = true, bool encryptData = false, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to create<br />
*'''data:''' The data you want to save (must be a table!)<br />
<br />
====Optional Arguments====<br />
*'''serverProtected:''' If set to ''true'' the script will protect the file so, that can only the creator server can access it.'''<br />
*'''encryptData:''' If set to ''true'' the script will generate a random key and use it to encrypt your stored data. '''Note: If you want to store "sensitive data", always use encryption!'''<br />
*'''resourceProtected:''' If set to ''true'' the script will add the sourceResource name (so the name of the resource from which it got called) to the fileName, preventing it from getting read/overwritten/deleted by any other resource. If set to ''false'' you can use this script to call/send/modify tables from different resources without the use of events/other export functions.<br />
or<br />
*'''securityLevel:''' The level of security on which you want to store your data at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns ''true'' if successful, ''false'' otherwise.<br />
</section><br />
<br />
<section name="Server" class="server" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, bool encryptData = false, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to create<br />
*'''data:''' The data you want to save (must be a table!)<br />
<br />
====Optional Arguments====<br />
*'''encryptData:''' If set to ''true'' the script will generate a random key and use it to encrypt your stored data. '''Note: If you want to store "sensitive data", always use encryption! (Account data should never be stored in serverside files - use a database instead!)'''<br />
*'''resourceProtected:''' If set to ''true'' the script will add the sourceResource name (so the name of the resource from which it got called) to the fileName, preventing it from getting read/overwritten/deleted by any other resource. If set to ''false'' you can use this script to call/send/modify tables from different resources without the use of events/other export functions.<br />
or<br />
*'''securityLevel:''' The level of security on which you want to store your data at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns ''true'' if successful, ''false'' otherwise.<br />
</section><br />
<br />
<br />
== Example ==<br />
<section name="Client" class="client" show="true"><br />
This is the script where we specify the export shortcut and the data table which we want to store.<br />
<syntaxhighlight lang="lua"><br />
local xml = exports.xmlData<br />
local tblScriptSettings = {posX = 800, posY = 500, sizeX = 500, sizeY = 300, settings = {show = true, tab = 1}}<br />
<br />
xml:xmlSaveData("myFileName", tblScriptSettings , true, true) -- Save the data as "myFileName"<br />
</syntaxhighlight><br />
<br />
This will create a server-protected, encrypted file on the clients computer called "myFileName.xml". Also it will generate a random generated key and stores it.<br><br />
The created file will -(could, because encrypted with a random key)- like this:<br />
<br />
<syntaxhighlight lang="xml"><br />
<root posY="VgEN0+TERhg=" posX="mjX4Tj5u6oM=" sizeX="VgEN0+TERhg=" sizeY="htgOMaZurQQ="><br />
<settings show="yeiNs/ne1Ks=" tab="OpijtdPvYqQ="></settings><br />
</root><br />
</syntaxhighlight><br />
</section><br />
<br />
<br />
==See Also==<br />
{{XML_functions}}<br />
<br />
[[Category:Useful Functions]]</div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlLoadData&diff=64298XmlLoadData2019-09-12T18:51:18Z<p>Ceeser: </p>
<hr />
<div><pageclass class="#228B22" subcaption="Useful Function - Shared"></pageclass><br />
<lowercasetitle></lowercasetitle><br />
<br />
{{Important Note|<br />
This is an unofficial MTA function, so its not included into the game by default.<br><br />
Its an exported function of the [[xmlData]] resource.<br><br />
To access this function you need to have the resource running on your server.}}<br />
<br />
<br />
This function provides an automated way of loading your data from an [[XML]] file created by [[xmlSaveData]] <br><br />
To call it, see the [[call]] function or the tip in this resources page: [https://wiki.multitheftauto.com/wiki/XmlData#Simplifying_the_export Simplifying the export]<br />
<br />
<br />
= Info =<br />
'''For proper data loading you need to pass the same booleans / securityLevel as you did on xmlSaveData.'''<br><br />
'''If you called [[xmlSaveData]] with passing the securityLevel its recommended to pick securityLevel as function paremeter for the loading as well.'''<br />
<br />
<br />
= Syntax =<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, bool serverProtected = true, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, int securityLevel = 4 ] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to load.<br />
<br />
====Optional Arguments====<br />
*'''serverProtected:''' If set to ''true'' it can only read the file of the creator-server, otherwise it doesn't care which server created it.<br />
*'''resourceProtected:''' If set to ''true'' it can only read the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which your data is stored at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns a ''table'' containing the files data, an empty ''table'' if there is no data stored inside the file, ''false'' and debug output in case if failure.<br />
<br />
'''Note: There is no encryption parameter in this function, because xmlLoadData will load and use a files key if it is encrypted.'''<br />
</section><br />
<br />
<section name="Server" class="server" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to load.<br />
<br />
====Optional Arguments====<br />
*'''resourceProtected:''' If set to ''true'' it can only read the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which your data is stored at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns a ''table'' containing the files data, an empty ''table'' if there is no data stored inside the file, ''false'' and debug output in case if failure.<br />
<br />
'''Note1: There is no encryption parameter, because xmlLoadData will load and use a files key if it is encrypted.'''<br><br />
'''Note2: There is no serverProtected parameter, because its server-side already anyways.<br />
</section><br />
<br />
<br />
== Example ==<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
-- Lets assume we created a encrypted, serverProtected file called "settings" already.<br />
local xml = exports.xmlData<br />
local tblSettings = xml:xmlLoadData("settings" true) -- serverProtected is true, resourceProtected false - false doesnt need to get passed here<br />
-- OR you can do this:<br />
local tblSettings = xml:xmlLoadData("settings" 6) -- securityLevel 6 equals serverProtected, encrypted, not resouceProtected - the encryption bool will be ignored at xmlLoadData<br />
</syntaxhighlight><br />
</section><br />
<br />
[[Category:Useful Functions]]</div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlSaveData&diff=64297XmlSaveData2019-09-12T18:50:24Z<p>Ceeser: </p>
<hr />
<div><pageclass class="#228B22" subcaption="Useful Function - Shared"></pageclass><br />
<lowercasetitle></lowercasetitle><br />
<br />
{{Important Note|<br />
This is an unofficial MTA function, so its not included into the game by default.<br><br />
Its an exported function of the [[xmlData]] resource.<br><br />
To access this function you need to have the resource running on your server.}}<br />
<br />
<br />
This function provides an automated way of loading your data from an [[XML]] file created by [[xmlSaveData]] <br><br />
To call it, see the [[call]] function or the tip in this resources page: [https://wiki.multitheftauto.com/wiki/XmlData#Simplifying_the_export Simplifying the export]<br />
<br />
<br />
= Syntax =<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, bool serverProtected = true, bool encryptData = false, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to create<br />
*'''data:''' The data you want to save (must be a table!)<br />
<br />
====Optional Arguments====<br />
*'''serverProtected:''' If set to ''true'' the script will protect the file so, that can only the creator server can access it.'''<br />
*'''encryptData:''' If set to ''true'' the script will generate a random key and use it to encrypt your stored data. '''Note: If you want to store "sensitive data", always use encryption!'''<br />
*'''resourceProtected:''' If set to ''true'' the script will add the sourceResource name (so the name of the resource from which it got called) to the fileName, preventing it from getting read/overwritten/deleted by any other resource. If set to ''false'' you can use this script to call/send/modify tables from different resources without the use of events/other export functions.<br />
or<br />
*'''securityLevel:''' The level of security on which you want to store your data at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns ''true'' if successful, ''false'' otherwise.<br />
</section><br />
<br />
<section name="Server" class="server" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, bool encryptData = false, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to create<br />
*'''data:''' The data you want to save (must be a table!)<br />
<br />
====Optional Arguments====<br />
*'''encryptData:''' If set to ''true'' the script will generate a random key and use it to encrypt your stored data. '''Note: If you want to store "sensitive data", always use encryption! (Account data should never be stored in serverside files - use a database instead!)'''<br />
*'''resourceProtected:''' If set to ''true'' the script will add the sourceResource name (so the name of the resource from which it got called) to the fileName, preventing it from getting read/overwritten/deleted by any other resource. If set to ''false'' you can use this script to call/send/modify tables from different resources without the use of events/other export functions.<br />
or<br />
*'''securityLevel:''' The level of security on which you want to store your data at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns ''true'' if successful, ''false'' otherwise.<br />
</section><br />
<br />
<br />
== Example ==<br />
<section name="Client" class="client" show="true"><br />
This is the script where we specify the export shortcut and the data table which we want to store.<br />
<syntaxhighlight lang="lua"><br />
local xml = exports.xmlData<br />
local tblScriptSettings = {posX = 800, posY = 500, sizeX = 500, sizeY = 300, settings = {show = true, tab = 1}}<br />
<br />
xml:xmlSaveData("myFileName", tblScriptSettings , true, true) -- Save the data as "myFileName"<br />
</syntaxhighlight><br />
<br />
This will create a server-protected, encrypted file on the clients computer called "myFileName.xml". Also it will generate a random generated key and stores it.<br><br />
The created file will -(could, because encrypted with a random key)- like this:<br />
<br />
<syntaxhighlight lang="xml"><br />
<root posY="VgEN0+TERhg=" posX="mjX4Tj5u6oM=" sizeX="VgEN0+TERhg=" sizeY="htgOMaZurQQ="><br />
<settings show="yeiNs/ne1Ks=" tab="OpijtdPvYqQ="></settings><br />
</root><br />
</syntaxhighlight><br />
</section><br />
<br />
[[Category:Useful Functions]]</div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlSaveData&diff=64296XmlSaveData2019-09-12T18:49:59Z<p>Ceeser: </p>
<hr />
<div><pageclass class="#228B22" subcaption="Useful Function - Shared"></pageclass><br />
<lowercasetitle></lowercasetitle><br />
<br />
{{Important Note|<br />
This is an unofficial MTA function, so its not included into the game by default.<br><br />
Its an exported function of the [[xmlData]] resource.<br><br />
To access this function you need to have the resource running on your server.}}<br />
<br />
<br />
This function provides an automated way of loading your data from an [[XML]] file created by [[xmlSaveData]] <br><br />
To call it, see the [[call]] function or the tip in this resources page: [https://wiki.multitheftauto.com/wiki/XmlData#Simplifying_the_export Simplifying the export]<br />
<br />
<br />
= Syntax =<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, bool serverProtected = true, bool encryptData = false, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to create<br />
*'''data:''' The data you want to save (must be a table!)<br />
<br />
====Optional Arguments====<br />
*'''serverProtected:''' If set to ''true'' the script will protect the file so, that can only the creator server can access it.'''<br />
*'''encryptData:''' If set to ''true'' the script will generate a random key and use it to encrypt your stored data. '''Note: If you want to store "sensitive data", always use encryption!'''<br />
*'''resourceProtected:''' If set to ''true'' the script will add the sourceResource name (so the name of the resource from which it got called) to the fileName, preventing it from getting read/overwritten/deleted by any other resource. If set to ''false'' you can use this script to call/send/modify tables from different resources without the use of events/other export functions.<br />
or<br />
*'''securityLevel:''' The level of security on which you want to store your data at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns ''true'' if successful, ''false'' otherwise.<br />
</section><br />
<br />
<section name="Server" class="server" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, bool encryptData = false, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to create<br />
*'''data:''' The data you want to save (must be a table!)<br />
<br />
====Optional Arguments====<br />
*'''encryptData:''' If set to ''true'' the script will generate a random key and use it to encrypt your stored data. '''Note: If you want to store "sensitive data", always use encryption! (Account data should never be stored in serverside files - use a database instead!)'''<br />
*'''resourceProtected:''' If set to ''true'' the script will add the sourceResource name (so the name of the resource from which it got called) to the fileName, preventing it from getting read/overwritten/deleted by any other resource. If set to ''false'' you can use this script to call/send/modify tables from different resources without the use of events/other export functions.<br />
or<br />
*'''securityLevel:''' The level of security on which you want to store your data at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns ''true'' if successful, ''false'' otherwise.<br />
</section><br />
<br />
<br />
== Example ==<br />
<section name="Client" class="client" show="true"><br />
This is the script where we specify the export shortcut and the data table which we want to store.<br />
<syntaxhighlight lang="lua"><br />
local xml = exports.xmlData<br />
local tblScriptSettings = {posX = 800, posY = 500, sizeX = 500, sizeY = 300, settings = {show = true, tab = 1}}<br />
<br />
xml:xmlSaveData("myFileName", tblScriptSettings , true, true) -- Save the data as "myFileName"<br />
</syntaxhighlight><br />
<br />
This will create a server-protected, encrypted file on the clients computer called "myFileName.xml". Also it will generate a random generated key and stores it.<br><br />
The created file will -(could, because encrypted with a random key)- like this:<br />
<br />
<syntaxhighlight lang="xml"><br />
<root posY="VgEN0+TERhg=" posX="mjX4Tj5u6oM=" sizeX="VgEN0+TERhg=" sizeY="htgOMaZurQQ="><br />
<settings show="yeiNs/ne1Ks=" tab="OpijtdPvYqQ="></settings><br />
</root><br />
</syntaxhighlight><br />
</section><br />
<br />
[[Category:Useful_Function]]</div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlSaveData&diff=64295XmlSaveData2019-09-12T18:49:46Z<p>Ceeser: </p>
<hr />
<div><pageclass class="#228B22" subcaption="Useful Function - Shared"></pageclass><br />
<lowercasetitle></lowercasetitle><br />
<br />
{{Important Note|<br />
This is an unofficial MTA function, so its not included into the game by default.<br><br />
Its an exported function of the [[xmlData]] resource.<br><br />
To access this function you need to have the resource running on your server.}}<br />
<br />
<br />
This function provides an automated way of loading your data from an [[XML]] file created by [[xmlSaveData]] <br><br />
To call it, see the [[call]] function or the tip in this resources page: [https://wiki.multitheftauto.com/wiki/XmlData#Simplifying_the_export Simplifying the export]<br />
<br />
<br />
= Syntax =<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, bool serverProtected = true, bool encryptData = false, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to create<br />
*'''data:''' The data you want to save (must be a table!)<br />
<br />
====Optional Arguments====<br />
*'''serverProtected:''' If set to ''true'' the script will protect the file so, that can only the creator server can access it.'''<br />
*'''encryptData:''' If set to ''true'' the script will generate a random key and use it to encrypt your stored data. '''Note: If you want to store "sensitive data", always use encryption!'''<br />
*'''resourceProtected:''' If set to ''true'' the script will add the sourceResource name (so the name of the resource from which it got called) to the fileName, preventing it from getting read/overwritten/deleted by any other resource. If set to ''false'' you can use this script to call/send/modify tables from different resources without the use of events/other export functions.<br />
or<br />
*'''securityLevel:''' The level of security on which you want to store your data at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns ''true'' if successful, ''false'' otherwise.<br />
</section><br />
<br />
<section name="Server" class="server" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, bool encryptData = false, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to create<br />
*'''data:''' The data you want to save (must be a table!)<br />
<br />
====Optional Arguments====<br />
*'''encryptData:''' If set to ''true'' the script will generate a random key and use it to encrypt your stored data. '''Note: If you want to store "sensitive data", always use encryption! (Account data should never be stored in serverside files - use a database instead!)'''<br />
*'''resourceProtected:''' If set to ''true'' the script will add the sourceResource name (so the name of the resource from which it got called) to the fileName, preventing it from getting read/overwritten/deleted by any other resource. If set to ''false'' you can use this script to call/send/modify tables from different resources without the use of events/other export functions.<br />
or<br />
*'''securityLevel:''' The level of security on which you want to store your data at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns ''true'' if successful, ''false'' otherwise.<br />
</section><br />
<br />
<br />
== Example ==<br />
<section name="Client" class="client" show="true"><br />
This is the script where we specify the export shortcut and the data table which we want to store.<br />
<syntaxhighlight lang="lua"><br />
local xml = exports.xmlData<br />
local tblScriptSettings = {posX = 800, posY = 500, sizeX = 500, sizeY = 300, settings = {show = true, tab = 1}}<br />
<br />
xml:xmlSaveData("myFileName", tblScriptSettings , true, true) -- Save the data as "myFileName"<br />
</syntaxhighlight><br />
<br />
This will create a server-protected, encrypted file on the clients computer called "myFileName.xml". Also it will generate a random generated key and stores it.<br><br />
The created file will -(could, because encrypted with a random key)- like this:<br />
<br />
<syntaxhighlight lang="xml"><br />
<root posY="VgEN0+TERhg=" posX="mjX4Tj5u6oM=" sizeX="VgEN0+TERhg=" sizeY="htgOMaZurQQ="><br />
<settings show="yeiNs/ne1Ks=" tab="OpijtdPvYqQ="></settings><br />
</root><br />
</syntaxhighlight><br />
</section><br />
<br />
[[Category:Useful Function]]</div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlData&diff=64294XmlData2019-09-12T18:32:19Z<p>Ceeser: </p>
<hr />
<div><pageclass class="resource" subcaption="Resource"></pageclass><br />
<lowercasetitle /><br />
<br />
== INFO ==<br />
'''The documentation about this resource and its functions is not complete yet and will be continued (12.09.19)'''<br />
<br />
<br />
== Resource Information ==<br />
This resource let you save and load data in an [[XML]] File.<br><br />
It's an easy to use resource, providing 3 exported functions.<br><br />
<br />
<br />
== Download ==<br />
Download can be found at the [https://community.multitheftauto.com/ MTA community page -- LINK FOLLOWS].<br><br />
Resource developed by: [https://community.multitheftauto.com/index.php?p=profile&id=477820 Ceeser]<br />
<br />
<br />
== Exported functions ==<br />
'''Note: These functions are available for Server and Client'''<br />
* [[XmlSaveData|xmlSaveData]]<br />
* [[xmlLoadData|xmlLoadData]]<br />
* [[xmlDeleteData|xmlDeleteData -- PAGE FOLLOWS]]<br />
<br />
<br />
== Security ==<br />
Next to the point of easy access this resource has its focus on security.<br />
You can specify how much protection you want to have for your data:<br />
* '''Server protection''' - With this only the server that has created the file will be able to read/modify/delete it.<br />
* '''Encryption''' - With this the stored data will be encrypted by a generated key, making it unreadable and unmodifyable by humans.<br />
* '''Resource protection''' - With this only the resource that has created the file will be able to read/modify/delete it.<br />
<br />
Note: No matter what settings you use - no server will have access to any file without its specific filename.<br />
<br />
<br />
=== Key generation / Data encryption ===<br />
If you want to save your data encrypted the script will generate a random key and stores it, so that the file can get read again.<br />
If you enable server protection for the file, the key can also only be read by the same server that has generated the data file.<br />
The same also goes for the resource protection.<br />
<br />
<br />
=== Security Levels ===<br />
Instead of manually adding bool parameters to the functions you can also just pass the security level you want to use for each function:<br />
* '''0''' - No protection (any server, any resource or humans could read/modify)<br />
* '''1''' - Very low protection (creator resource on any server or humans could read/modify)<br />
* '''2''' - Very low protection (any resource on any server could read/modify, humans cant)<br />
* '''3''' - Low protection (only creator resource on any server could read/modify, humans cant)<br />
* '''4''' - Medium protection (any resource on the creator server or humans could read/modify) - DEFAULT<br />
* '''5''' - Medium protection (only creator resource on the creator server or humans could read/modify)<br />
* '''6''' - High protection (any resource on the creator server could read/modify, humans cant)<br />
* '''7''' - Very high protection (only creator resource on creator server could read/modify, humans cant.<br />
<br />
<br />
== Simplifying the export ==<br />
For simplifying reasons I recommend the use this shortcut variable to call the exported functions:<br />
<br />
<syntaxhighlight lang="lua"><br />
local xml = exports.xmlData -- Define this variable at the top of your script<br />
<br />
-- And then use it like this for example:<br />
xml:xmlSaveData("yourFileName", yourData)<br />
</syntaxhighlight><br />
<br />
<br />
== Variables and Specified Names ==<br />
In the exported functions are some names which I will explain here to keep the function pages as clean and small as possible.<br />
<br />
=== serverProtected / Creator-Server ===<br />
With '''creator-server''' I mean the server that has created a file.<br />
So if a file is serverProtected only the server that called the function is able to read/modify/delete it.<br><br />
This includes client-side: The function call have been on the client-side of any server, so the link to the server exist anyways.<br />
<br />
=== resourceProtected / Creator-Resource ===<br />
With '''creator-resource''' I mean the resource that has created a file.<br />
Example how it works: If you call xmlSaveData with resourceProtection from resource "login", only "login" will then be able to read that xml file.<br><br />
If you don't use serverProtection in combination to this, every "login" resource on any server COULD read that file if it calls xmlLoadData with the correct file name.<br />
<br />
<br />
== Data type warning ==<br />
'''This resource will save everything, no matter what you give as data input.'''<br><br />
So be sure that there is no userdata stored inside the table you are passing to the xmlSaveData function.<br />
In case you have any kind of userdata it will output warnings in the debugscript - you should fix that by removing all userdata from the input table, because: Any Userdata is temporary. It will change after a script restart, reconnect, server restart.. or even while a resource is running/ you are playing.<br />
<br />
<br />
[[Category:Resource]]</div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlData&diff=64293XmlData2019-09-12T18:30:47Z<p>Ceeser: </p>
<hr />
<div><pageclass class="resource" subcaption="Resource"></pageclass><br />
<lowercasetitle /><br />
<br />
== INFO ==<br />
'''The documentation about this resource and its functions is not complete yet and will be continued (12.09.19)'''<br />
<br />
<br />
== Resource Information ==<br />
This resource let you save and load data in an [[XML]] File.<br><br />
It's an easy to use resource, providing 3 exported functions.<br><br />
<br />
<br />
== Download ==<br />
Download can be found at the [https://community.multitheftauto.com/ MTA community page -- LINK FOLLOWS].<br><br />
Resource developed by: [https://community.multitheftauto.com/index.php?p=profile&id=477820 Ceeser]<br />
<br />
<br />
== Exported functions ==<br />
'''Note: These functions are available for Server and Client'''<br />
* [[XmlSaveData|xmlSaveData]]<br />
* [[xmlLoadData|xmlLoadData]]<br />
* [[xmlDeleteData|xmlDeleteData -- PAGE FOLLOWS]]<br />
<br />
<br />
== Security ==<br />
Next to the point of easy access this resource has its focus on security.<br />
You can specify how much protection you want to have for your data:<br />
* '''Server protection''' - With this only the server that has created the file will be able to read/modify/delete it.<br />
* '''Encryption''' - With this the stored data will be encrypted by a generated key, making it unreadable and unmodifyable by humans.<br />
* '''Resource protection''' - With this only the resource that has created the file will be able to read/modify/delete it.<br />
<br />
Note: No matter what settings you use - no server will have access to any file without its specific filename.<br />
<br />
<br />
=== Key generation / Data encryption ===<br />
If you want to save your data encrypted the script will generate a random key and stores it, so that the file can get read again.<br />
If you enable server protection for the file, the key can also only be read by the same server that has generated the data file.<br />
The same also goes for the resource protection.<br />
<br />
<br />
=== Security Levels ===<br />
Instead of manually adding bool parameters to the functions you can also just pass the security level you want to use for each function:<br />
* '''0''' - No protection (any server, any resource or humans could read/modify)<br />
* '''1''' - Very low protection (creator resource on any server or humans could read/modify)<br />
* '''2''' - Very low protection (any resource on any server could read/modify, humans cant)<br />
* '''3''' - Low protection (only creator resource on any server could read/modify, humans cant)<br />
* '''4''' - Medium protection (any resource on the creator server or humans could read/modify) - DEFAULT<br />
* '''5''' - Medium protection (only creator resource on the creator server or humans could read/modify)<br />
* '''6''' - High protection (any resource on the creator server could read/modify, humans cant)<br />
* '''7''' - Very high protection (only creator resource on creator server could read/modify, humans cant.<br />
<br />
<br />
== Simplifying the export ==<br />
For simplifying reasons I recommend the use this shortcut variable to call the exported functions:<br />
<br />
<syntaxhighlight lang="lua"><br />
local xml = exports.xmlData -- Define this variable at the top of your script<br />
<br />
-- And then use it like this for example:<br />
xml:xmlSaveData("yourFileName", yourData)<br />
</syntaxhighlight><br />
<br />
<br />
== Variables and Specified Names ==<br />
In the exported functions are some names which I will explain here to keep the function pages as clean and small as possible.<br />
<br />
=== serverProtected / Creator-Server ===<br />
With '''creator-server''' I mean the server that has created a file.<br />
So if a file is serverProtected only the server that called the function is able to read/modify/delete it.<br><br />
This includes client-side: The function call have been on the client-side of any server, so the link to the server exist anyways.<br />
<br />
=== resourceProtected / Creator-Resource ===<br />
With '''creator-resource''' I mean the resource that has created a file.<br />
Example how it works: If you call xmlSaveData with resourceProtection from resource "login", only "login" will then be able to read that xml file.<br><br />
If you don't use serverProtection in combination to this, every "login" resource on any server COULD read that file if it calls xmlLoadData with the correct file name.<br />
<br />
<br />
== Data type warning ==<br />
'''This resource will save everything, no matter what you give as data input.'''<br><br />
So be sure that there is no userdata stored inside the table you are passing to the xmlSaveData function.<br />
In case you have any kind of userdata it will output warnings in the debugscript - you should fix that by removing all userdata from the input table, because: Any Userdata is temporary. It will change after a script restart, reconnect, server restart.. or even while a resource is running/ you are playing.<br />
<br />
<includeonly>[[Category:Resource]]</includeonnly><br />
[[Resource:XmlData]]</div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlData&diff=64292XmlData2019-09-12T18:29:40Z<p>Ceeser: </p>
<hr />
<div>{{Resource page}}<br />
<pageclass class="resource" subcaption="Resource"></pageclass><br />
<lowercasetitle /><br />
<br />
== INFO ==<br />
'''The documentation about this resource and its functions is not complete yet and will be continued (12.09.19)'''<br />
<br />
<br />
== Resource Information ==<br />
This resource let you save and load data in an [[XML]] File.<br><br />
It's an easy to use resource, providing 3 exported functions.<br><br />
<br />
<br />
== Download ==<br />
Download can be found at the [https://community.multitheftauto.com/ MTA community page -- LINK FOLLOWS].<br><br />
Resource developed by: [https://community.multitheftauto.com/index.php?p=profile&id=477820 Ceeser]<br />
<br />
<br />
== Exported functions ==<br />
'''Note: These functions are available for Server and Client'''<br />
* [[XmlSaveData|xmlSaveData]]<br />
* [[xmlLoadData|xmlLoadData]]<br />
* [[xmlDeleteData|xmlDeleteData -- PAGE FOLLOWS]]<br />
<br />
<br />
== Security ==<br />
Next to the point of easy access this resource has its focus on security.<br />
You can specify how much protection you want to have for your data:<br />
* '''Server protection''' - With this only the server that has created the file will be able to read/modify/delete it.<br />
* '''Encryption''' - With this the stored data will be encrypted by a generated key, making it unreadable and unmodifyable by humans.<br />
* '''Resource protection''' - With this only the resource that has created the file will be able to read/modify/delete it.<br />
<br />
Note: No matter what settings you use - no server will have access to any file without its specific filename.<br />
<br />
<br />
=== Key generation / Data encryption ===<br />
If you want to save your data encrypted the script will generate a random key and stores it, so that the file can get read again.<br />
If you enable server protection for the file, the key can also only be read by the same server that has generated the data file.<br />
The same also goes for the resource protection.<br />
<br />
<br />
=== Security Levels ===<br />
Instead of manually adding bool parameters to the functions you can also just pass the security level you want to use for each function:<br />
* '''0''' - No protection (any server, any resource or humans could read/modify)<br />
* '''1''' - Very low protection (creator resource on any server or humans could read/modify)<br />
* '''2''' - Very low protection (any resource on any server could read/modify, humans cant)<br />
* '''3''' - Low protection (only creator resource on any server could read/modify, humans cant)<br />
* '''4''' - Medium protection (any resource on the creator server or humans could read/modify) - DEFAULT<br />
* '''5''' - Medium protection (only creator resource on the creator server or humans could read/modify)<br />
* '''6''' - High protection (any resource on the creator server could read/modify, humans cant)<br />
* '''7''' - Very high protection (only creator resource on creator server could read/modify, humans cant.<br />
<br />
<br />
== Simplifying the export ==<br />
For simplifying reasons I recommend the use this shortcut variable to call the exported functions:<br />
<br />
<syntaxhighlight lang="lua"><br />
local xml = exports.xmlData -- Define this variable at the top of your script<br />
<br />
-- And then use it like this for example:<br />
xml:xmlSaveData("yourFileName", yourData)<br />
</syntaxhighlight><br />
<br />
<br />
== Variables and Specified Names ==<br />
In the exported functions are some names which I will explain here to keep the function pages as clean and small as possible.<br />
<br />
=== serverProtected / Creator-Server ===<br />
With '''creator-server''' I mean the server that has created a file.<br />
So if a file is serverProtected only the server that called the function is able to read/modify/delete it.<br><br />
This includes client-side: The function call have been on the client-side of any server, so the link to the server exist anyways.<br />
<br />
=== resourceProtected / Creator-Resource ===<br />
With '''creator-resource''' I mean the resource that has created a file.<br />
Example how it works: If you call xmlSaveData with resourceProtection from resource "login", only "login" will then be able to read that xml file.<br><br />
If you don't use serverProtection in combination to this, every "login" resource on any server COULD read that file if it calls xmlLoadData with the correct file name.<br />
<br />
<br />
== Data type warning ==<br />
'''This resource will save everything, no matter what you give as data input.'''<br><br />
So be sure that there is no userdata stored inside the table you are passing to the xmlSaveData function.<br />
In case you have any kind of userdata it will output warnings in the debugscript - you should fix that by removing all userdata from the input table, because: Any Userdata is temporary. It will change after a script restart, reconnect, server restart.. or even while a resource is running/ you are playing.<br />
<br />
<includeonly>[[Category:Resource]]</includeonnly><br />
[[Resource:XmlData]]</div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlData&diff=64291XmlData2019-09-12T18:29:05Z<p>Ceeser: </p>
<hr />
<div><pageclass class="resource" subcaption="Resource"></pageclass><br />
<removeNamespaceName></removeNamespaceName><br />
<lowercasetitle></lowercasetitle><br />
<includeonly>[[Resource:XmlData]]</includeonly><br />
<lowercasetitle /><br />
<br />
== INFO ==<br />
'''The documentation about this resource and its functions is not complete yet and will be continued (12.09.19)'''<br />
<br />
<br />
== Resource Information ==<br />
This resource let you save and load data in an [[XML]] File.<br><br />
It's an easy to use resource, providing 3 exported functions.<br><br />
<br />
<br />
== Download ==<br />
Download can be found at the [https://community.multitheftauto.com/ MTA community page -- LINK FOLLOWS].<br><br />
Resource developed by: [https://community.multitheftauto.com/index.php?p=profile&id=477820 Ceeser]<br />
<br />
<br />
== Exported functions ==<br />
'''Note: These functions are available for Server and Client'''<br />
* [[XmlSaveData|xmlSaveData]]<br />
* [[xmlLoadData|xmlLoadData]]<br />
* [[xmlDeleteData|xmlDeleteData -- PAGE FOLLOWS]]<br />
<br />
<br />
== Security ==<br />
Next to the point of easy access this resource has its focus on security.<br />
You can specify how much protection you want to have for your data:<br />
* '''Server protection''' - With this only the server that has created the file will be able to read/modify/delete it.<br />
* '''Encryption''' - With this the stored data will be encrypted by a generated key, making it unreadable and unmodifyable by humans.<br />
* '''Resource protection''' - With this only the resource that has created the file will be able to read/modify/delete it.<br />
<br />
Note: No matter what settings you use - no server will have access to any file without its specific filename.<br />
<br />
<br />
=== Key generation / Data encryption ===<br />
If you want to save your data encrypted the script will generate a random key and stores it, so that the file can get read again.<br />
If you enable server protection for the file, the key can also only be read by the same server that has generated the data file.<br />
The same also goes for the resource protection.<br />
<br />
<br />
=== Security Levels ===<br />
Instead of manually adding bool parameters to the functions you can also just pass the security level you want to use for each function:<br />
* '''0''' - No protection (any server, any resource or humans could read/modify)<br />
* '''1''' - Very low protection (creator resource on any server or humans could read/modify)<br />
* '''2''' - Very low protection (any resource on any server could read/modify, humans cant)<br />
* '''3''' - Low protection (only creator resource on any server could read/modify, humans cant)<br />
* '''4''' - Medium protection (any resource on the creator server or humans could read/modify) - DEFAULT<br />
* '''5''' - Medium protection (only creator resource on the creator server or humans could read/modify)<br />
* '''6''' - High protection (any resource on the creator server could read/modify, humans cant)<br />
* '''7''' - Very high protection (only creator resource on creator server could read/modify, humans cant.<br />
<br />
<br />
== Simplifying the export ==<br />
For simplifying reasons I recommend the use this shortcut variable to call the exported functions:<br />
<br />
<syntaxhighlight lang="lua"><br />
local xml = exports.xmlData -- Define this variable at the top of your script<br />
<br />
-- And then use it like this for example:<br />
xml:xmlSaveData("yourFileName", yourData)<br />
</syntaxhighlight><br />
<br />
<br />
== Variables and Specified Names ==<br />
In the exported functions are some names which I will explain here to keep the function pages as clean and small as possible.<br />
<br />
=== serverProtected / Creator-Server ===<br />
With '''creator-server''' I mean the server that has created a file.<br />
So if a file is serverProtected only the server that called the function is able to read/modify/delete it.<br><br />
This includes client-side: The function call have been on the client-side of any server, so the link to the server exist anyways.<br />
<br />
=== resourceProtected / Creator-Resource ===<br />
With '''creator-resource''' I mean the resource that has created a file.<br />
Example how it works: If you call xmlSaveData with resourceProtection from resource "login", only "login" will then be able to read that xml file.<br><br />
If you don't use serverProtection in combination to this, every "login" resource on any server COULD read that file if it calls xmlLoadData with the correct file name.<br />
<br />
<br />
== Data type warning ==<br />
'''This resource will save everything, no matter what you give as data input.'''<br><br />
So be sure that there is no userdata stored inside the table you are passing to the xmlSaveData function.<br />
In case you have any kind of userdata it will output warnings in the debugscript - you should fix that by removing all userdata from the input table, because: Any Userdata is temporary. It will change after a script restart, reconnect, server restart.. or even while a resource is running/ you are playing.</div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlData&diff=64290XmlData2019-09-12T18:28:37Z<p>Ceeser: </p>
<hr />
<div><pageclass class="resource" subcaption="Resource"></pageclass><br />
<removeNamespaceName></removeNamespaceName><br />
<lowercasetitle></lowercasetitle><br />
<includeonly>[[Category:Resource|{{XmlData}}]]</includeonly><br />
<lowercasetitle /><br />
<br />
== INFO ==<br />
'''The documentation about this resource and its functions is not complete yet and will be continued (12.09.19)'''<br />
<br />
<br />
== Resource Information ==<br />
This resource let you save and load data in an [[XML]] File.<br><br />
It's an easy to use resource, providing 3 exported functions.<br><br />
<br />
<br />
== Download ==<br />
Download can be found at the [https://community.multitheftauto.com/ MTA community page -- LINK FOLLOWS].<br><br />
Resource developed by: [https://community.multitheftauto.com/index.php?p=profile&id=477820 Ceeser]<br />
<br />
<br />
== Exported functions ==<br />
'''Note: These functions are available for Server and Client'''<br />
* [[XmlSaveData|xmlSaveData]]<br />
* [[xmlLoadData|xmlLoadData]]<br />
* [[xmlDeleteData|xmlDeleteData -- PAGE FOLLOWS]]<br />
<br />
<br />
== Security ==<br />
Next to the point of easy access this resource has its focus on security.<br />
You can specify how much protection you want to have for your data:<br />
* '''Server protection''' - With this only the server that has created the file will be able to read/modify/delete it.<br />
* '''Encryption''' - With this the stored data will be encrypted by a generated key, making it unreadable and unmodifyable by humans.<br />
* '''Resource protection''' - With this only the resource that has created the file will be able to read/modify/delete it.<br />
<br />
Note: No matter what settings you use - no server will have access to any file without its specific filename.<br />
<br />
<br />
=== Key generation / Data encryption ===<br />
If you want to save your data encrypted the script will generate a random key and stores it, so that the file can get read again.<br />
If you enable server protection for the file, the key can also only be read by the same server that has generated the data file.<br />
The same also goes for the resource protection.<br />
<br />
<br />
=== Security Levels ===<br />
Instead of manually adding bool parameters to the functions you can also just pass the security level you want to use for each function:<br />
* '''0''' - No protection (any server, any resource or humans could read/modify)<br />
* '''1''' - Very low protection (creator resource on any server or humans could read/modify)<br />
* '''2''' - Very low protection (any resource on any server could read/modify, humans cant)<br />
* '''3''' - Low protection (only creator resource on any server could read/modify, humans cant)<br />
* '''4''' - Medium protection (any resource on the creator server or humans could read/modify) - DEFAULT<br />
* '''5''' - Medium protection (only creator resource on the creator server or humans could read/modify)<br />
* '''6''' - High protection (any resource on the creator server could read/modify, humans cant)<br />
* '''7''' - Very high protection (only creator resource on creator server could read/modify, humans cant.<br />
<br />
<br />
== Simplifying the export ==<br />
For simplifying reasons I recommend the use this shortcut variable to call the exported functions:<br />
<br />
<syntaxhighlight lang="lua"><br />
local xml = exports.xmlData -- Define this variable at the top of your script<br />
<br />
-- And then use it like this for example:<br />
xml:xmlSaveData("yourFileName", yourData)<br />
</syntaxhighlight><br />
<br />
<br />
== Variables and Specified Names ==<br />
In the exported functions are some names which I will explain here to keep the function pages as clean and small as possible.<br />
<br />
=== serverProtected / Creator-Server ===<br />
With '''creator-server''' I mean the server that has created a file.<br />
So if a file is serverProtected only the server that called the function is able to read/modify/delete it.<br><br />
This includes client-side: The function call have been on the client-side of any server, so the link to the server exist anyways.<br />
<br />
=== resourceProtected / Creator-Resource ===<br />
With '''creator-resource''' I mean the resource that has created a file.<br />
Example how it works: If you call xmlSaveData with resourceProtection from resource "login", only "login" will then be able to read that xml file.<br><br />
If you don't use serverProtection in combination to this, every "login" resource on any server COULD read that file if it calls xmlLoadData with the correct file name.<br />
<br />
<br />
== Data type warning ==<br />
'''This resource will save everything, no matter what you give as data input.'''<br><br />
So be sure that there is no userdata stored inside the table you are passing to the xmlSaveData function.<br />
In case you have any kind of userdata it will output warnings in the debugscript - you should fix that by removing all userdata from the input table, because: Any Userdata is temporary. It will change after a script restart, reconnect, server restart.. or even while a resource is running/ you are playing.</div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlData&diff=64289XmlData2019-09-12T18:26:18Z<p>Ceeser: </p>
<hr />
<div>{{Resource page}}<br />
<pageclass class="resource" subcaption="Resource"></pageclass><br />
<lowercasetitle /><br />
<br />
== INFO ==<br />
'''The documentation about this resource and its functions is not complete yet and will be continued (12.09.19)'''<br />
<br />
<br />
== Resource Information ==<br />
This resource let you save and load data in an [[XML]] File.<br><br />
It's an easy to use resource, providing 3 exported functions.<br><br />
<br />
<br />
== Download ==<br />
Download can be found at the [https://community.multitheftauto.com/ MTA community page -- LINK FOLLOWS].<br><br />
Resource developed by: [https://community.multitheftauto.com/index.php?p=profile&id=477820 Ceeser]<br />
<br />
<br />
== Exported functions ==<br />
'''Note: These functions are available for Server and Client'''<br />
* [[XmlSaveData|xmlSaveData]]<br />
* [[xmlLoadData|xmlLoadData]]<br />
* [[xmlDeleteData|xmlDeleteData -- PAGE FOLLOWS]]<br />
<br />
<br />
== Security ==<br />
Next to the point of easy access this resource has its focus on security.<br />
You can specify how much protection you want to have for your data:<br />
* '''Server protection''' - With this only the server that has created the file will be able to read/modify/delete it.<br />
* '''Encryption''' - With this the stored data will be encrypted by a generated key, making it unreadable and unmodifyable by humans.<br />
* '''Resource protection''' - With this only the resource that has created the file will be able to read/modify/delete it.<br />
<br />
Note: No matter what settings you use - no server will have access to any file without its specific filename.<br />
<br />
<br />
=== Key generation / Data encryption ===<br />
If you want to save your data encrypted the script will generate a random key and stores it, so that the file can get read again.<br />
If you enable server protection for the file, the key can also only be read by the same server that has generated the data file.<br />
The same also goes for the resource protection.<br />
<br />
<br />
=== Security Levels ===<br />
Instead of manually adding bool parameters to the functions you can also just pass the security level you want to use for each function:<br />
* '''0''' - No protection (any server, any resource or humans could read/modify)<br />
* '''1''' - Very low protection (creator resource on any server or humans could read/modify)<br />
* '''2''' - Very low protection (any resource on any server could read/modify, humans cant)<br />
* '''3''' - Low protection (only creator resource on any server could read/modify, humans cant)<br />
* '''4''' - Medium protection (any resource on the creator server or humans could read/modify) - DEFAULT<br />
* '''5''' - Medium protection (only creator resource on the creator server or humans could read/modify)<br />
* '''6''' - High protection (any resource on the creator server could read/modify, humans cant)<br />
* '''7''' - Very high protection (only creator resource on creator server could read/modify, humans cant.<br />
<br />
<br />
== Simplifying the export ==<br />
For simplifying reasons I recommend the use this shortcut variable to call the exported functions:<br />
<br />
<syntaxhighlight lang="lua"><br />
local xml = exports.xmlData -- Define this variable at the top of your script<br />
<br />
-- And then use it like this for example:<br />
xml:xmlSaveData("yourFileName", yourData)<br />
</syntaxhighlight><br />
<br />
<br />
== Variables and Specified Names ==<br />
In the exported functions are some names which I will explain here to keep the function pages as clean and small as possible.<br />
<br />
=== serverProtected / Creator-Server ===<br />
With '''creator-server''' I mean the server that has created a file.<br />
So if a file is serverProtected only the server that called the function is able to read/modify/delete it.<br><br />
This includes client-side: The function call have been on the client-side of any server, so the link to the server exist anyways.<br />
<br />
=== resourceProtected / Creator-Resource ===<br />
With '''creator-resource''' I mean the resource that has created a file.<br />
Example how it works: If you call xmlSaveData with resourceProtection from resource "login", only "login" will then be able to read that xml file.<br><br />
If you don't use serverProtection in combination to this, every "login" resource on any server COULD read that file if it calls xmlLoadData with the correct file name.<br />
<br />
<br />
== Data type warning ==<br />
'''This resource will save everything, no matter what you give as data input.'''<br><br />
So be sure that there is no userdata stored inside the table you are passing to the xmlSaveData function.<br />
In case you have any kind of userdata it will output warnings in the debugscript - you should fix that by removing all userdata from the input table, because: Any Userdata is temporary. It will change after a script restart, reconnect, server restart.. or even while a resource is running/ you are playing.<br />
<br />
<includeonly>[[Category:Resource]]</includeonnly><br />
[[Resource:XmlData]]</div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlData&diff=64288XmlData2019-09-12T18:23:23Z<p>Ceeser: </p>
<hr />
<div>{{Resource page}}<br />
<pageclass class="resource" subcaption="Resource"></pageclass><br />
<lowercasetitle /><br />
<br />
== INFO ==<br />
'''The documentation about this resource and its functions is not complete yet and will be continued (12.09.19)'''<br />
<br />
<br />
== Resource Information ==<br />
This resource let you save and load data in an [[XML]] File.<br><br />
It's an easy to use resource, providing 3 exported functions.<br><br />
<br />
<br />
== Download ==<br />
Download can be found at the [https://community.multitheftauto.com/ MTA community page -- LINK FOLLOWS].<br><br />
Resource developed by: [https://community.multitheftauto.com/index.php?p=profile&id=477820 Ceeser]<br />
<br />
<br />
== Exported functions ==<br />
'''Note: These functions are available for Server and Client'''<br />
* [[XmlSaveData|xmlSaveData]]<br />
* [[xmlLoadData|xmlLoadData]]<br />
* [[xmlDeleteData|xmlDeleteData -- PAGE FOLLOWS]]<br />
<br />
<br />
== Security ==<br />
Next to the point of easy access this resource has its focus on security.<br />
You can specify how much protection you want to have for your data:<br />
* '''Server protection''' - With this only the server that has created the file will be able to read/modify/delete it.<br />
* '''Encryption''' - With this the stored data will be encrypted by a generated key, making it unreadable and unmodifyable by humans.<br />
* '''Resource protection''' - With this only the resource that has created the file will be able to read/modify/delete it.<br />
<br />
Note: No matter what settings you use - no server will have access to any file without its specific filename.<br />
<br />
<br />
=== Key generation / Data encryption ===<br />
If you want to save your data encrypted the script will generate a random key and stores it, so that the file can get read again.<br />
If you enable server protection for the file, the key can also only be read by the same server that has generated the data file.<br />
The same also goes for the resource protection.<br />
<br />
<br />
=== Security Levels ===<br />
Instead of manually adding bool parameters to the functions you can also just pass the security level you want to use for each function:<br />
* '''0''' - No protection (any server, any resource or humans could read/modify)<br />
* '''1''' - Very low protection (creator resource on any server or humans could read/modify)<br />
* '''2''' - Very low protection (any resource on any server could read/modify, humans cant)<br />
* '''3''' - Low protection (only creator resource on any server could read/modify, humans cant)<br />
* '''4''' - Medium protection (any resource on the creator server or humans could read/modify) - DEFAULT<br />
* '''5''' - Medium protection (only creator resource on the creator server or humans could read/modify)<br />
* '''6''' - High protection (any resource on the creator server could read/modify, humans cant)<br />
* '''7''' - Very high protection (only creator resource on creator server could read/modify, humans cant.<br />
<br />
<br />
== Simplifying the export ==<br />
For simplifying reasons I recommend the use this shortcut variable to call the exported functions:<br />
<br />
<syntaxhighlight lang="lua"><br />
local xml = exports.xmlData -- Define this variable at the top of your script<br />
<br />
-- And then use it like this for example:<br />
xml:xmlSaveData("yourFileName", yourData)<br />
</syntaxhighlight><br />
<br />
<br />
== Variables and Specified Names ==<br />
In the exported functions are some names which I will explain here to keep the function pages as clean and small as possible.<br />
<br />
=== serverProtected / Creator-Server ===<br />
With '''creator-server''' I mean the server that has created a file.<br />
So if a file is serverProtected only the server that called the function is able to read/modify/delete it.<br><br />
This includes client-side: The function call have been on the client-side of any server, so the link to the server exist anyways.<br />
<br />
=== resourceProtected / Creator-Resource ===<br />
With '''creator-resource''' I mean the resource that has created a file.<br />
Example how it works: If you call xmlSaveData with resourceProtection from resource "login", only "login" will then be able to read that xml file.<br><br />
If you don't use serverProtection in combination to this, every "login" resource on any server COULD read that file if it calls xmlLoadData with the correct file name.<br />
<br />
<br />
== Data type warning ==<br />
'''This resource will save everything, no matter what you give as data input.'''<br><br />
So be sure that there is no userdata stored inside the table you are passing to the xmlSaveData function.<br />
In case you have any kind of userdata it will output warnings in the debugscript - you should fix that by removing all userdata from the input table, because: Any Userdata is temporary. It will change after a script restart, reconnect, server restart.. or even while a resource is running/ you are playing.<br />
<br />
<includeonly>[[Category:Resource]]</includeonnly></div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlData&diff=64287XmlData2019-09-12T18:22:36Z<p>Ceeser: </p>
<hr />
<div>{{Resource page}}<br />
<lowercasetitle /><br />
<br />
== INFO ==<br />
'''The documentation about this resource and its functions is not complete yet and will be continued (12.09.19)'''<br />
<br />
<br />
== Resource Information ==<br />
This resource let you save and load data in an [[XML]] File.<br><br />
It's an easy to use resource, providing 3 exported functions.<br><br />
<br />
<br />
== Download ==<br />
Download can be found at the [https://community.multitheftauto.com/ MTA community page -- LINK FOLLOWS].<br><br />
Resource developed by: [https://community.multitheftauto.com/index.php?p=profile&id=477820 Ceeser]<br />
<br />
<br />
== Exported functions ==<br />
'''Note: These functions are available for Server and Client'''<br />
* [[XmlSaveData|xmlSaveData]]<br />
* [[xmlLoadData|xmlLoadData]]<br />
* [[xmlDeleteData|xmlDeleteData -- PAGE FOLLOWS]]<br />
<br />
<br />
== Security ==<br />
Next to the point of easy access this resource has its focus on security.<br />
You can specify how much protection you want to have for your data:<br />
* '''Server protection''' - With this only the server that has created the file will be able to read/modify/delete it.<br />
* '''Encryption''' - With this the stored data will be encrypted by a generated key, making it unreadable and unmodifyable by humans.<br />
* '''Resource protection''' - With this only the resource that has created the file will be able to read/modify/delete it.<br />
<br />
Note: No matter what settings you use - no server will have access to any file without its specific filename.<br />
<br />
<br />
=== Key generation / Data encryption ===<br />
If you want to save your data encrypted the script will generate a random key and stores it, so that the file can get read again.<br />
If you enable server protection for the file, the key can also only be read by the same server that has generated the data file.<br />
The same also goes for the resource protection.<br />
<br />
<br />
=== Security Levels ===<br />
Instead of manually adding bool parameters to the functions you can also just pass the security level you want to use for each function:<br />
* '''0''' - No protection (any server, any resource or humans could read/modify)<br />
* '''1''' - Very low protection (creator resource on any server or humans could read/modify)<br />
* '''2''' - Very low protection (any resource on any server could read/modify, humans cant)<br />
* '''3''' - Low protection (only creator resource on any server could read/modify, humans cant)<br />
* '''4''' - Medium protection (any resource on the creator server or humans could read/modify) - DEFAULT<br />
* '''5''' - Medium protection (only creator resource on the creator server or humans could read/modify)<br />
* '''6''' - High protection (any resource on the creator server could read/modify, humans cant)<br />
* '''7''' - Very high protection (only creator resource on creator server could read/modify, humans cant.<br />
<br />
<br />
== Simplifying the export ==<br />
For simplifying reasons I recommend the use this shortcut variable to call the exported functions:<br />
<br />
<syntaxhighlight lang="lua"><br />
local xml = exports.xmlData -- Define this variable at the top of your script<br />
<br />
-- And then use it like this for example:<br />
xml:xmlSaveData("yourFileName", yourData)<br />
</syntaxhighlight><br />
<br />
<br />
== Variables and Specified Names ==<br />
In the exported functions are some names which I will explain here to keep the function pages as clean and small as possible.<br />
<br />
=== serverProtected / Creator-Server ===<br />
With '''creator-server''' I mean the server that has created a file.<br />
So if a file is serverProtected only the server that called the function is able to read/modify/delete it.<br><br />
This includes client-side: The function call have been on the client-side of any server, so the link to the server exist anyways.<br />
<br />
=== resourceProtected / Creator-Resource ===<br />
With '''creator-resource''' I mean the resource that has created a file.<br />
Example how it works: If you call xmlSaveData with resourceProtection from resource "login", only "login" will then be able to read that xml file.<br><br />
If you don't use serverProtection in combination to this, every "login" resource on any server COULD read that file if it calls xmlLoadData with the correct file name.<br />
<br />
<br />
== Data type warning ==<br />
'''This resource will save everything, no matter what you give as data input.'''<br><br />
So be sure that there is no userdata stored inside the table you are passing to the xmlSaveData function.<br />
In case you have any kind of userdata it will output warnings in the debugscript - you should fix that by removing all userdata from the input table, because: Any Userdata is temporary. It will change after a script restart, reconnect, server restart.. or even while a resource is running/ you are playing.<br />
<br />
<includeonly>[[Category:Resource]]</includeonnly></div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlData&diff=64286XmlData2019-09-12T18:19:11Z<p>Ceeser: </p>
<hr />
<div><pageclass class="resource" subcaption="Resource"></pageclass><br />
<lowercasetitle /><br />
<br />
== INFO ==<br />
'''The documentation about this resource and its functions is not complete yet and will be continued (12.09.19)'''<br />
<br />
<br />
== Resource Information ==<br />
This resource let you save and load data in an [[XML]] File.<br><br />
It's an easy to use resource, providing 3 exported functions.<br><br />
<br />
<br />
== Download ==<br />
Download can be found at the [https://community.multitheftauto.com/ MTA community page -- LINK FOLLOWS].<br><br />
Resource developed by: [https://community.multitheftauto.com/index.php?p=profile&id=477820 Ceeser]<br />
<br />
<br />
== Exported functions ==<br />
'''Note: These functions are available for Server and Client'''<br />
* [[XmlSaveData|xmlSaveData]]<br />
* [[xmlLoadData|xmlLoadData]]<br />
* [[xmlDeleteData|xmlDeleteData -- PAGE FOLLOWS]]<br />
<br />
<br />
== Security ==<br />
Next to the point of easy access this resource has its focus on security.<br />
You can specify how much protection you want to have for your data:<br />
* '''Server protection''' - With this only the server that has created the file will be able to read/modify/delete it.<br />
* '''Encryption''' - With this the stored data will be encrypted by a generated key, making it unreadable and unmodifyable by humans.<br />
* '''Resource protection''' - With this only the resource that has created the file will be able to read/modify/delete it.<br />
<br />
Note: No matter what settings you use - no server will have access to any file without its specific filename.<br />
<br />
<br />
=== Key generation / Data encryption ===<br />
If you want to save your data encrypted the script will generate a random key and stores it, so that the file can get read again.<br />
If you enable server protection for the file, the key can also only be read by the same server that has generated the data file.<br />
The same also goes for the resource protection.<br />
<br />
<br />
=== Security Levels ===<br />
Instead of manually adding bool parameters to the functions you can also just pass the security level you want to use for each function:<br />
* '''0''' - No protection (any server, any resource or humans could read/modify)<br />
* '''1''' - Very low protection (creator resource on any server or humans could read/modify)<br />
* '''2''' - Very low protection (any resource on any server could read/modify, humans cant)<br />
* '''3''' - Low protection (only creator resource on any server could read/modify, humans cant)<br />
* '''4''' - Medium protection (any resource on the creator server or humans could read/modify) - DEFAULT<br />
* '''5''' - Medium protection (only creator resource on the creator server or humans could read/modify)<br />
* '''6''' - High protection (any resource on the creator server could read/modify, humans cant)<br />
* '''7''' - Very high protection (only creator resource on creator server could read/modify, humans cant.<br />
<br />
<br />
== Simplifying the export ==<br />
For simplifying reasons I recommend the use this shortcut variable to call the exported functions:<br />
<br />
<syntaxhighlight lang="lua"><br />
local xml = exports.xmlData -- Define this variable at the top of your script<br />
<br />
-- And then use it like this for example:<br />
xml:xmlSaveData("yourFileName", yourData)<br />
</syntaxhighlight><br />
<br />
<br />
== Variables and Specified Names ==<br />
In the exported functions are some names which I will explain here to keep the function pages as clean and small as possible.<br />
<br />
=== serverProtected / Creator-Server ===<br />
With '''creator-server''' I mean the server that has created a file.<br />
So if a file is serverProtected only the server that called the function is able to read/modify/delete it.<br><br />
This includes client-side: The function call have been on the client-side of any server, so the link to the server exist anyways.<br />
<br />
=== resourceProtected / Creator-Resource ===<br />
With '''creator-resource''' I mean the resource that has created a file.<br />
Example how it works: If you call xmlSaveData with resourceProtection from resource "login", only "login" will then be able to read that xml file.<br><br />
If you don't use serverProtection in combination to this, every "login" resource on any server COULD read that file if it calls xmlLoadData with the correct file name.<br />
<br />
<br />
== Data type warning ==<br />
'''This resource will save everything, no matter what you give as data input.'''<br><br />
So be sure that there is no userdata stored inside the table you are passing to the xmlSaveData function.<br />
In case you have any kind of userdata it will output warnings in the debugscript - you should fix that by removing all userdata from the input table, because: Any Userdata is temporary. It will change after a script restart, reconnect, server restart.. or even while a resource is running/ you are playing.<br />
<br />
<includeonly>[[Category:Resource]]</includeonnly></div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlData&diff=64285XmlData2019-09-12T18:18:21Z<p>Ceeser: </p>
<hr />
<div><pageclass class="resource" subcaption="Resource"></pageclass><br />
<lowercasetitle /><br />
<br />
== INFO ==<br />
'''The documentation about this resource and its functions is not complete yet and will be continued (12.09.19)'''<br />
<br />
<br />
== Resource Information ==<br />
This resource let you save and load data in an [[XML]] File.<br><br />
It's an easy to use resource, providing 3 exported functions.<br><br />
<br />
<br />
== Download ==<br />
Download can be found at the [https://community.multitheftauto.com/ MTA community page -- LINK FOLLOWS].<br><br />
Resource developed by: [https://community.multitheftauto.com/index.php?p=profile&id=477820 Ceeser]<br />
<br />
<br />
== Exported functions ==<br />
'''Note: These functions are available for Server and Client'''<br />
* [[XmlSaveData|xmlSaveData]]<br />
* [[xmlLoadData|xmlLoadData -- PAGE FOLLOWS]]<br />
* [[xmlDeleteData|xmlDeleteData -- PAGE FOLLOWS]]<br />
<br />
<br />
== Security ==<br />
Next to the point of easy access this resource has its focus on security.<br />
You can specify how much protection you want to have for your data:<br />
* '''Server protection''' - With this only the server that has created the file will be able to read/modify/delete it.<br />
* '''Encryption''' - With this the stored data will be encrypted by a generated key, making it unreadable and unmodifyable by humans.<br />
* '''Resource protection''' - With this only the resource that has created the file will be able to read/modify/delete it.<br />
<br />
Note: No matter what settings you use - no server will have access to any file without its specific filename.<br />
<br />
<br />
=== Key generation / Data encryption ===<br />
If you want to save your data encrypted the script will generate a random key and stores it, so that the file can get read again.<br />
If you enable server protection for the file, the key can also only be read by the same server that has generated the data file.<br />
The same also goes for the resource protection.<br />
<br />
<br />
=== Security Levels ===<br />
Instead of manually adding bool parameters to the functions you can also just pass the security level you want to use for each function:<br />
* '''0''' - No protection (any server, any resource or humans could read/modify)<br />
* '''1''' - Very low protection (creator resource on any server or humans could read/modify)<br />
* '''2''' - Very low protection (any resource on any server could read/modify, humans cant)<br />
* '''3''' - Low protection (only creator resource on any server could read/modify, humans cant)<br />
* '''4''' - Medium protection (any resource on the creator server or humans could read/modify) - DEFAULT<br />
* '''5''' - Medium protection (only creator resource on the creator server or humans could read/modify)<br />
* '''6''' - High protection (any resource on the creator server could read/modify, humans cant)<br />
* '''7''' - Very high protection (only creator resource on creator server could read/modify, humans cant.<br />
<br />
<br />
== Simplifying the export ==<br />
For simplifying reasons I recommend the use this shortcut variable to call the exported functions:<br />
<br />
<syntaxhighlight lang="lua"><br />
local xml = exports.xmlData -- Define this variable at the top of your script<br />
<br />
-- And then use it like this for example:<br />
xml:xmlSaveData("yourFileName", yourData)<br />
</syntaxhighlight><br />
<br />
<br />
== Variables and Specified Names ==<br />
In the exported functions are some names which I will explain here to keep the function pages as clean and small as possible.<br />
<br />
=== serverProtected / Creator-Server ===<br />
With '''creator-server''' I mean the server that has created a file.<br />
So if a file is serverProtected only the server that called the function is able to read/modify/delete it.<br><br />
This includes client-side: The function call have been on the client-side of any server, so the link to the server exist anyways.<br />
<br />
=== resourceProtected / Creator-Resource ===<br />
With '''creator-resource''' I mean the resource that has created a file.<br />
Example how it works: If you call xmlSaveData with resourceProtection from resource "login", only "login" will then be able to read that xml file.<br><br />
If you don't use serverProtection in combination to this, every "login" resource on any server COULD read that file if it calls xmlLoadData with the correct file name.<br />
<br />
<br />
== Data type warning ==<br />
'''This resource will save everything, no matter what you give as data input.'''<br><br />
So be sure that there is no userdata stored inside the table you are passing to the xmlSaveData function.<br />
In case you have any kind of userdata it will output warnings in the debugscript - you should fix that by removing all userdata from the input table, because: Any Userdata is temporary. It will change after a script restart, reconnect, server restart.. or even while a resource is running/ you are playing.<br />
<br />
<includeonly>[[Category:Resource]]</includeonnly></div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlData&diff=64284XmlData2019-09-12T18:17:42Z<p>Ceeser: </p>
<hr />
<div><pageclass class="resource" subcaption="Resource"></pageclass><br />
<lowercasetitle /><br />
<br />
== INFO ==<br />
'''The documentation about this resource and its functions is not complete yet and will be continued (12.09.19)'''<br />
<br />
<br />
== Resource Information ==<br />
This resource let you save and load data in an [[XML]] File.<br><br />
It's an easy to use resource, providing 3 exported functions.<br><br />
<br />
<br />
== Download ==<br />
Download can be found at the [https://community.multitheftauto.com/ MTA community page -- LINK FOLLOWS].<br><br />
Resource developed by: [https://community.multitheftauto.com/index.php?p=profile&id=477820 Ceeser]<br />
<br />
<br />
== Exported functions ==<br />
'''Note: These functions are available for Server and Client'''<br />
* [[XmlSaveData|xmlSaveData]]<br />
* [[xmlLoadData|xmlLoadData -- PAGE FOLLOWS]]<br />
* [[xmlDeleteData|xmlDeleteData -- PAGE FOLLOWS]]<br />
<br />
<br />
== Security ==<br />
Next to the point of easy access this resource has its focus on security.<br />
You can specify how much protection you want to have for your data:<br />
* '''Server protection''' - With this only the server that has created the file will be able to read/modify/delete it.<br />
* '''Encryption''' - With this the stored data will be encrypted by a generated key, making it unreadable and unmodifyable by humans.<br />
* '''Resource protection''' - With this only the resource that has created the file will be able to read/modify/delete it.<br />
<br />
Note: No matter what settings you use - no server will have access to any file without its specific filename.<br />
<br />
<br />
=== Key generation / Data encryption ===<br />
If you want to save your data encrypted the script will generate a random key and stores it, so that the file can get read again.<br />
If you enable server protection for the file, the key can also only be read by the same server that has generated the data file.<br />
The same also goes for the resource protection.<br />
<br />
<br />
=== Security Levels ===<br />
Instead of manually adding bool parameters to the functions you can also just pass the security level you want to use for each function:<br />
* '''0''' - No protection (any server, any resource or humans could read/modify)<br />
* '''1''' - Very low protection (creator resource on any server or humans could read/modify)<br />
* '''2''' - Very low protection (any resource on any server could read/modify, humans cant)<br />
* '''3''' - Low protection (only creator resource on any server could read/modify, humans cant)<br />
* '''4''' - Medium protection (any resource on the creator server or humans could read/modify) - DEFAULT<br />
* '''5''' - Medium protection (only creator resource on the creator server or humans could read/modify)<br />
* '''6''' - High protection (any resource on the creator server could read/modify, humans cant)<br />
* '''7''' - Very high protection (only creator resource on creator server could read/modify, humans cant.<br />
<br />
<br />
== Simplifying the export ==<br />
For simplifying reasons I recommend the use this shortcut variable to call the exported functions:<br />
<br />
<syntaxhighlight lang="lua"><br />
local xml = exports.xmlData -- Define this variable at the top of your script<br />
<br />
-- And then use it like this for example:<br />
xml:xmlSaveData("yourFileName", yourData)<br />
</syntaxhighlight><br />
<br />
<br />
== Variables and Specified Names ==<br />
In the exported functions are some names which I will explain here to keep the function pages as clean and small as possible.<br />
<br />
=== serverProtected / Creator-Server ===<br />
With '''creator-server''' I mean the server that has created a file.<br />
So if a file is serverProtected only the server that called the function is able to read/modify/delete it.<br><br />
This includes client-side: The function call have been on the client-side of any server, so the link to the server exist anyways.<br />
<br />
=== resourceProtected / Creator-Resource ===<br />
With '''creator-resource''' I mean the resource that has created a file.<br />
Example how it works: If you call xmlSaveData with resourceProtection from resource "login", only "login" will then be able to read that xml file.<br><br />
If you don't use serverProtection in combination to this, every "login" resource on any server COULD read that file if it calls xmlLoadData with the correct file name.<br />
<br />
<br />
== Data type warning ==<br />
This resource will save everything, no matter what you give as data input.<br />
So be sure that there is no userdata stored inside the table you are passing to the xmlSaveData function.<br />
In case you have any kind of userdata it will output warnings in the debugscript - you should fix that by removing all userdata from the input table, because: Any Userdata is temporary. It will change after a script restart, reconnect, server restart.. or even while a resource is running/ you are playing.<br />
<br />
<includeonly>[[Category:Resource]]</includeonnly></div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlLoadData&diff=64283XmlLoadData2019-09-12T18:15:38Z<p>Ceeser: </p>
<hr />
<div><pageclass class="#228B22" subcaption="Useful Function - Shared"></pageclass><br />
<lowercasetitle></lowercasetitle><br />
<includeonly><br />
[[Category:Useful Functions]]<br />
</includeonly><br />
<br />
{{Important Note|<br />
This is an unofficial MTA function, so its not included into the game by default.<br><br />
Its an exported function of the [[xmlData]] resource.<br><br />
To access this function you need to have the resource running on your server.}}<br />
<br />
<br />
This function provides an automated way of loading your data from an [[XML]] file created by [[xmlSaveData]] <br><br />
To call it, see the [[call]] function or the tip in this resources page: [https://wiki.multitheftauto.com/wiki/XmlData#Simplifying_the_export Simplifying the export]<br />
<br />
<br />
= Info =<br />
'''For proper data loading you need to pass the same booleans / securityLevel as you did on xmlSaveData.'''<br><br />
'''If you called [[xmlSaveData]] with passing the securityLevel its recommended to pick securityLevel as function paremeter for the loading as well.'''<br />
<br />
<br />
= Syntax =<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, bool serverProtected = true, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, int securityLevel = 4 ] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to load.<br />
<br />
====Optional Arguments====<br />
*'''serverProtected:''' If set to ''true'' it can only read the file of the creator-server, otherwise it doesn't care which server created it.<br />
*'''resourceProtected:''' If set to ''true'' it can only read the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which your data is stored at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns a ''table'' containing the files data, an empty ''table'' if there is no data stored inside the file, ''false'' and debug output in case if failure.<br />
<br />
'''Note: There is no encryption parameter in this function, because xmlLoadData will load and use a files key if it is encrypted.'''<br />
</section><br />
<br />
<section name="Server" class="server" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to load.<br />
<br />
====Optional Arguments====<br />
*'''resourceProtected:''' If set to ''true'' it can only read the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which your data is stored at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns a ''table'' containing the files data, an empty ''table'' if there is no data stored inside the file, ''false'' and debug output in case if failure.<br />
<br />
'''Note1: There is no encryption parameter, because xmlLoadData will load and use a files key if it is encrypted.'''<br><br />
'''Note2: There is no serverProtected parameter, because its server-side already anyways.<br />
</section><br />
<br />
<br />
== Example ==<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
-- Lets assume we created a encrypted, serverProtected file called "settings" already.<br />
local xml = exports.xmlData<br />
local tblSettings = xml:xmlLoadData("settings" true) -- serverProtected is true, resourceProtected false - false doesnt need to get passed here<br />
-- OR you can do this:<br />
local tblSettings = xml:xmlLoadData("settings" 6) -- securityLevel 6 equals serverProtected, encrypted, not resouceProtected - the encryption bool will be ignored at xmlLoadData<br />
</syntaxhighlight><br />
</section></div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlLoadData&diff=64282XmlLoadData2019-09-12T18:14:30Z<p>Ceeser: </p>
<hr />
<div><pageclass class="#228B22" subcaption="Useful Function - Shared"></pageclass><br />
<lowercasetitle></lowercasetitle><br />
<includeonly><br />
[[Category:Useful Functions]]<br />
</includeonly><br />
<br />
{{Important Note|<br />
This is an unofficial MTA function, so its not included into the game by default.<br><br />
Its an exported function of the [[xmlData]] resource.<br><br />
To access this function you need to have the resource running on your server.}}<br />
<br />
<br />
This function provides an automated way of loading your data from an [[XML]] file created by [[xmlSaveData]] <br><br />
To call it, see the [[call]] function or the tip in this resources page: [https://wiki.multitheftauto.com/wiki/XmlData#Simplifying_the_export Simplifying the export]<br />
<br />
<br />
= Info =<br />
'''For proper data loading you need to pass the same booleans / securityLevel as you did on xmlSaveData.'''<br><br />
'''If you called [[xmlSaveData]] with passing the securityLevel its recommended to pick securityLevel as function paremeter for the loading as well.'''<br />
<br />
<br />
= Syntax =<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, bool serverProtected = true, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, int securityLevel = 4 ] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to load.<br />
<br />
====Optional Arguments====<br />
*'''serverProtected:''' If set to ''true'' it can only read the file of the creator-server, otherwise it doesn't care which server created it.<br />
*'''resourceProtected:''' If set to ''true'' it can only read the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which your data is stored at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns a ''table'' containing the files data, an empty ''table'' if there is no data stored inside the file, ''false'' and debug output in case if failure.<br />
<br />
'''Note: There is no encryption parameter in this function, because xmlLoadData will load and use a files key if it is encrypted.'''<br />
</section><br />
<br />
<section name="Server" class="server" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to load.<br />
<br />
====Optional Arguments====<br />
*'''resourceProtected:''' If set to ''true'' it can only read the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which your data is stored at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns a ''table'' containing the files data, an empty ''table'' if there is no data stored inside the file, ''false'' and debug output in case if failure.<br />
<br />
'''Note1: There is no encryption parameter, because xmlLoadData will load and use a files key if it is encrypted.'''<br />
'''Note2: There is no serverProtected parameter, because its server-side already anyways.<br />
</section><br />
<br />
<br />
== Example ==<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
-- Lets assume we created a encrypted, serverProtected file called "settings" already.<br />
local xml = exports.xmlData<br />
local tblSettings = xml:xmlLoadData("settings" true) -- serverProtected is true, resourceProtected false - false doesnt need to get passed here<br />
-- OR you can do this:<br />
local tblSettings = xml:xmlLoadData("settings" 6) -- securityLevel 6 equals serverProtected, encrypted, not resouceProtected - the encryption bool will be ignored at xmlLoadData<br />
</syntaxhighlight><br />
</section></div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlLoadData&diff=64281XmlLoadData2019-09-12T18:13:50Z<p>Ceeser: </p>
<hr />
<div><pageclass class="#228B22" subcaption="Useful Function - Shared"></pageclass><br />
<lowercasetitle></lowercasetitle><br />
<includeonly><br />
[[Category:Useful Functions]]<br />
</includeonly><br />
<br />
{{Important Note|<br />
This is an unofficial MTA function, so its not included into the game by default.<br><br />
Its an exported function of the [[xmlData]] resource.<br><br />
To access this function you need to have the resource running on your server.}}<br />
<br />
<br />
This function provides an automated way of loading your data from an [[XML]] file created by [[xmlSaveData]] <br><br />
To call it, see the [[call]] function or the tip in this resources page: [https://wiki.multitheftauto.com/wiki/XmlData#Simplifying_the_export Simplifying the export]<br />
<br />
<br />
= Info =<br />
'''For proper data loading you need to pass the same booleans / securityLevel as you did on xmlSaveData.'''<br><br />
'''If you called [[xmlSaveData]] with passing the securityLevel its recommended to pick securityLevel as function paremeter for the loading as well.'''<br />
<br />
<br />
= Syntax =<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, bool serverProtected = true, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, int securityLevel = 4 ] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to create<br />
<br />
====Optional Arguments====<br />
*'''serverProtected:''' If set to ''true'' it can only read the file of the creator-server, otherwise it doesn't care which server created it.<br />
*'''resourceProtected:''' If set to ''true'' it can only read the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which your data is stored at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns a ''table'' containing the files data, an empty ''table'' if there is no data stored inside the file, ''false'' and debug output in case if failure.<br />
<br />
'''Note: There is no encryption parameter in this function, because xmlLoadData will load and use a files key if it is encrypted.'''<br />
</section><br />
<br />
<section name="Server" class="server" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to create<br />
<br />
====Optional Arguments====<br />
*'''resourceProtected:''' If set to ''true'' it can only read the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which your data is stored at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns a ''table'' containing the files data, an empty ''table'' if there is no data stored inside the file, ''false'' and debug output in case if failure.<br />
<br />
'''Note1: There is no encryption parameter, because xmlLoadData will load and use a files key if it is encrypted.'''<br />
'''Note2: There is no serverProtected parameter, because its server-side already anyways.<br />
</section><br />
<br />
<br />
== Example ==<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
-- Lets assume we created a encrypted, serverProtected file called "settings" already.<br />
local xml = exports.xmlData<br />
local tblSettings = xml:xmlLoadData("settings" true) -- serverProtected is true, resourceProtected false - false doesnt need to get passed here<br />
-- OR you can do this:<br />
local tblSettings = xml:xmlLoadData("settings" 6) -- securityLevel 6 equals serverProtected, encrypted, not resouceProtected - the encryption bool will be ignored at xmlLoadData<br />
</syntaxhighlight><br />
</section></div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlLoadData&diff=64280XmlLoadData2019-09-12T18:13:36Z<p>Ceeser: </p>
<hr />
<div><pageclass class="#228B22" subcaption="Useful Function - Shared"></pageclass><br />
<lowercasetitle></lowercasetitle><br />
<includeonly><br />
[[Category:Useful Functions]]<br />
</includeonly><br />
<br />
{{Important Note|<br />
This is an unofficial MTA function, so its not included into the game by default.<br><br />
Its an exported function of the [[xmlData]] resource.<br><br />
To access this function you need to have the resource running on your server.}}<br />
<br />
<br />
This function provides an automated way of loading your data from an [[XML]] file created by [[xmlSaveData]] <br><br />
To call it, see the [[call]] function or the tip in this resources page: [https://wiki.multitheftauto.com/wiki/XmlData#Simplifying_the_export Simplifying the export]<br />
<br />
<br />
= Info =<br />
'''For proper data loading you need to pass the same booleans / securityLevel as you did on xmlSaveData.'''<br><br />
'''If you called [[xmlSaveData]] with passing the securityLevel its recommended to pick securityLevel as function paremeter for the loading as well.'''<br />
<br />
<br />
= Syntax =<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, bool serverProtected = true, bool resourceProtected = false ] )<br />
<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, int securityLevel = 4 ] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to create<br />
<br />
====Optional Arguments====<br />
*'''serverProtected:''' If set to ''true'' it can only read the file of the creator-server, otherwise it doesn't care which server created it.<br />
*'''resourceProtected:''' If set to ''true'' it can only read the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which your data is stored at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns a ''table'' containing the files data, an empty ''table'' if there is no data stored inside the file, ''false'' and debug output in case if failure.<br />
<br />
'''Note: There is no encryption parameter in this function, because xmlLoadData will load and use a files key if it is encrypted.'''<br />
</section><br />
<br />
<section name="Server" class="server" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to create<br />
<br />
====Optional Arguments====<br />
*'''resourceProtected:''' If set to ''true'' it can only read the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which your data is stored at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns a ''table'' containing the files data, an empty ''table'' if there is no data stored inside the file, ''false'' and debug output in case if failure.<br />
<br />
'''Note1: There is no encryption parameter, because xmlLoadData will load and use a files key if it is encrypted.'''<br />
'''Note2: There is no serverProtected parameter, because its server-side already anyways.<br />
</section><br />
<br />
<br />
== Example ==<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
-- Lets assume we created a encrypted, serverProtected file called "settings" already.<br />
local xml = exports.xmlData<br />
local tblSettings = xml:xmlLoadData("settings" true) -- serverProtected is true, resourceProtected false - false doesnt need to get passed here<br />
-- OR you can do this:<br />
local tblSettings = xml:xmlLoadData("settings" 6) -- securityLevel 6 equals serverProtected, encrypted, not resouceProtected - the encryption bool will be ignored at xmlLoadData<br />
</syntaxhighlight><br />
</section></div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlLoadData&diff=64279XmlLoadData2019-09-12T18:13:06Z<p>Ceeser: </p>
<hr />
<div><pageclass class="#228B22" subcaption="Useful Function - Shared"></pageclass><br />
<lowercasetitle></lowercasetitle><br />
<includeonly><br />
[[Category:Useful Functions]]<br />
</includeonly><br />
<br />
{{Important Note|<br />
This is an unofficial MTA function, so its not included into the game by default.<br><br />
Its an exported function of the [[xmlData]] resource.<br><br />
To access this function you need to have the resource running on your server.}}<br />
<br />
<br />
This function provides an automated way of loading your data from an [[XML]] file created by [[xmlSaveData]] <br><br />
To call it, see the [[call]] function or the tip in this resources page: [https://wiki.multitheftauto.com/wiki/XmlData#Simplifying_the_export Simplifying the export]<br />
<br />
<br />
= Info =<br />
'''For proper data loading you need to pass the same booleans/securityLevel as you did on xmlSaveData.'''<br><br />
'''If you called [[xmlSaveData]] with passing the securityLevel its recommended to pick securityLevel as function paremeter for the loading as well.'''<br />
<br />
<br />
= Syntax =<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, bool serverProtected = true, bool resourceProtected = false ] )<br />
<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, int securityLevel = 4 ] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to create<br />
<br />
====Optional Arguments====<br />
*'''serverProtected:''' If set to ''true'' it can only read the file of the creator-server, otherwise it doesn't care which server created it.<br />
*'''resourceProtected:''' If set to ''true'' it can only read the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which your data is stored at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns a ''table'' containing the files data, an empty ''table'' if there is no data stored inside the file, ''false'' and debug output in case if failure.<br />
<br />
'''Note: There is no encryption parameter in this function, because xmlLoadData will load and use a files key if it is encrypted.'''<br />
</section><br />
<br />
<section name="Server" class="server" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to create<br />
<br />
====Optional Arguments====<br />
*'''resourceProtected:''' If set to ''true'' it can only read the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which your data is stored at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns a ''table'' containing the files data, an empty ''table'' if there is no data stored inside the file, ''false'' and debug output in case if failure.<br />
<br />
'''Note1: There is no encryption parameter, because xmlLoadData will load and use a files key if it is encrypted.'''<br />
'''Note2: There is no serverProtected parameter, because its server-side already anyways.<br />
</section><br />
<br />
<br />
== Example ==<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
-- Lets assume we created a encrypted, serverProtected file called "settings" already.<br />
local xml = exports.xmlData<br />
local tblSettings = xml:xmlLoadData("settings" true) -- serverProtected is true, resourceProtected false - false doesnt need to get passed here<br />
-- OR you can do this:<br />
local tblSettings = xml:xmlLoadData("settings" 6) -- securityLevel 6 equals serverProtected, encrypted, not resouceProtected - the encryption bool will be ignored at xmlLoadData<br />
</syntaxhighlight><br />
</section></div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlLoadData&diff=64278XmlLoadData2019-09-12T18:11:46Z<p>Ceeser: </p>
<hr />
<div><pageclass class="#228B22" subcaption="Useful Function - Shared"></pageclass><br />
<lowercasetitle></lowercasetitle><br />
<includeonly><br />
[[Category:Useful Functions]]<br />
</includeonly><br />
<br />
{{Important Note|<br />
This is an unofficial MTA function, so its not included into the game by default.<br><br />
Its an exported function of the [[xmlData]] resource.<br><br />
To access this function you need to have the resource running on your server.}}<br />
<br />
<br />
This function provides an automated way of loading your data from an [[XML]] file created by [[xmlSaveData]] <br><br />
To call it, see the [[call]] function or the tip in this resources page: [https://wiki.multitheftauto.com/wiki/XmlData#Simplifying_the_export Simplifying the export]<br />
<br />
<br />
= Info =<br />
'''For proper data loading you need to pass the same booleans/securityLevel as you did on xmlSaveData.'''<br><br />
'''If you called [[xmlSaveData]] with passing the securityLevel its recommended to pick securityLevel as function paremeter for the loading as well.'''<br />
<br />
<br />
= Syntax =<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, bool serverProtected = true, bool resourceProtected = false ] )<br />
bool xmlLoadData ( string fileName [, int securityLevel = 4 ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to create<br />
<br />
====Optional Arguments====<br />
*'''serverProtected:''' If set to ''true'' it can only read the file of the creator-server, otherwise it doesn't care which server created it.<br />
*'''resourceProtected:''' If set to ''true'' it can only read the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which you want to store your data at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns a ''table'' containing the files data, an empty ''table'' if there is no data stored inside the file, ''false'' and debug output in case if failure.<br />
<br />
'''Note: There is no encryption parameter in this function, because xmlLoadData will load and use a files key if it is encrypted.'''<br />
</section><br />
<br />
<section name="Server" class="server" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( string fileName [, bool resourceProtected ] )<br />
bool xmlLoadData ( string fileName [, int securityLevel ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to create<br />
<br />
====Optional Arguments====<br />
*'''resourceProtected:''' If set to ''true'' it can only read the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which you want to store your data at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns a ''table'' containing the files data, an empty ''table'' if there is no data stored inside the file, ''false'' and debug output in case if failure.<br />
<br />
'''Note1: There is no encryption parameter, because xmlLoadData will load and use a files key if it is encrypted.'''<br />
'''Note2: There is no serverProtected parameter, because its server-side already anyways.<br />
</section><br />
<br />
<br />
== Example ==<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
-- Lets assume we created a encrypted, serverProtected file called "settings" already.<br />
local xml = exports.xmlData<br />
local tblSettings = xml:xmlLoadData("settings" true) -- serverProtected is true, resourceProtected false - false doesnt need to get passed here<br />
-- OR you can do this:<br />
local tblSettings = xml:xmlLoadData("settings" 6) -- securityLevel 6 equals serverProtected, encrypted, not resouceProtected - the encryption bool will be ignored at xmlLoadData<br />
</syntaxhighlight><br />
</section></div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlSaveData&diff=64277XmlSaveData2019-09-12T18:10:59Z<p>Ceeser: </p>
<hr />
<div><pageclass class="#228B22" subcaption="Useful Function - Shared"></pageclass><br />
<lowercasetitle></lowercasetitle><br />
<includeonly><br />
[[Category:Useful Functions]]<br />
</includeonly><br />
<br />
{{Important Note|<br />
This is an unofficial MTA function, so its not included into the game by default.<br><br />
Its an exported function of the [[xmlData]] resource.<br><br />
To access this function you need to have the resource running on your server.}}<br />
<br />
<br />
This function provides an automated way of loading your data from an [[XML]] file created by [[xmlSaveData]] <br><br />
To call it, see the [[call]] function or the tip in this resources page: [https://wiki.multitheftauto.com/wiki/XmlData#Simplifying_the_export Simplifying the export]<br />
<br />
<br />
= Syntax =<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, bool serverProtected = true, bool encryptData = false, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to create<br />
*'''data:''' The data you want to save (must be a table!)<br />
<br />
====Optional Arguments====<br />
*'''serverProtected:''' If set to ''true'' the script will protect the file so, that can only the creator server can access it.'''<br />
*'''encryptData:''' If set to ''true'' the script will generate a random key and use it to encrypt your stored data. '''Note: If you want to store "sensitive data", always use encryption!'''<br />
*'''resourceProtected:''' If set to ''true'' the script will add the sourceResource name (so the name of the resource from which it got called) to the fileName, preventing it from getting read/overwritten/deleted by any other resource. If set to ''false'' you can use this script to call/send/modify tables from different resources without the use of events/other export functions.<br />
or<br />
*'''securityLevel:''' The level of security on which you want to store your data at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns ''true'' if successful, ''false'' otherwise.<br />
</section><br />
<br />
<section name="Server" class="server" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, bool encryptData = false, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to create<br />
*'''data:''' The data you want to save (must be a table!)<br />
<br />
====Optional Arguments====<br />
*'''encryptData:''' If set to ''true'' the script will generate a random key and use it to encrypt your stored data. '''Note: If you want to store "sensitive data", always use encryption! (Account data should never be stored in serverside files - use a database instead!)'''<br />
*'''resourceProtected:''' If set to ''true'' the script will add the sourceResource name (so the name of the resource from which it got called) to the fileName, preventing it from getting read/overwritten/deleted by any other resource. If set to ''false'' you can use this script to call/send/modify tables from different resources without the use of events/other export functions.<br />
or<br />
*'''securityLevel:''' The level of security on which you want to store your data at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns ''true'' if successful, ''false'' otherwise.<br />
</section><br />
<br />
<br />
== Example ==<br />
<section name="Client" class="client" show="true"><br />
This is the script where we specify the export shortcut and the data table which we want to store.<br />
<syntaxhighlight lang="lua"><br />
local xml = exports.xmlData<br />
local tblScriptSettings = {posX = 800, posY = 500, sizeX = 500, sizeY = 300, settings = {show = true, tab = 1}}<br />
<br />
xml:xmlSaveData("myFileName", tblScriptSettings , true, true) -- Save the data as "myFileName"<br />
</syntaxhighlight><br />
<br />
This will create a server-protected, encrypted file on the clients computer called "myFileName.xml". Also it will generate a random generated key and stores it.<br><br />
The created file will -(could, because encrypted with a random key)- like this:<br />
<br />
<syntaxhighlight lang="xml"><br />
<root posY="VgEN0+TERhg=" posX="mjX4Tj5u6oM=" sizeX="VgEN0+TERhg=" sizeY="htgOMaZurQQ="><br />
<settings show="yeiNs/ne1Ks=" tab="OpijtdPvYqQ="></settings><br />
</root><br />
</syntaxhighlight><br />
</section></div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlLoadData&diff=64276XmlLoadData2019-09-12T18:06:13Z<p>Ceeser: </p>
<hr />
<div><pageclass class="#228B22" subcaption="Useful Function - Shared"></pageclass><br />
<lowercasetitle></lowercasetitle><br />
<includeonly><br />
[[Category:Useful Functions]]<br />
</includeonly><br />
<br />
{{Important Note|<br />
This is an unofficial MTA function, so its not included into the game by default.<br><br />
Its an exported function of the [[xmlData]] resource.<br><br />
To access this function you need to have the resource running on your server.}}<br />
<br />
<br />
This function provides an automated way of loading your data from an [[XML]] file created by [[xmlSaveData]] <br><br />
To call this function, see the [[call]] function or the tip in this resources page: [https://wiki.multitheftauto.com/wiki/XmlData#Simplifying_the_export Simplifying the export]<br />
<br />
<br />
= Info =<br />
'''If you used [[xmlSaveData]] with passing the securityLevel I recommend to pick securityLevel as function argument here as well.'''<br><br />
'''For proper data loading you need to pass the same booleans/securityLevel as you did on xmlSaveData.'''<br />
<br />
<br />
= Syntax =<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( fileName [, serverProtected, resourceProtected ] )<br />
bool xmlLoadData ( fileName [, int securityLevel ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to create<br />
<br />
====Optional Arguments====<br />
*'''serverProtected:''' If set to ''true'' it can only read the file of the creator-server, otherwise it doesn't care which server created it.<br />
*'''resourceProtected:''' If set to ''true'' it can only read the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which you want to store your data at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns a ''table'' containing the files data, an empty ''table'' if there is no data stored inside the file, ''false'' and debug output in case if failure.<br />
<br />
'''Note: There is no encryption parameter in this function, because xmlLoadData will load and use a files key if it is encrypted.'''<br />
</section><br />
<br />
<section name="Server" class="server" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( fileName [, resourceProtected ] )<br />
bool xmlLoadData ( fileName [, int securityLevel ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to create<br />
<br />
====Optional Arguments====<br />
*'''resourceProtected:''' If set to ''true'' it can only read the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which you want to store your data at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns a ''table'' containing the files data, an empty ''table'' if there is no data stored inside the file, ''false'' and debug output in case if failure.<br />
<br />
'''Note1: There is no encryption parameter, because xmlLoadData will load and use a files key if it is encrypted.'''<br />
'''Note2: There is no serverProtected parameter, because its server-side already anyways.<br />
</section><br />
<br />
<br />
== Example ==<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
-- Lets assume we created a encrypted, serverProtected file called "settings" already.<br />
local xml = exports.xmlData<br />
local tblSettings = xml:xmlLoadData("settings" true) -- serverProtected is true, resourceProtected false - false doesnt need to get passed here<br />
-- OR you can do this:<br />
local tblSettings = xml:xmlLoadData("settings" 6) -- securityLevel 6 equals serverProtected, encrypted, not resouceProtected - the encryption bool will be ignored at xmlLoadData<br />
</syntaxhighlight><br />
</section></div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlLoadData&diff=64275XmlLoadData2019-09-12T18:04:02Z<p>Ceeser: </p>
<hr />
<div><pageclass class="#228B22" subcaption="Useful Function - Shared"></pageclass><br />
<lowercasetitle></lowercasetitle><br />
<includeonly><br />
[[Category:Useful Functions]]<br />
</includeonly><br />
<br />
{{Important Note|<br />
This is an unofficial MTA function, so its not included into the game by default.<br><br />
Its an exported function of the [[xmlData]] resource.<br><br />
To access this function you need to have the resource running on your server.}}<br />
<br />
<br />
This function provides an automated way of loading your data from an [[XML]] file created by [[xmlSaveData]] <br><br />
To call this function, see the [[call]] function or the tip in this resources page: [https://wiki.multitheftauto.com/wiki/XmlData#Simplifying_the_export Simplifying the export]<br />
<br />
<br />
= Info =<br />
'''If you used [[xmlSaveData]] with passing the securityLevel I recommend to pick securityLevel as function argument here as well.'''<br><br />
'''For proper data loading you need to pass the same booleans/securityLevel as you did on xmlSaveData.'''<br />
<br />
<br />
= Syntax =<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( fileName [, serverProtected, resourceProtected ] )<br />
bool xmlLoadData ( fileName [, int securityLevel ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to create<br />
<br />
====Optional Arguments====<br />
*'''serverProtected:''' If set to ''true'' it can only read the file of the creator-server, otherwise it doesn't care which server created it.<br />
*'''resourceProtected:''' If set to ''true'' it can only read the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which you want to store your data at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns a ''table'' containing the files data, an empty ''table'' if there is no data stored inside the file, ''false'' and debug output in case if failure.<br />
<br />
'''Note: There is no encryption parameter in this function, because xmlLoadData will load and use a files key if it is encrypted.'''<br />
</section><br />
<br />
<section name="Server" class="server" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( fileName [, resourceProtected ] )<br />
bool xmlLoadData ( fileName [, int securityLevel ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to create<br />
<br />
====Optional Arguments====<br />
*'''resourceProtected:''' If set to ''true'' it can only read the file of the creator-resource, otherwise it doesn't care which resource created it.<br />
or<br />
*'''securityLevel:''' The level of security on which you want to store your data at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns a ''table'' containing the files data, an empty ''table'' if there is no data stored inside the file, ''false'' and debug output in case if failure.<br />
<br />
'''Note: There is no encryption parameter in this function, because xmlLoadData will load and use a files key if it is encrypted.'''<br />
</section><br />
<br />
<br />
== Example ==<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
-- Lets assume we created a encrypted, serverProtected file called "settings" already.<br />
local xml = exports.xmlData<br />
local tblSettings = xml:xmlLoadData("settings" true) -- serverProtected is true, resourceProtected false - false doesnt need to get passed here<br />
-- OR you can do this:<br />
local tblSettings = xml:xmlLoadData("settings" 6) -- securityLevel 6 equals serverProtected, encrypted, not resouceProtected - the encryption bool will be ignored at xmlLoadData<br />
</syntaxhighlight><br />
</section></div>Ceeserhttps://wiki.multitheftauto.com/index.php?title=XmlLoadData&diff=64274XmlLoadData2019-09-12T17:53:42Z<p>Ceeser: </p>
<hr />
<div><pageclass class="#228B22" subcaption="Useful Function - Shared"></pageclass><br />
<lowercasetitle></lowercasetitle><br />
<includeonly><br />
[[Category:Useful Functions]]<br />
</includeonly><br />
<br />
{{Important Note|<br />
This is an unofficial MTA function, so its not included into the game by default.<br><br />
Its an exported function of the [[xmlData]] resource.<br><br />
To access this function you need to have the resource running on your server.}}<br />
<br />
<br />
This function provides an automated way of loading your data from an [[XML]] file created by [[xmlSaveData]] <br><br />
To call this function, see the [[call]] function or the tip in this resources page: [https://wiki.multitheftauto.com/wiki/XmlData#Simplifying_the_export Simplifying the export]<br />
<br />
= Info =<br />
'''If you used [[xmlSaveData]] with passing the securityLevel I recommend to pick securityLevel as function argument here as well.'''<br />
'''For proper data loading you need to pass the same booleans/securityLevel as you did on xmlSaveData.'''<br />
<br />
= Syntax =<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlLoadData ( fileName [, serverProtected, resourceProtected ] )<br />
bool xmlLoadData ( fileName [, int securityLevel] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to create<br />
<br />
====Optional Arguments====<br />
*'''serverProtected:''' If set to ''true'' it can only read the file created by the same server, otherwise it doesn't care which server created it.<br />
*'''resourceProtected:''' If set to ''true'' it can only read the file created by the caller-resource<br />
or<br />
*'''securityLevel:''' The level of security on which you want to store your data at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns ''true'' if successful, ''false'' otherwise.<br />
<br />
'''Note: There is no encryption parameter in this function, because xmlLoadData will load and use a files key if it is encrypted.'''<br />
</section><br />
<br />
<section name="Server" class="server" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, bool encryptData = false, bool resourceProtected = false ] )<br />
</syntaxhighlight><br />
<br />
<syntaxhighlight lang="lua"><br />
bool xmlSaveData ( string fileName, table data [, int securityLevel = 4] )<br />
</syntaxhighlight><br />
<br />
====Required Arguments====<br />
*'''fileName:''' The name of the file you want to create<br />
<br />
====Optional Arguments====<br />
*'''encryptData:''' If set to ''true'' the script will generate a random key and use it to encrypt your stored data. '''Note: If you want to store "sensitive data", always use encryption! (Account data should never be stored in serverside files - use a database instead!)'''<br />
*'''resourceProtected:''' If set to ''true'' the script will add the sourceResource name (so the name of the resource from which it got called) to the fileName, preventing it from getting read/overwritten/deleted by any other resource. If set to ''false'' you can use this script to call/send/modify tables from different resources without the use of events/other export functions.<br />
or<br />
*'''securityLevel:''' The level of security on which you want to store your data at. (Details on the resource page: [https://wiki.multitheftauto.com/wiki/XmlData#Security_Levels Security Levels])<br />
<br />
'''See [https://wiki.multitheftauto.com/wiki/XmlData#Variables_and_Specified_Names xmlData Variables and Specified names] for more detail.'''<br />
<br />
===Returns===<br />
Returns ''true'' if successful, ''false'' otherwise.<br />
<br />
'''Note: There is no encryption parameter in this function, because xmlLoadData will load and use a files key if it is encrypted.'''<br />
</section><br />
<br />
<br />
== Example ==<br />
<section name="Client" class="client" show="true"><br />
This is the script where we specify the export shortcut and the data table which we want to store.<br />
<syntaxhighlight lang="lua"><br />
local xml = exports.xmlData<br />
local tblScriptSettings = {posX = 800, posY = 500, sizeX = 500, sizeY = 300, settings = {show = true, tab = 1}}<br />
<br />
xml:xmlSaveData("myFileName", tblScriptSettings , true, true) -- Save the data as "myFileName"<br />
</syntaxhighlight><br />
<br />
This will create a server-protected, encrypted file on the clients computer called "myFileName.xml". Also it will generate a random generated key and stores it.<br><br />
The created file will -(could, because encrypted with a random key)- like this:<br />
<br />
<syntaxhighlight lang="xml"><br />
<root posY="VgEN0+TERhg=" posX="mjX4Tj5u6oM=" sizeX="VgEN0+TERhg=" sizeY="htgOMaZurQQ="><br />
<settings show="yeiNs/ne1Ks=" tab="OpijtdPvYqQ="></settings><br />
</root><br />
</syntaxhighlight><br />
</section></div>Ceeser