Meta.xml: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 2: Line 2:


=Tags=
=Tags=
XML é um formato de dados textuais que são amplamente utilizados para a apresentação dos dados. O MTA ussa uma linguagem baseada em XML para descrever os metodados de recursos, utilizando os tags a baixo.
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 />''' É o conjunto de informações do próprio recuso, os parâmetros possíveis incluem (quaisquer parâmetros arbitrários podem ser utilizados e lidos usando [[getResourceInfo]] ):
*'''<info />''' Information about this resource, possible parameters include (any arbitrary parameters can be used and read using [[getResourceInfo]]):
** '''author:''' O autor do recursos
** '''author:''' The author of this resource
** '''version:''' A versão do recursos
** '''version:''' The version of this resource
** '''name:''' O nome do recuros
** '''name:''' The name of this resource
** '''description:''' Pequena descrição do recurso
** '''description:''' A brief description of this resource
** '''type:''' Tipo de recurso, que pode ser "gamemode", "script", "map" ou "misc".
** '''type:''' The type of this resource, that can be "gamemode", "script", "map" or "misc".
*'''<script />''' O código fonte para este recurso, os parâmetros possíveis são:
*'''<script />''' Source code for this resource, possible parameters are:
** '''src:''' O nome do arquivo do script
** '''src:''' The file name of the source code
** '''type:''' O tipo de script : "cliente" ou "servidor"
** '''type:''' The type of source code: "client" or "server"
<!--
<!--
** '''protected:''' Para client-side scripts, se este script deve ou não ser salvos no disco rígido clientes: "true" ou "false". NOTA: [http://bugs.mtasa.com/view.php?id=6831 pode haver um bug relacionado a isto].
** '''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 />''' O mapa de um modo de jogo, os parâmetros possíveis são:
*'''<map />''' The map for a gamemode, possible parameters are:
**'''src:''' O nome do arquivo map (pode ser por exemplo. "maps/filename.map")
**'''src:''' .map file name (can be path too eg. "maps/filename.map")
**'''dimension:''' Dimensão na qual o mapa será carregado (opcional)
**'''dimension:''' Dimension in which the map will be loaded (optional)
*'''<file />''' Arquivo do lado Client-Side. Geralmente são imagens, .txd, .col, .dff ou .xml arquivos. Eles serão baixados pelos clients quando o recurso ser iniciado (ou entrar)
*'''<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:''' nome do arquivo client-side (pode ser por exemplo. "images/image.png")
**'''src:''' client-side file name (can be path too eg. "images/image.png")
**'''download:''' Enviar automaticamente para o client.(opcional). O padrão é "true" usar "no" ou "false" significa que não não enviados quando inicia o recurso, mas poderia ser utilizado posteriormente por [[downloadFile]] (a partir da versão 1.4)
**'''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 />''' Inclusão de outro recurso para iniciar automaticamente ao iniciar este recursos
*'''<include />''' Include resources that this resource will use
**'''resource:''' Nome do recurso ira iniciar automaticamente com este recurso
**'''resource:''' Resource name that you want to start with this resource
**'''minversion:''' Versão minima que o '''recurso''' precisa (opcional)
**'''minversion:''' Minimum version that '''resource''' needs to be (optional)
**'''maxversion:''' Versão máxima que o '''recurso''' precisa (opcional)
**'''maxversion:''' Maximum version that '''resource''' needs to be (optional)
*'''<config />''' Arquivo de Configuração (.xml) pode ser acessado pelo recurso, os parâmetros possíveis são:
*'''<config />''' Config file (.xml) can be accessed by resource, possible parameters are:
**'''src:''' Nome do arquivo do script
**'''src:''' The file name of the config file
**'''type:''' O tipo de script : "cliente" ou "servidor"
**'''type:''' The type of the config file: "client" or "server"
*'''<export />''' Isto vai exportar uma função deste resource, para chamar a função através de outro resource você pode usar [[call]]
*'''<export />''' This exports functions from this resource, so other resources can use them with [[call]]
**'''function:''' Nome da função
**'''function:''' The function name
**'''type''' Tipo de exportação da função, server-side ou client-side (valores válidos são: "servidor" e "cliente")
**'''type''' Whether function is exported server-side or client-side (valid values are: "server" and "client")
**'''http:''' A função pode ser chamada via HTTP (true/false)
**'''http:''' Can the function be called via HTTP (true/false)
*'''<html />'''
*'''<html />'''
**'''src:''' Nome para o arquivo HTTP (pode ser um caminho)
**'''src:''' The filename for the HTTP file (can be a path)
**'''default:''' O arquivo HTML é aquele que é mostrado por padrão quando visita / nomeDoRecurso / no servidor. Apenas um html pode ser padrão, o resto é ignorado. (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:''' O arquivo HTML não é analisado pelo intérprete LUA e são tratados como dados binários. Deve ser usado para arquivos binários (principalmente imagens) (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>:''' A maioria dos 'gamemodes' usam [[settings system]] para permitir que administradores de servidores para configurem como eles desejarem. Por exemplo, você pode definir a qualquer momento usando [[get]] e [[set]] ara obter o valor ou alterá-lo, respectivamente.
*'''<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 />''' Versão requisitos mínimos para este recurso para funcionar corretamente. Quando o meta é criado,a versão mínima geralmente deve ser definida para a versão atual de lançamento do MTA: SA "{{Current Version|full}}").
*'''<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:''' A verção minima do Client
**'''client:''' The minimum client version
**'''server:''' A verção minima do Server
**'''server:''' The minimum server version
*'''<aclrequest />''' A lista [[Access_Control_List|ACL]] direitos deste recurso irá precisar.
*'''<aclrequest />''' A list of [[Access_Control_List|ACL]] rights this resource will need.
{{New items|3.0139|1.3.1 r4141|
{{New items|3.0139|1.3.1 r4141|
*'''<sync_map_element_data />''' Controle de mapas [[Element_data|element data]], tais como "PosX" e "DoubleSided" são transferidos para o cliente. Este dado normalmente não é exigido pela maioria dos gamemodes ou recursos. (Uma exceção notável é o editor). Quando configurado em um modo de jogo meta.xml, a definição será aplicada a todos os mapas carregados por esse recurso.
*'''<sync_map_element_data />''' Controls whether map [[Element_data|element data]] such as "PosX" and "DoubleSided" are transferred to the client. This data is usually not required by most gamemodes or resources. (One notable exception is the editor). When set in a gamemode meta.xml, the setting will apply to all maps loaded by that resource.
**'''false:''' Desativar a transferência de dados de elementos do mapa. Isso pode reduzir o tempo de download de mapas consideravelmente.
**'''false:''' Disable transfer of map element data. This can reduce map download times considerably.
**'''true:''' Permitir a transferência de dados de elemento do mapa (default).
**'''true:''' Enable transfer of map element data (default).
}}
}}


== Example ==
== Example ==
Está aqui um exemplo de um arquivo meta usando algumas das marcas mencionadas:
Heres an example of a meta file using some of the tags mentioned:
{{#tag:code |
{{#tag:code |
<meta>
<meta>

Revision as of 06:12, 6 July 2012

O arquivo meta.xml apresenta com o MTA um conjunto de metodados, como o nome dos recursos, incluindo os scripts, e também os arquivos para precache para enviar aos clientes entre outras coisas. É também a extensão de alguns "elementos". É escrito em XML, que é baseado em HTML e é o pai do 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.6.0").
    • client: The minimum client version
    • server: The minimum server version
  • <aclrequest /> A list of ACL rights this resource will need.
  • <sync_map_element_data /> Controls whether map element data such as "PosX" and "DoubleSided" are transferred to the client. This data is usually not required by most gamemodes or resources. (One notable exception is the editor). When set in a gamemode meta.xml, the setting will apply to all maps loaded by that resource.
    • false: Disable transfer of map element data. This can reduce map download times considerably.
    • true: Enable transfer of map element data (default).

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.6.0" server="1.6.0" />
   <sync_map_element_data>false</sync_map_element_data>
   <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>