Filepath: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 10: Line 10:
Note: Server side filepaths which refer to resources will work correctly even if the other resource is not running. However
Note: Server side filepaths which refer to resources will work correctly even if the other resource is not running. However
client side filepaths require the target resource to be running.
client side filepaths require the target resource to be running.
=== Client file security ===
{{New feature|3.0110|1.1|
{{New feature|3.0110|1.1|
To protect a client file from being read by another server, prepend the filepath with @ when the file is created
To protect a client file from being read by another server, prepend the filepath with @ when the file is created:
<br>e.g.:
  xmlCreateFile ( "@:myresource/someinfo.xml" )
  xmlCreateFile ( "@:myresource/someinfo.xml" )
  fileCreate ( "@listofthings.txt" )
  fileCreate ( "@listofthings.txt" )

Revision as of 11:48, 13 September 2011

A filepath is a path that leads up to a file. These are relative to the root directory of the resource it is being called from.

It is also possible to use special filepaths in order to reference files from other resources. This can be done with the following syntax

:<resourceName>/file.ext

So, for example

xmlLoadFile ( ":helpmanager/help.xml" )

Note: Server side filepaths which refer to resources will work correctly even if the other resource is not running. However client side filepaths require the target resource to be running.

Client file security

To protect a client file from being read by another server, prepend the filepath with @ when the file is created:

xmlCreateFile ( "@:myresource/someinfo.xml" )
fileCreate ( "@listofthings.txt" )

To read a private file, @ must also be prepended when the file is reopened:

xmlOpenFile ( "@:myresource/someinfo.xml" )
fileOpen ( "@listofthings.txt" )

Notes:

  • The filepath without @ is read/writeable by all servers.
  • The public and and all the private versions of a particular filepath can exist at the same time. Which one is accessed depends upon the usage of @ and the server that is currently connected.
  • The server file "mods/deathmatch/server-id.keys" is used for private file security. Keep a copy of it in a safe place!