XmlData: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 4: Line 4:
== INFO ==
== INFO ==
'''The documentation about this resource and its functions is not complete yet'''
'''The documentation about this resource and its functions is not complete yet'''


== Resource Information ==
== Resource Information ==

Revision as of 17:10, 11 September 2019

INFO

The documentation about this resource and its functions is not complete yet


Resource Information

This resource let you save and load data in an XML File.
It's an easy to use resource, providing 3 exported functions.


Download

Download can be found at the MTA community page -- LINK FOLLOWS.
Resource developed by: Ceeser


Exported functions

Note: These functions are available for Server and Client


Security

Next to the point of easy access this resource has its focus on security. You can specify how much protection you want to have for your data:

  • Server protection - With this only the server that has created the file will be able to read/modify/delete it.
  • Encryption - With this the stored data will be encrypted by a generated key, making it unreadable and unmodifyable by humans.
  • Resource protection - With this only the resource that has created the file will be able to read/modify/delete it.

Note: No matter what settings you use - no server will have access to any file without its specific filename.


Key generation / Data encryption

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. 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. The same also goes for the resource protection.


Security Levels

Instead of manually adding bool parameters to the functions you can also just pass the security level you want to use for each function:

  • 0 - No protection (any server, any resource or humans could read/modify)
  • 1 - Very low protection (creator resource on any server or humans could read/modify)
  • 2 - Very low protection (any resource on any server could read/modify, humans cant)
  • 3 - Low protection (only creator resource on any server could read/modify, humans cant)
  • 4 - Medium protection (any resource on the creator server or humans could read/modify) - DEFAULT
  • 5 - Medium protection (only creator resource on the creator server or humans could read/modify)
  • 6 - High protection (any resource on the creator server could read/modify, humans cant)
  • 7 - Very high protection (only creator resource on creator server could read/modify, humans cant.


Simplifying the export

For simplifying reasons I recommend the use this shortcut variable to call the exported functions:

local xml = exports.xmlData -- Define this variable at the top of your script

-- And then use it like this for example:
xml:xmlSaveData("yourFileName", yourData)


Data type warning

This resource will save everything, no matter what you give as data input. So be sure that there is no userdata stored inside the table you are passing to the xmlSaveData function. 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.