XmlSaveData: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 4: Line 4:
[[Category:Useful Functions]]
[[Category:Useful Functions]]
</includeonly>
</includeonly>
<lowercasetitle />
 
<section name="Server" class="server" show="true">
<section name="Client" class="client" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool xmlSaveData ( string fileName, table data [, bool serverProtected = true, bool encryptData = false, bool resourceProtected = false ] )
bool xmlSaveData ( string fileName, table data [, bool serverProtected = true, bool encryptData = false, bool resourceProtected = false ] )
Line 20: Line 20:
====Optional Arguments====
====Optional Arguments====
*'''serverProtected:''' If set to ''true'' the script will protect the file so, that can only the creator server can access it.'''
*'''serverProtected:''' If set to ''true'' the script will protect the file so, that can only the creator server can access it.'''
*'''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!)'''
*'''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.
or
*'''securityLevel:''' The level of security on which you want to store your data at as listed below:
===Returns===
Returns ''true'' if successful, ''false'' otherwise.
</section>
<section name="Server" class="server" show="true">
<syntaxhighlight lang="lua">
bool xmlSaveData ( string fileName, table data [, bool encryptData = false, bool resourceProtected = false ] )
</syntaxhighlight>
<syntaxhighlight lang="lua">
bool xmlSaveData ( string fileName, table data [, int securityLevel = 4] )
</syntaxhighlight>
====Required Arguments====
*'''fileName:''' The name of the file you want to create
*'''data:''' The data you want to save (must be a table!)
====Optional Arguments====
*'''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!)'''
*'''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!)'''
*'''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.
*'''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.

Revision as of 17:18, 11 September 2019


Click to collapse [-]
Client
bool xmlSaveData ( string fileName, table data [, bool serverProtected = true, bool encryptData = false, bool resourceProtected = false ] )
bool xmlSaveData ( string fileName, table data [, int securityLevel = 4] )

Required Arguments

  • fileName: The name of the file you want to create
  • data: The data you want to save (must be a table!)

Optional Arguments

  • serverProtected: If set to true the script will protect the file so, that can only the creator server can access it.
  • 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!)
  • 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.

or

  • securityLevel: The level of security on which you want to store your data at as listed below:

Returns

Returns true if successful, false otherwise.

Click to collapse [-]
Server
bool xmlSaveData ( string fileName, table data [, bool encryptData = false, bool resourceProtected = false ] )
bool xmlSaveData ( string fileName, table data [, int securityLevel = 4] )

Required Arguments

  • fileName: The name of the file you want to create
  • data: The data you want to save (must be a table!)

Optional Arguments

  • 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!)
  • 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.

or

  • securityLevel: The level of security on which you want to store your data at as listed below:

Returns

Returns true if successful, false otherwise.