Difference between revisions of "Meta.xml"

From Multi Theft Auto: Wiki
Jump to: navigation, search
Line 1: Line 1:
 
The ''meta.xml'' file presents MTA with a set of metadata, such as the resource's name, the scripts to include, and which files to precache for sending to clients among other things. It is also the scope of "elements". It is written in XML, which is based on HTML and is the parent of XHTML.
 
The ''meta.xml'' file presents MTA with a set of metadata, such as the resource's name, the scripts to include, and which files to precache for sending to clients among other things. It is also the scope of "elements". It is written in XML, which is based on HTML and is the parent of XHTML.
  
=Tagi=
+
=Tags=
XML jest tekstowym formatem danych, który jest stosowany do prezentacji danych. MTA wykorzystuje opartą na XML język do opisu metadanych dla zasobów przy użyciu tagów poniżej:
+
XML is a textual data format which is widely used for the representation of data. MTA uses an XML-based language to describe the metadata for resources by using the tags below:
  
 
+
*'''<info />''' Information about this resource, possible parameters include (any arbitrary parameters can be used and read using [[getResourceInfo]]):
** '''author:''' Autor tego zasobu.
+
** '''author:''' The author of this resource
** '''version:''' Wersja tego zasobu.
+
** '''version:''' The version of this resource
** '''name:''' Nazwa tego zasobu.
+
** '''name:''' The name of this resource
** '''description:''' Krótki opis tego zasobu.
+
** '''description:''' A brief description of this resource
** '''type:''' Typ tego zasobu, które mogą być w postaci "gamemode", "script", "map" i "misc".
+
** '''type:''' The type of this resource, that can be "gamemode", "script", "map" or "misc".
*'''<script />''' Kod źródłowy dla tego zasobu, możliwe parametry:
+
*'''<script />''' Source code for this resource, possible parameters are:
** '''src:''' Nazwa pliku z kodem źródłowym
+
** '''src:''' The file name of the source code
** '''type:''' Rodzaj kodu źródłowego: "client" lub "server"
+
** '''type:''' The type of source code: "client" or "server"
 
<!--
 
<!--
 
** '''protected:''' For client-side scripts, whether this script should or not be saved in the clients hard disk: "true" or "false". NOTE: [http://bugs.mtasa.com/view.php?id=6831 there might be a bug with this].
 
** '''protected:''' For client-side scripts, whether this script should or not be saved in the clients hard disk: "true" or "false". NOTE: [http://bugs.mtasa.com/view.php?id=6831 there might be a bug with this].
 
-->
 
-->
*'''<map />''' Mapa do gamemode, możliwe parametry:
+
*'''<map />''' The map for a gamemode, possible parameters are:
**'''src:''' nazwa pliku .map ( może być ścieżka np."mapy/nazwapliku.map" )
+
**'''src:''' .map file name (can be path too eg. "maps/filename.map")
**'''dimension:''' Wymiar w którym mapa zostanie załadowana
+
**'''dimension:''' Dimension in which the map will be loaded (optional)
*'''<file />''' Zdjęcia i pliki w rozmiaże .txd, .dll, .col lub .jpg.
+
*'''<file />''' A client-side file. Generally these are images, .txd, .col, .dff or .xml files. They'll be downloaded by clients when the resources is started (or on join)
**'''src:''' Po stronie clienta nazwa pliku ( może być też ścieżka np."zdjęcia/nazwa.jpg" )
+
**'''src:''' client-side file name (can be path too eg. "images/image.png")
*'''<include />''' Obejmują środki, które będą używać ten zasób
+
**'''download:''' Whether or not to be sent to the client automatically (optional). Default is "true" using "no" or "false" will mean they are not sent on resource start but could later be used by [[downloadFile]] (from version 1.4)
**'''resource:''' Nazwa zasobu, który chcesz uruchomić z tego zasobu
+
*'''<include />''' Include resources that this resource will use
**'''minversion:''' Minimalna wersja
+
**'''resource:''' Resource name that you want to start with this resource
**'''maxversion:''' Maxsymalna wersja
+
**'''minversion:''' Minimum version that '''resource''' needs to be (optional)
*'''<config />''' Config to poprostu XML, możliwe parametry:
+
**'''maxversion:''' Maximum version that '''resource''' needs to be (optional)
**'''src:''' Nazwa pliku z pliku konfiguracyjnego
+
*'''<config />''' Config file (.xml) can be accessed by resource, possible parameters are:
**'''type:''' Typ pliku konfiguracyjnym: "client" lub "server"
+
**'''src:''' The file name of the config file
*'''<export />''' Te funkcje eksportowane z tego zasobu, do innych zasobów może korzystać z nich [CALL []]
+
**'''type:''' The type of the config file: "client" or "server"
**'''function:''' Nazwa funkcji
+
*'''<export />''' This exports functions from this resource, so other resources can use them with [[call]]
**'''type''' Czy funkcja jest eksportowana po stronie servera lub po stronie clienta (ważne są następujące wartości: "server" i "client")
+
**'''function:''' The function name
**'''http:''' Czy funkcja jest wywoływana za pośrednictwem protokołu HTTP (true / false)
+
**'''type''' Whether function is exported server-side or client-side (valid values are: "server" and "client")
 +
**'''http:''' Can the function be called via HTTP (true/false)
 
*'''<html />'''
 
*'''<html />'''
**'''src:''' Nazwa pliku HTTP (może być ścieżka)
+
**'''src:''' The filename for the HTTP file (can be a path)
**'''default:''' Plik html jest jeden, który jest domyślnie wyświetlane podczas wizyty/resource Name/on the server. Tylko jeden html może być domyślne, reszta jest ignorowana. (true / false)
+
**'''default:''' The html file is one that is shown by default when visiting /resourceName/ on the server. Only one html can be default, the rest are ignored. (true/false)
**'''raw:''' Html nie jest przetwarzany przez interpreter LUA i jest traktowany jako dane binarne. Muszą być stosowane dla plików binarnych (zdjęcia głównie) (true / false)
+
**'''raw:''' The html file is not parsed by the LUA interpreter and is treated as binary data. Must be used for binary files (images mainly) (true/false)
*'''<settings> <setting name="" value=""/> </settings>:''' Większość gamemodes używać [[System Settings]], aby pozwolić administratorom serwerów skonfigurować go tak, jak im się podoba. Na przykład można ustawić okrągły czas, a następnie użyć [[dostać]] i [[zbiór]], aby uzyskać wartość lub ją zmienić, odpowiednio.
+
*'''<settings> <setting name="" value=""/> </settings>:''' Most gamemodes use [[settings system]] to let server admins to configure it how they like. For instance you could set round time and then use [[get]] and [[set]] to get the value or change it, respectively.
*'''<min_mta_version />''' Minimalne wymagania wersji dla tego zasobu do poprawnego działania. Kiedy zasoby autorskie, minimalna wersja powinna zwykle być ustawiony na bieżącej wydanej wersji MTA: SA (który w tej chwili jest "{{Current Version | pełny}}").
+
*'''<min_mta_version />''' Minimum version requirements for this resource to run correctly. When authoring resources, the minimum version should usually be set to the current released version of MTA:SA (which at the moment is "{{Current Version|full}}").
**'''client:''' Minimalna wersja clienta
+
**'''client:''' The minimum client version
**'''server:''' Minimalna wersja servera
+
**'''server:''' The minimum server version
*'''<aclrequest />''' Lista [[Access_Control_List | ACL]] prawa ten zasób będzie potrzebne.
+
*'''<aclrequest />''' A list of [[Access_Control_List|ACL]] rights this resource will need.
  
== Przykład ==
+
== Example ==
Oto przykład pliku meta przy niektórych znaczników wymienionych:
+
Heres an example of a meta file using some of the tags mentioned:
 
{{#tag:code |
 
{{#tag:code |
 
<meta>
 
<meta>
     <info name="race" author"SEBO" type="gamemode" version"1.0.0" />
+
     <info author="Slothman" type="gamemode" name="Stealth" />
 
     <config src="help.xml" type="client"/>
 
     <config src="help.xml" type="client"/>
 
     <min_mta_version client="{{Current Version|full}}" server="{{Current Version|full}}" />
 
     <min_mta_version client="{{Current Version|full}}" server="{{Current Version|full}}" />

Revision as of 17:58, 17 May 2012

The meta.xml file presents MTA with a set of metadata, such as the resource's name, the scripts to include, and which files to precache for sending to clients among other things. It is also the scope of "elements". It is written in XML, which is based on HTML and is the parent of XHTML.

Tags

XML is a textual data format which is widely used for the representation of data. MTA uses an XML-based language to describe the metadata for resources by using the tags below:

  • <info /> Information about this resource, possible parameters include (any arbitrary parameters can be used and read using getResourceInfo):
    • author: The author of this resource
    • version: The version of this resource
    • name: The name of this resource
    • description: A brief description of this resource
    • type: The type of this resource, that can be "gamemode", "script", "map" or "misc".
  • <script /> Source code for this resource, possible parameters are:
    • src: The file name of the source code
    • type: The type of source code: "client" or "server"
  • <map /> The map for a gamemode, possible parameters are:
    • src: .map file name (can be path too eg. "maps/filename.map")
    • dimension: Dimension in which the map will be loaded (optional)
  • <file /> A client-side file. Generally these are images, .txd, .col, .dff or .xml files. They'll be downloaded by clients when the resources is started (or on join)
    • src: client-side file name (can be path too eg. "images/image.png")
    • download: Whether or not to be sent to the client automatically (optional). Default is "true" using "no" or "false" will mean they are not sent on resource start but could later be used by downloadFile (from version 1.4)
  • <include /> Include resources that this resource will use
    • resource: Resource name that you want to start with this resource
    • minversion: Minimum version that resource needs to be (optional)
    • maxversion: Maximum version that resource needs to be (optional)
  • <config /> Config file (.xml) can be accessed by resource, possible parameters are:
    • src: The file name of the config file
    • type: The type of the config file: "client" or "server"
  • <export /> This exports functions from this resource, so other resources can use them with call
    • function: The function name
    • type Whether function is exported server-side or client-side (valid values are: "server" and "client")
    • http: Can the function be called via HTTP (true/false)
  • <html />
    • src: The filename for the HTTP file (can be a path)
    • default: The html file is one that is shown by default when visiting /resourceName/ on the server. Only one html can be default, the rest are ignored. (true/false)
    • raw: The html file is not parsed by the LUA interpreter and is treated as binary data. Must be used for binary files (images mainly) (true/false)
  • <settings> <setting name="" value=""/> </settings>: Most gamemodes use settings system to let server admins to configure it how they like. For instance you could set round time and then use get and set to get the value or change it, respectively.
  • <min_mta_version /> Minimum version requirements for this resource to run correctly. When authoring resources, the minimum version should usually be set to the current released version of MTA:SA (which at the moment is "1.5.6").
    • client: The minimum client version
    • server: The minimum server version
  • <aclrequest /> A list of ACL rights this resource will need.

Example

Heres an example of a meta file using some of the tags mentioned: <meta>

   <info author="Slothman" type="gamemode" name="Stealth" />
   <config src="help.xml" type="client"/>
   <min_mta_version client="1.5.6" server="1.5.6" />
   <script src="stealthmain_server.lua" />
   <script src="noiseblip.lua" />
   <script src="mission_timer.lua" />
   <script src="gadgets_server.lua" />
   <script src="gadgets_client.lua" type="client"/>
   <script src="stealthmain_client.lua" type="client"/>
   <script src="noisebar.lua" type="client"/>
   <script src="spycam.lua" type="client"/>
   <script src="riemann_z_demonstration.lua" type="client"/>
   <file src="riot_shield.txd" />
   <file src="riot_shield.dff" />
   <file src="riot_shield.col" />
   <file src="armor.png" download="true"/>
   <file src="camera.png" download="false"/>
   <file src="cloak.png" />
   <file src="goggles.png" />
   <file src="mine.png" />
   <file src="radar.png" />
   <file src="shield.png" />
   <include resource="scoreboard" />
   <include resource="killmessages" />
   <include resource="maplimits" />
   <settings>
        <setting name="roundlimit" value="[6]" /> 

<setting name="teamdamage" value="[1]" /> <setting name="teambalance" value="[1]" /> <setting name="spazammo" value="[25]" /> <setting name="m4ammo" value="[100]" /> <setting name="shotgunammo" value="[25]" /> <setting name="sniperammo" value="[20]" /> <setting name="ak47ammo" value="[120]" /> <setting name="rifleammo" value="[40]" /> <setting name="deserteagleammo" value="[45]" /> <setting name="pistolammo" value="[132]" /> <setting name="uziammo" value="[150]" /> <setting name="tec9ammo" value="[150]" /> <setting name="silencedammo" value="[65]" /> <setting name="grenadeammo" value="[4]" /> <setting name="satchelammo" value="[4]" /> <setting name="teargasammo" value="[4]" /> <setting name="molatovammo" value="[4]" />

    </settings>
    <aclrequest>

<right name="function.startResource" access="true" /> <right name="function.stopResource" access="true" /> <right name="function.setPlayerMuted" access="true" />

    </aclrequest>

</meta>