HU/Meta.xml

From Multi Theft Auto: Wiki
Revision as of 19:50, 25 December 2018 by Surge (talk | contribs) (→‎Tags)
Jump to navigation Jump to search

A meta.xml fájl metaadatokkal látja el az MTA-t, ez a fájl tartalmazza - többek között - például a resource nevét, a betöltendő scripteket, valamint a kliensekre letöltendő fájlok listáját. XML nyelven íródik, ami a HTML-ből származik, és az XHTML alapja.

Tags

Az XML olyan szöveges adatformátum, amelyet széles körben használnak az adatok ábrázolásához. Az MTA XML alapú nyelvet használ a resource-ok metaadatainak leírására a következő címkék használatával:

  • <info /> Információ a resource-ról, lehetséges paraméterek (minden tetszőleges paraméter használható és olvasható a getResourceInfo segítségével):
    • author: A resource készítője
    • version: A resource verziója
    • name: A resource neve
    • description: A resource rövid leírása
    • type: A resource típusa, ami lehet "gamemode", "script", "map" vagy "misc".
    • gamemodes: A gamemódok kompatibilisek a resource-al. Ez nem a gamemode neve, hanem a gamemode resource neve. Ha azt szeretné, hogy több gamemode-dal is kompatibilis legyen, akkor ez egy vesszővel elválasztott felsorolás kell legyen. (e.g. gamemodes="test1,test2").
  • <script /> Script fájl ehhez a resource-hoz, a lehetséges paraméterek:
    • src: A fájl relatív elérési útvonala. Például, ha közvetlenül a resource mappájában van egy "script.lua", akkor az elérési útvonala "script.lua" lesz. Ha a "scripts" mappán belül van, akkor ez "scripts/script.lua" lesz.
    • type: A resource típusa: "client", "server" vagy "shared".
    • cache: Amikor a script fájl típus "client", ez a beállítás szabályozza, hogy a fájl mentve legyen-e a játékos merevlemezén. Alapértelmezetten ez "true". "false" használata azt jelenti, hogy a fájl nem kerül mentésre. (Note: cache=false files are started at the client first, so lua file load order might differ when mixing cache settings)
    • validate: If set to "false", compatibility checks are skipped.
  • <map /> A map fájl ehhez a resource-hoz, a lehetséges paraméterek:
    • src: fájl név .map (can be path too eg. "maps/filename.map")
    • dimension: Az a dimension, amelyben a map be lesz töltve (tetszőleges)
  • <file /> Egy client oldali fájl. Általában ezek a képek, .txd, .col, .dff vagy .xml fájlok. Ezeket a játékosok töltik le a resource indulásakor (vagy mikor felcsatlakoznak)
    • src: client oldali fájlnév (can be path too eg. "images/image.png")
    • download: Autómatikus lengyen-e a letöltés, vagy sem (tetszőleges). Alapértelmezetten ez "true". "false" használata azt jelenti, hogy a resource indulásakor nem kerül letöltésre a fájl, de később még lehet a downloadFile használatával.
  • <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: "client", "server" and "shared")
    • 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"). See example for example.
    • 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. (Map Editor and Interiors require this to be not set to false to work). 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 for all resources. This can reduce map download times considerably.
    • true: Enable transfer of map element data for all resources. (If false and true are set in different resources, true will have priority and all resources will transfer map element data)
  • <oop /> OOP - Please refer to OOP for documentation.
    • false: Disable OOP.
    • true: Enable OOP.
  • <download_priority_group /> If not set, the download priority group for a resource defaults to 0. If this is set higher than 0, then the resource will be downloaded and started on the client earlier than other resources. If set to less than 0, the resource will be downloaded and started on the client later than other resources.

Példa

Itt egy meta fájl példa, mely az említett tagok némelyikét használja:

<meta>
    <info author="Slothman" type="gamemode" name="Stealth" />
    <config src="help.xml" type="client"/>

    <download_priority_group>0</download_priority_group>
    <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" validate="true"/>
    <script src="noisebar.lua" type="client"/>
    <script src="spycam.lua" type="client"/>
    <script src="riemann_z_demonstration.lua" type="client" cache="false"/>
    <map src="base.map" dimension="1"/>

    <file src="riot_shield.txd" download="false" />
    <file src="riot_shield.dff" download="false" />
    <file src="riot_shield.col" download="false" />
    <file src="armor.png" />
    <file src="camera.png" />
    <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" />
    
    <export function="exampleExport1" type="server" />
    <export function="exampleExport2" type="client" />
    <export function="exampleExport3" type="shared" />

    <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]" />
	 <setting name="isAllowedToShoot" value="true" />
     </settings>

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