Meta.xml

From GT-MP
Jump to: navigation, search

Meta.xml

Every resource must have this file. It defines information about the resource.

Tags

  • <info > Basic information about this resource. All of these are optional. These parameters can be retrieved from any resource.
    • name: Full name of the resource.
    • description: A brief description of your resource.
    • author: Name of the resource author(s).
    • version: Resource version.
    • type: What type of resource it is. It can be 'script', 'gamemode' or 'map.
    • gamemodes: Only used if the resource is a map. Comma delimited list of compatible gamemodes.
    • async: true or false value representing whether the resource should run in a single thread or run asynchroniously (if true it will call every invoked event in that resource async).
    • shadowcopy: true or false value representing whether compiled .dll files should be loaded in from the filesystem, or copied first. Set this to true to be able to update .dll files while debugging resources.
      NOTE: when using shadowcopy, the system may fail to load dependant .dll's, as it no longer knows the original directory of the loaded assembly. IMPORTANT: Its not supported by Linux Servers with Mono!
  • <script > Links a script file with your resource.
    • src: Relative path to your file.
    • type: Where the script runs: 'client' or 'server'
    • lang: Represents the language used in the script. Available options are 'javascript', 'csharp', 'vbasic' and 'compiled' if it's a .NET compiled assembly.
  • <file > Represents a file that must be downloaded to the client.
    • src: Relative path to your file.
  • <assembly > Declares a .NET reference to be used for your scripts.
    • ref: Relative path to your assembly
  • <include > List of resources that this resource depends on, and must be started before this one.
    • resource: Name of the resource.
  • <map > Represents a .map file
    • src: Relative path to your .map file
    • dimension: The dimension in which your map will be loaded.
  • <export > Used to export functions or events for other resources to use. You can only export methods located inside classes that inherit Script.
    • class: The class name in which this function or event is found. (Optional if you only have one class)
    • function: Name of the function to export.
    • event: Name of the event to export.
  • <acl > Additional rules to add to server's ACL. These may include commands that you dont wish everyone to have access to.
    • src: Relative path to the acl.xml file.
  • <config > Represents a custom XML config file to be loaded by a resource with API.loadConfig
    • src: Relative path to your config file.
    • type: 'server' if the config file is to be read serverside, 'client' if it's to be read by client scripts.
  • <settings > Declares a list of settings that the server administrator can easily change. You can also put these in a separate file, and then reference it with the src attribute.
    • <setting > Represents each setting.
      • name: Name of the setting, which will be used to retrieve it in scripts.
      • value: Value of the setting.
      • default: If the value cannot be found, or if it's invalid, this one will be used.
      • description: brief setting description for the server administrator.

Example

This meta.xml file is a mix of various meta.xml files found in the example resources.

<meta>
    <info name="Door Manager" description="Helper resource to control the game's doors." author="Guadmaz" version="1.0" shadowcopy="true" />

    <script src="doormanager.cs" type="server" lang="csharp" />
    <script src="doormanager.js" type="client" lang="javascript" />

    <export function="registerDoor" class="DoorManager" />
    <export function="removeDoor" class="DoorManager" />
    <export function="setDoorState" class="DoorManager" />
    <export function="getCloseDoor" class="DoorManager" />
    <export function="getAllCloseDoors" class="DoorManager" />
    <export function="refreshDoorState" class="DoorManager" />
    <export function="transitionDoor" class="DoorManager" />

    <export function="setDebug" class="DoorManager" />

    <file src="skeletor.png" />

    <assembly ref="System.Xml.Serialization.dll" />
    <assembly ref="System.Xml.dll" />

    <include resource="scoreboard" />

    <settings>
        <setting name="votelength" value="60000" default="60000" description="Vote length in milliseconds" />
        <setting name="votecooldown" value="60000" default="60000" description="Cool down between votes." />

        <setting name="enablevotemap" value="true" default="true" description="Sets whether /votemap command is enabled." />
        <setting name="enablevotekick" value="true" default="true" description="Sets whether /votekick command is enabled." />
    </settings>
</meta>