XmlSaveData: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 5: | Line 5: | ||
</includeonly> | </includeonly> | ||
With this function you can save any data you want at a given fileName. | With this function you can save any data you want at a given fileName.<br> | ||
The data you want to store have to be passed as a table. | The data you want to store have to be passed as a table.<br> | ||
{{Important Note|This function is an exported function of the resource [[xmlData]]}} | {{Important Note|This function is an exported function of the resource [[xmlData]]}} | ||
Line 57: | Line 57: | ||
Returns ''true'' if successful, ''false'' otherwise. | Returns ''true'' if successful, ''false'' otherwise. | ||
</section> | </section> | ||
= 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. |
Revision as of 17:23, 11 September 2019
With this function you can save any data you want at a given fileName.
The data you want to store have to be passed as a table.
Important Note: This function is an exported function of the resource xmlData |
Syntax
Click to collapse [-]
Clientbool 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 [-]
Serverbool 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.
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.