<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Gaetan+Piette</id>
	<title>Multi Theft Auto: Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Gaetan+Piette"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/Gaetan_Piette"/>
	<updated>2026-05-16T17:00:12Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Page_d%27accueil&amp;diff=39244</id>
		<title>Page d'accueil</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Page_d%27accueil&amp;diff=39244"/>
		<updated>2014-04-04T14:59:47Z</updated>

		<summary type="html">&lt;p&gt;Gaetan Piette: /* Programmer */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;background: #FFEEAA; padding: 5px; float:right; width: 30%;&amp;quot;&amp;gt;Dernière version stable de '''Multi Theft Auto: San Andreas''' est '''{{Current Version|full}}'''. Rendez-vous sur la [http://mtasa.com/ page principale] pour la télécharger.&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Vous pouvez aussi télécharger une [http://nightly.mtasa.com/ beta] pour avoir la dernière version ( non stable ).&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
Bienvenue sur le wiki de Multi Theft Auto. Sur ce wiki, vous trouverez toutes les informations sur Multi Theft Auto.&lt;br /&gt;
&lt;br /&gt;
Il y a [[How you can help|différents moyens de nous aider]]: créer une map, un gamemode, rediger des articles sur des fonctions, écrire un exemple, écrire un tutorial ou juste jouer à MTA et nous rapportez les bugs trouvés.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;0&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;50%&amp;quot; style=&amp;quot;vertical-align:top;&amp;quot; |&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px dotted #AAAAAA;padding:4px 8px 8px 8px;margin:10px;&amp;quot;&amp;gt;&lt;br /&gt;
====Pour commencer====&lt;br /&gt;
&lt;br /&gt;
* [[FR/Manuel_Client|Manuel Client]] ( Traduction: [http://wiki.multitheftauto.com/wiki/User:DrawKiie DrawKiie] )&lt;br /&gt;
* [[FR/Manuel_Serveur|Manuel Serveur]] ( Traduction: [http://wiki.multitheftauto.com/wiki/User:Rouche Rouche] )&lt;br /&gt;
* [[FR/Problemes_connus|Problèmes connus]] ( Traduction: [http://wiki.multitheftauto.com/wiki/User:Rouche Rouche] )&lt;br /&gt;
* [[FR/Migrer_de_MTARace_a_MTASA_1.0.x|Migrer de MTA:Race à MTA:SA 1.0.x]] ( Traduction: [http://wiki.multitheftauto.com/wiki/User:Rouche Rouche] )&lt;br /&gt;
* [[FR/A propos des Map|A propos des Map]] ( Traduction: [http://wiki.multitheftauto.com/wiki/User:Rouche Rouche] )&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px dotted #AAAAAA;padding:4px 8px 8px 8px;margin:10px;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Programmer====&lt;br /&gt;
&lt;br /&gt;
* [[FR/Introduction_Programmation|Introduction: La programmation]]&lt;br /&gt;
* [[FR/Introduction_GUI|Introduction: Le GUI]] ( Traduction: [http://wiki.multitheftauto.com/wiki/User:FatalTeror FatalTerror] )&lt;br /&gt;
* [[FR/Debugage|Tutoriel: Le débugage]] - Comment trouver les erreurs dans son script (Traduction:[http://wiki.multitheftauto.com/wiki/User:Vincenzo Vincenzo] alias Vincentdu90)&lt;br /&gt;
* [[FR/Ressources|Introduction: Les ressources]] (Traduction : [http://wiki.multitheftauto.com/wiki/User:Myk3L Myk3L])&lt;br /&gt;
** [[FR/Ressource_Acces_Internet|Introduction: L'accès depuis internet]] - Comment créer un site à partir d'une ressource (Traduction : [http://wiki.multitheftauto.com/wiki/User:Myk3L Myk3L])&lt;br /&gt;
** [[:Category:Resource|Catalogue des ressources]] &lt;br /&gt;
** [[FR/Meta.xml|Meta.xml]] - Derière chaque ressource ce trouve une meta pour la définir&lt;br /&gt;
** [[FR/ACL|ACL]] - Access Control List, pour définir les autorisations&lt;br /&gt;
* [[FR/Ecrire_Gamemode|Créer un gamemode]] ( Traduction: [http://wiki.multitheftauto.com/wiki/User:Rouche Rouche])&lt;br /&gt;
* [[FR/Fonctions_Utiles|Fonctions Utiles]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px dotted #AAAAAA;padding:4px 8px 8px 8px;margin:10px;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Bases de données====&lt;br /&gt;
Cette section décrit toutes les capacités fournies par le LUA/MTA ou par les ressources.&lt;br /&gt;
* [[:Category:Resource|Catalogue des ressources]] - Vous devriez le lire pour réaliser un script approprié.&lt;br /&gt;
* [[FR/Les_scripts_clients| Les scripts clients]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px dotted #AAAAAA;padding:4px 8px 8px 8px;margin:10px;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Aide générale du LUA====&lt;br /&gt;
Des pages conçues pour aider votre compréhension du Lua&lt;br /&gt;
*[http://www.lua.org/pil/index.html &amp;quot;Programming in Lua&amp;quot;]&lt;br /&gt;
**[http://www.lua.org/manual/5.1/#index Les fonctions Lua]&lt;br /&gt;
*[http://lua-users.org/wiki/TutorialDirectory wiki Lua]&lt;br /&gt;
*[http://nixstaller.berlios.de/manual/0.2/nixstaller_9.html Un guide général au Lua de Nixstaller]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;50%&amp;quot; style=&amp;quot;vertical-align:top;&amp;quot; |&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px dotted #AAAAAA;padding:4px 8px 8px 8px;margin:10px;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Map Editor====&lt;br /&gt;
*[[Resource:Editor|Manuel]]&lt;br /&gt;
*[[Resource:Editor/EDF|Editor Definition Format]]&lt;br /&gt;
*[[Resource:Editor/Plugins|Plugins]]&lt;br /&gt;
*[[Resource:Editor#FAQ|Questions Fréquentes]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px dotted #AAAAAA;padding:4px 8px 8px 8px;margin:10px;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Développer Multi Theft Auto====&lt;br /&gt;
* [[FR/Compiler_MTASA|Compiler MTASA sur Windows]]&lt;br /&gt;
* [[FR/Compiler_MTASA_Server_sur_Mac_OS_X|Compiler MTASA sur Mac OS X]]&lt;br /&gt;
* [[FR/Compiler_MTASA_Server_sur_GNU_Linux|Compiler MTASA sur GNU/Linux]]&lt;br /&gt;
* [[FR/Directives_de_codage|Directives de codage]]&lt;br /&gt;
* [http://code.google.com/p/mtasa-blue Google Code SVN]&lt;br /&gt;
* [[FR/Roadmap|Roadmap]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px dotted #AAAAAA;padding:4px 8px 8px 8px;margin:10px; background:#CCCCFF;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Références====&lt;br /&gt;
* [[FR/Fonctions_Clients|Fonctions Clients]]&lt;br /&gt;
* [[FR/Events_Clients|Events Clients]]&lt;br /&gt;
* [[FR/Fonctions_Serveurs|Fonctions Clients]]&lt;br /&gt;
* [[FR/Events_Serveurs|Events Clients]]&lt;br /&gt;
&amp;lt;!-- Incomplet * [[Module functions|Server-side external module scripting functions list]] --&amp;gt;&lt;br /&gt;
* [[FR/MTA Classes|MTA Classes]] - Les descriptions détaillées de tous les types personnalisés MTA&lt;br /&gt;
** [[FR/Element|MTA Elements]] / [[Element tree]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px dotted #AAAAAA;padding:4px 8px 8px 8px;margin:10px;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====[[Id|ID Listes]]====&lt;br /&gt;
*[[FR/Animations|Animations]]&lt;br /&gt;
*[[FR/Skins_Personnages|Skins Personnages]]&lt;br /&gt;
*[[FR/Vetements_CJ|Vêtements CJ]]&lt;br /&gt;
*[[FR/Garage|Garage IDs]]&lt;br /&gt;
*[[FR/Interieurs_IDs|Intérieurs IDs]]&lt;br /&gt;
*[[FR/Materiel_IDs|Matériel IDs]]&lt;br /&gt;
*[[FR/Projectiles|Projectiles]]&lt;br /&gt;
*[[FR/Radar Blips|Radar Blips]]&lt;br /&gt;
*[[FR/Sons|Sons]]&lt;br /&gt;
*[[FR/Vehicule_IDs|ID des véhicules]]&lt;br /&gt;
*[[FR/Vehicule_Couleurs|Couleurs véhicules]]&lt;br /&gt;
*[[FR/Vehicule_Upgrades|Tuning IDs]]&lt;br /&gt;
*[[FR/Armes|Armes]]&lt;br /&gt;
*[[FR/Meteos|Météos]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |&lt;br /&gt;
|}&lt;br /&gt;
{{Languages list|fr}}&lt;/div&gt;</summary>
		<author><name>Gaetan Piette</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Cr%C3%A9er_un_mode_de_jeu&amp;diff=39243</id>
		<title>Créer un mode de jeu</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Cr%C3%A9er_un_mode_de_jeu&amp;diff=39243"/>
		<updated>2014-04-04T14:59:20Z</updated>

		<summary type="html">&lt;p&gt;Gaetan Piette: /* Map cycler */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ce guide à pour but de vous aprpendre à créer un mode de jeu. Si vous venez juste de commencer à scripter pour MTA, il serait préférable que vous lisiez les autres tutoriels de l apage principale.&lt;br /&gt;
 &lt;br /&gt;
==Introduction==&lt;br /&gt;
Un mode de jeu est une ressource qui une fois démarrée contrôle tout les éléments du gameplay. Cela inclus l'explication du mode de jeu aux joueurs. Par exemple expliquer comment gagner des points ou de l'argent. (Mode de jeu existans : race, deathmatch, ctf, freeroam et bien d'autres).&lt;br /&gt;
&lt;br /&gt;
==Que signifie &amp;quot;coder proprement un mode de jeu&amp;quot; ?==&lt;br /&gt;
Pour faire simple, un mode de jeu doit utilisé les fonctionnalités du système de map dans MTA. Cela signifie que le code des maps doit être accompagné des position des véhicule, spawn des joueur et autres. Cela permet au mode de jeu d'être indépendant des maps proposées par les joueurs.&lt;br /&gt;
&lt;br /&gt;
Instead, the gamemode should be able to load .map files which define these data. This way the gamemode can have multiple maps; also, people can create .map files for the gamemode with MTA's map editor, which is much more convenient than writing code.&lt;br /&gt;
&lt;br /&gt;
An obvious example of a &amp;quot;proper gamemode&amp;quot; is MTA:Race. It allows usermade maps with lots of possibilities within the .map file. To alter spawnpoints, objects etc., the user doesn't need to edit the gamemode itself.&lt;br /&gt;
&lt;br /&gt;
===Fichier MAP===&lt;br /&gt;
Les fichiers map sont en XML avec l'extension .map. Ils définissent l'environnement pour un mode de jeu ou plusieurs si la map est compatible avec d'aures. Ils ne sont cependant pas supposés changer les règles du jeu. Les règles sont définies dans le mode de jeu.&lt;br /&gt;
&lt;br /&gt;
Chaque élémment dans une map correspond à un noeud dans le fichier .map. Il y a une syntaxe particulière pour les points de spawn, objets ou véhicules. Cependant il est possible, pour des cas d'ajouts d'objets spéciaux d'inventer votre propre syntaxe.&lt;br /&gt;
&lt;br /&gt;
====Exemple====&lt;br /&gt;
Commencons par un mode de jeu bien connu, la capture de drapeau. Une map pour ce mode de jeu à besoin de point de spawn et de positions pour les drapeaux des deux équipes. On peut aussi y ajouter des véhicules et d'autres objets. Un fichier de map simplifié pourrait ressembler à ça :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;map&amp;gt;&lt;br /&gt;
    &amp;lt;spawnpoint id=&amp;quot;spawnpoint1&amp;quot; posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;877.25219726563&amp;quot; rot=&amp;quot;63.350006103516&amp;quot; model=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;pickup id=&amp;quot;Armor 1&amp;quot; posX=&amp;quot;1911.083984375&amp;quot; posY=&amp;quot;-1658.8798828125&amp;quot; posZ=&amp;quot;885.40216064453&amp;quot; type=&amp;quot;armor&amp;quot; health=&amp;quot;50&amp;quot; respawn=&amp;quot;60000&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;flag posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;877.25219726563&amp;quot; team=&amp;quot;blue&amp;quot; /&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dans le code ci-dessus on peut apercevoir trois éléments : un point de spawn,un pickup et un flag.&lt;br /&gt;
Le pickup permettera une fois pris par le joueur de lui rendre 50 points de vie, celui-ci respawn toute les 60 secondes.&lt;br /&gt;
Le flag est ici définit au niveau de sa position et de sa couleur (propre à l'équipe).&lt;br /&gt;
Le point de spawn et le pickup peuvent être utilisé par une ressource externe. Les éléments personnalisés doievent être gérés par le mode de jeu.&lt;br /&gt;
&lt;br /&gt;
Pour résumé, votre objectif est de facilité la vie des mappeurs. Ceux-ci ne doivent pas avoir à se tracasser du script concernant le mode de jeu.&lt;br /&gt;
&lt;br /&gt;
====Exemple de récupération d'informations sur un .map====&lt;br /&gt;
Votre mode de jeu doit appelés les éléments personnalisés définit dans le fichier .map afin des les utilisés. Ce n'est pas bien compliqué et voici une démonstration ci-dessous.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- récupère une liste avec tout les éléments de type flag&lt;br /&gt;
local flagElements = getElementsByType ( &amp;quot;flag&amp;quot; )&lt;br /&gt;
-- On boucle sur cette liste pour récupérer les positions&lt;br /&gt;
for key, value in pairs(flagElements) do&lt;br /&gt;
	-- Récupération des informations&lt;br /&gt;
	local posX = getElementData ( value, &amp;quot;posX&amp;quot; )&lt;br /&gt;
	local posY = getElementData ( value, &amp;quot;posY&amp;quot; )&lt;br /&gt;
	local posZ = getElementData ( value, &amp;quot;posZ&amp;quot; )&lt;br /&gt;
	local team = getElementData ( value, &amp;quot;team&amp;quot; )&lt;br /&gt;
	-- Création de l'objet flag&lt;br /&gt;
	createObject ( 1337, posX, posY, posZ )&lt;br /&gt;
	-- Affichage dans le tchat que le dreapau est créé&lt;br /&gt;
	outputChatBox ( &amp;quot;Base for team &amp;quot; .. team .. &amp;quot; created&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
La fonction [[getElementsByType]] récupère une table de tout les éléments d'un certain type. (le type correspond au noeud créé dans le fichier .map)&lt;br /&gt;
Fonctionne pour les objets presonnalisé mais aussi pour les objets présents par défauts dans MTA comme &amp;quot;vehicle&amp;quot; ou &amp;quot;player&amp;quot;.&lt;br /&gt;
[[getElementData]] peut être utilisé pour récupérer les atributs XML définis dans le fichier .map.&lt;br /&gt;
Pour exemple, un objet est créé à la position du drapeau et un message s'affiche dans le tchat pour prévenir les joueurs. En réalité, cette action sera plutôt réalisée lors du chargement de la map. Par contre on peut imaginer une action lorsqu'un joueur s'empare du drapeau ennemi.&lt;br /&gt;
&lt;br /&gt;
==Map Manager==&lt;br /&gt;
Après avoir lu les sections ci-dessus il doit vous paraître clair qu'un mode de jeu est composé en deux parties :&lt;br /&gt;
* La ressource du mode de jeu (Unique)&lt;br /&gt;
* Les maps qui accompagnent le mode de jeu&lt;br /&gt;
&lt;br /&gt;
A la place d'écrire un [[Map manager]] pour chaque mode de jeu différent, le [[Map manager]] de base fournit des fonctions pour charger mode de jeu et maps. Il suffit simplement d'entrer un commande correcte (par exemple 'gamemode ctf ctf-italy'), cette action va démarrer le mode de jeu et la map pendant que l'évênement déclenché ([[onGamemodeMapStart]]) avertira le mode de jeu q'une map est chargée. La ressource 'ctf' peut alors accéder au informations de la map. Le mode de jeu peut alors faire spawn les joueurs. &lt;br /&gt;
&lt;br /&gt;
===Comment utiliser le Map Manager===&lt;br /&gt;
Pour utiliser le Map Manager, votre mode de jeu doit être ciblé en premier lieu. Vous devez en fait configurer l'attribut &amp;quot;type&amp;quot; dans la baile &amp;lt;info&amp;gt; du meta.xml avec le mode de jeu souhaité. L'attribut &amp;quot;name&amp;quot; peut contenir un non plus convivial comme 'Capture de drapeau', c'estl enom qui sera affiché dans la liste des serveurs à la place du om de la ressource par défaut.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- meta.xml in &amp;quot;shootermode&amp;quot; gamemode --&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info type=&amp;quot;gamemode&amp;quot; name=&amp;quot;Shooter Mode 2.0&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Si votre mode de jeu utilise des maps personnalisées, vous devriez utiliser les évênements suivant :&lt;br /&gt;
* onGamemodeMapStart&lt;br /&gt;
* onGamemodeMapStop (Si la map doit-être déchargée)&lt;br /&gt;
&lt;br /&gt;
Les évênements ci-dessus sont appelés quand une map de votre mode démarre ou s'arrête. Le paramètre passé par ces évênement n'est rien d'autre que le nom de la ressource.&lt;br /&gt;
Avec les fonctions sur les évênements, vous pouvez extraire toute les informations de la map ainsi que du fichier de configuration.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function startCtfMap( startedMap ) -- startedMap contient une référence vers la ressource de la map&lt;br /&gt;
    local mapRoot = getResourceRootElement( startedMap )        -- recoit le noeud principal de la map démarrée&lt;br /&gt;
    local flagElements = getElementsByType ( &amp;quot;flag&amp;quot; , mapRoot ) -- recoit tout les drapeausx de la map et les stocke dans un tableau&lt;br /&gt;
    -- Démarrage du chargement des informations&lt;br /&gt;
    -- Spawn les joueurs etc&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onGamemodeMapStart&amp;quot;, getRootElement(), startCtfMap)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Faire des maps compatibles===&lt;br /&gt;
Les maps sont des ressources séparées du mode de jeu de telle sorte qu'il ne faut pas modofier le mode de jeu pour chaque nouvelle map. Les maps peuent aussi contenir des scripts et configurations propres à elles.&lt;br /&gt;
&lt;br /&gt;
Pour faire une map compatible avec votre mode, il suffit d'ouvrir le meta.xml et de mettre l'attribut &amp;quot;type&amp;quot; à 'map' et l'attribut &amp;quot;gamemode&amp;quot; doit être composé d'une liste des mode de jeu compatible avec la map (modes séparé d'une virgule).&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!--map's meta.xml--&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;shootermode,assault,tdm&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Une fois que tout est configuré, les administrateurs peuvent utiliser le panel ou les commandes start/stop suivit du nom du mode.&lt;br /&gt;
/gamemode gamemodeName [NomDeLaMap] (paramètre optionel qui permet de démarré une map avec le mode, par défaut pas de map)&lt;br /&gt;
/changemap mapName [NomDuModeDeJeu] (paramètre optionnel qui permet dans le cas ou la map est démarrée de lancé le mode de jeu qui lui convient, par défaut le mode de jeu actif)&lt;br /&gt;
&lt;br /&gt;
[[Map manager]] possède d'autres fonctions qui pourrait vous être utliles, mais elle ne sont pas toutes présentées ici.&lt;br /&gt;
&lt;br /&gt;
==Autres possibilités==&lt;br /&gt;
Il y a une multitude d'autres ressources avec lesquelles les modes de jeu peuvent interférer.&lt;br /&gt;
&lt;br /&gt;
===Helpmanager===&lt;br /&gt;
L'Helpmanager est une interface en jeu pour les joueurs qui on besopin d'aide. Si vous utilisez l'HelpManager pour l'aide de votre mode de jeu, tous les joueurs qui l'on utilisé précédement serront plus à l'aise car la plupart des modes l'utilise. Il affiche aussi les différentes ressources dans des onglet, si configuré pour.&lt;br /&gt;
&lt;br /&gt;
Il y à deux façons d'utiliser le HelpManager :&lt;br /&gt;
* Fournir un simple texte qui explique le mode de jeu.&lt;br /&gt;
* Utilisation des éléments graphiques (GUI) (Recommandé)&lt;br /&gt;
&lt;br /&gt;
N'hésitez pas à lire la page sur le HelpManager pour en savoir plus.&lt;br /&gt;
&lt;br /&gt;
===Scoreboard===&lt;br /&gt;
Il affiche les joueurs et les teams présentes sur le serveur. Vous pouvez y ajouter des colonnes supplémentaires pour afficher d'autres informations. Par exemple une colonne 'Points' peut être utile dans un mode de capture de drapeaux. Consultez la page sur le scoreboard pour plus d'information.&lt;br /&gt;
&lt;br /&gt;
===Map cycler===&lt;br /&gt;
Il permet de controller quel mode de jeu et map sont joués  sur le serveur. Vous pouvez spécifier combien de fois une map doit être jouée avant changement de mode de jeu apr exemple. Pour celà il faut dire au map cycler que votre mode de jeu est stoppé.&lt;br /&gt;
&lt;br /&gt;
[[it:Scrivere una gamemode]]&lt;br /&gt;
[[ru:Writing Gamemodes]]&lt;br /&gt;
[[de:Gamemodes schreiben]]&lt;/div&gt;</summary>
		<author><name>Gaetan Piette</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Cr%C3%A9er_un_mode_de_jeu&amp;diff=39242</id>
		<title>Créer un mode de jeu</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Cr%C3%A9er_un_mode_de_jeu&amp;diff=39242"/>
		<updated>2014-04-04T14:57:34Z</updated>

		<summary type="html">&lt;p&gt;Gaetan Piette: /* Scoreboard */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ce guide à pour but de vous aprpendre à créer un mode de jeu. Si vous venez juste de commencer à scripter pour MTA, il serait préférable que vous lisiez les autres tutoriels de l apage principale.&lt;br /&gt;
 &lt;br /&gt;
==Introduction==&lt;br /&gt;
Un mode de jeu est une ressource qui une fois démarrée contrôle tout les éléments du gameplay. Cela inclus l'explication du mode de jeu aux joueurs. Par exemple expliquer comment gagner des points ou de l'argent. (Mode de jeu existans : race, deathmatch, ctf, freeroam et bien d'autres).&lt;br /&gt;
&lt;br /&gt;
==Que signifie &amp;quot;coder proprement un mode de jeu&amp;quot; ?==&lt;br /&gt;
Pour faire simple, un mode de jeu doit utilisé les fonctionnalités du système de map dans MTA. Cela signifie que le code des maps doit être accompagné des position des véhicule, spawn des joueur et autres. Cela permet au mode de jeu d'être indépendant des maps proposées par les joueurs.&lt;br /&gt;
&lt;br /&gt;
Instead, the gamemode should be able to load .map files which define these data. This way the gamemode can have multiple maps; also, people can create .map files for the gamemode with MTA's map editor, which is much more convenient than writing code.&lt;br /&gt;
&lt;br /&gt;
An obvious example of a &amp;quot;proper gamemode&amp;quot; is MTA:Race. It allows usermade maps with lots of possibilities within the .map file. To alter spawnpoints, objects etc., the user doesn't need to edit the gamemode itself.&lt;br /&gt;
&lt;br /&gt;
===Fichier MAP===&lt;br /&gt;
Les fichiers map sont en XML avec l'extension .map. Ils définissent l'environnement pour un mode de jeu ou plusieurs si la map est compatible avec d'aures. Ils ne sont cependant pas supposés changer les règles du jeu. Les règles sont définies dans le mode de jeu.&lt;br /&gt;
&lt;br /&gt;
Chaque élémment dans une map correspond à un noeud dans le fichier .map. Il y a une syntaxe particulière pour les points de spawn, objets ou véhicules. Cependant il est possible, pour des cas d'ajouts d'objets spéciaux d'inventer votre propre syntaxe.&lt;br /&gt;
&lt;br /&gt;
====Exemple====&lt;br /&gt;
Commencons par un mode de jeu bien connu, la capture de drapeau. Une map pour ce mode de jeu à besoin de point de spawn et de positions pour les drapeaux des deux équipes. On peut aussi y ajouter des véhicules et d'autres objets. Un fichier de map simplifié pourrait ressembler à ça :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;map&amp;gt;&lt;br /&gt;
    &amp;lt;spawnpoint id=&amp;quot;spawnpoint1&amp;quot; posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;877.25219726563&amp;quot; rot=&amp;quot;63.350006103516&amp;quot; model=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;pickup id=&amp;quot;Armor 1&amp;quot; posX=&amp;quot;1911.083984375&amp;quot; posY=&amp;quot;-1658.8798828125&amp;quot; posZ=&amp;quot;885.40216064453&amp;quot; type=&amp;quot;armor&amp;quot; health=&amp;quot;50&amp;quot; respawn=&amp;quot;60000&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;flag posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;877.25219726563&amp;quot; team=&amp;quot;blue&amp;quot; /&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dans le code ci-dessus on peut apercevoir trois éléments : un point de spawn,un pickup et un flag.&lt;br /&gt;
Le pickup permettera une fois pris par le joueur de lui rendre 50 points de vie, celui-ci respawn toute les 60 secondes.&lt;br /&gt;
Le flag est ici définit au niveau de sa position et de sa couleur (propre à l'équipe).&lt;br /&gt;
Le point de spawn et le pickup peuvent être utilisé par une ressource externe. Les éléments personnalisés doievent être gérés par le mode de jeu.&lt;br /&gt;
&lt;br /&gt;
Pour résumé, votre objectif est de facilité la vie des mappeurs. Ceux-ci ne doivent pas avoir à se tracasser du script concernant le mode de jeu.&lt;br /&gt;
&lt;br /&gt;
====Exemple de récupération d'informations sur un .map====&lt;br /&gt;
Votre mode de jeu doit appelés les éléments personnalisés définit dans le fichier .map afin des les utilisés. Ce n'est pas bien compliqué et voici une démonstration ci-dessous.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- récupère une liste avec tout les éléments de type flag&lt;br /&gt;
local flagElements = getElementsByType ( &amp;quot;flag&amp;quot; )&lt;br /&gt;
-- On boucle sur cette liste pour récupérer les positions&lt;br /&gt;
for key, value in pairs(flagElements) do&lt;br /&gt;
	-- Récupération des informations&lt;br /&gt;
	local posX = getElementData ( value, &amp;quot;posX&amp;quot; )&lt;br /&gt;
	local posY = getElementData ( value, &amp;quot;posY&amp;quot; )&lt;br /&gt;
	local posZ = getElementData ( value, &amp;quot;posZ&amp;quot; )&lt;br /&gt;
	local team = getElementData ( value, &amp;quot;team&amp;quot; )&lt;br /&gt;
	-- Création de l'objet flag&lt;br /&gt;
	createObject ( 1337, posX, posY, posZ )&lt;br /&gt;
	-- Affichage dans le tchat que le dreapau est créé&lt;br /&gt;
	outputChatBox ( &amp;quot;Base for team &amp;quot; .. team .. &amp;quot; created&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
La fonction [[getElementsByType]] récupère une table de tout les éléments d'un certain type. (le type correspond au noeud créé dans le fichier .map)&lt;br /&gt;
Fonctionne pour les objets presonnalisé mais aussi pour les objets présents par défauts dans MTA comme &amp;quot;vehicle&amp;quot; ou &amp;quot;player&amp;quot;.&lt;br /&gt;
[[getElementData]] peut être utilisé pour récupérer les atributs XML définis dans le fichier .map.&lt;br /&gt;
Pour exemple, un objet est créé à la position du drapeau et un message s'affiche dans le tchat pour prévenir les joueurs. En réalité, cette action sera plutôt réalisée lors du chargement de la map. Par contre on peut imaginer une action lorsqu'un joueur s'empare du drapeau ennemi.&lt;br /&gt;
&lt;br /&gt;
==Map Manager==&lt;br /&gt;
Après avoir lu les sections ci-dessus il doit vous paraître clair qu'un mode de jeu est composé en deux parties :&lt;br /&gt;
* La ressource du mode de jeu (Unique)&lt;br /&gt;
* Les maps qui accompagnent le mode de jeu&lt;br /&gt;
&lt;br /&gt;
A la place d'écrire un [[Map manager]] pour chaque mode de jeu différent, le [[Map manager]] de base fournit des fonctions pour charger mode de jeu et maps. Il suffit simplement d'entrer un commande correcte (par exemple 'gamemode ctf ctf-italy'), cette action va démarrer le mode de jeu et la map pendant que l'évênement déclenché ([[onGamemodeMapStart]]) avertira le mode de jeu q'une map est chargée. La ressource 'ctf' peut alors accéder au informations de la map. Le mode de jeu peut alors faire spawn les joueurs. &lt;br /&gt;
&lt;br /&gt;
===Comment utiliser le Map Manager===&lt;br /&gt;
Pour utiliser le Map Manager, votre mode de jeu doit être ciblé en premier lieu. Vous devez en fait configurer l'attribut &amp;quot;type&amp;quot; dans la baile &amp;lt;info&amp;gt; du meta.xml avec le mode de jeu souhaité. L'attribut &amp;quot;name&amp;quot; peut contenir un non plus convivial comme 'Capture de drapeau', c'estl enom qui sera affiché dans la liste des serveurs à la place du om de la ressource par défaut.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- meta.xml in &amp;quot;shootermode&amp;quot; gamemode --&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info type=&amp;quot;gamemode&amp;quot; name=&amp;quot;Shooter Mode 2.0&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Si votre mode de jeu utilise des maps personnalisées, vous devriez utiliser les évênements suivant :&lt;br /&gt;
* onGamemodeMapStart&lt;br /&gt;
* onGamemodeMapStop (Si la map doit-être déchargée)&lt;br /&gt;
&lt;br /&gt;
Les évênements ci-dessus sont appelés quand une map de votre mode démarre ou s'arrête. Le paramètre passé par ces évênement n'est rien d'autre que le nom de la ressource.&lt;br /&gt;
Avec les fonctions sur les évênements, vous pouvez extraire toute les informations de la map ainsi que du fichier de configuration.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function startCtfMap( startedMap ) -- startedMap contient une référence vers la ressource de la map&lt;br /&gt;
    local mapRoot = getResourceRootElement( startedMap )        -- recoit le noeud principal de la map démarrée&lt;br /&gt;
    local flagElements = getElementsByType ( &amp;quot;flag&amp;quot; , mapRoot ) -- recoit tout les drapeausx de la map et les stocke dans un tableau&lt;br /&gt;
    -- Démarrage du chargement des informations&lt;br /&gt;
    -- Spawn les joueurs etc&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onGamemodeMapStart&amp;quot;, getRootElement(), startCtfMap)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Faire des maps compatibles===&lt;br /&gt;
Les maps sont des ressources séparées du mode de jeu de telle sorte qu'il ne faut pas modofier le mode de jeu pour chaque nouvelle map. Les maps peuent aussi contenir des scripts et configurations propres à elles.&lt;br /&gt;
&lt;br /&gt;
Pour faire une map compatible avec votre mode, il suffit d'ouvrir le meta.xml et de mettre l'attribut &amp;quot;type&amp;quot; à 'map' et l'attribut &amp;quot;gamemode&amp;quot; doit être composé d'une liste des mode de jeu compatible avec la map (modes séparé d'une virgule).&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!--map's meta.xml--&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;shootermode,assault,tdm&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Une fois que tout est configuré, les administrateurs peuvent utiliser le panel ou les commandes start/stop suivit du nom du mode.&lt;br /&gt;
/gamemode gamemodeName [NomDeLaMap] (paramètre optionel qui permet de démarré une map avec le mode, par défaut pas de map)&lt;br /&gt;
/changemap mapName [NomDuModeDeJeu] (paramètre optionnel qui permet dans le cas ou la map est démarrée de lancé le mode de jeu qui lui convient, par défaut le mode de jeu actif)&lt;br /&gt;
&lt;br /&gt;
[[Map manager]] possède d'autres fonctions qui pourrait vous être utliles, mais elle ne sont pas toutes présentées ici.&lt;br /&gt;
&lt;br /&gt;
==Autres possibilités==&lt;br /&gt;
Il y a une multitude d'autres ressources avec lesquelles les modes de jeu peuvent interférer.&lt;br /&gt;
&lt;br /&gt;
===Helpmanager===&lt;br /&gt;
L'Helpmanager est une interface en jeu pour les joueurs qui on besopin d'aide. Si vous utilisez l'HelpManager pour l'aide de votre mode de jeu, tous les joueurs qui l'on utilisé précédement serront plus à l'aise car la plupart des modes l'utilise. Il affiche aussi les différentes ressources dans des onglet, si configuré pour.&lt;br /&gt;
&lt;br /&gt;
Il y à deux façons d'utiliser le HelpManager :&lt;br /&gt;
* Fournir un simple texte qui explique le mode de jeu.&lt;br /&gt;
* Utilisation des éléments graphiques (GUI) (Recommandé)&lt;br /&gt;
&lt;br /&gt;
N'hésitez pas à lire la page sur le HelpManager pour en savoir plus.&lt;br /&gt;
&lt;br /&gt;
===Scoreboard===&lt;br /&gt;
Il affiche les joueurs et les teams présentes sur le serveur. Vous pouvez y ajouter des colonnes supplémentaires pour afficher d'autres informations. Par exemple une colonne 'Points' peut être utile dans un mode de capture de drapeaux. Consultez la page sur le scoreboard pour plus d'information.&lt;br /&gt;
&lt;br /&gt;
===Map cycler===&lt;br /&gt;
The map cycler controls what gamemodes and maps are played on a server. You can specifiy for example how many times in a row a map will be played until it switches to the next. To achieve this, you need to tell the map cycler when your gamemode finished (e.g. when a round ends).&lt;br /&gt;
&lt;br /&gt;
[[it:Scrivere una gamemode]]&lt;br /&gt;
[[ru:Writing Gamemodes]]&lt;br /&gt;
[[de:Gamemodes schreiben]]&lt;/div&gt;</summary>
		<author><name>Gaetan Piette</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Cr%C3%A9er_un_mode_de_jeu&amp;diff=39241</id>
		<title>Créer un mode de jeu</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Cr%C3%A9er_un_mode_de_jeu&amp;diff=39241"/>
		<updated>2014-04-04T14:55:38Z</updated>

		<summary type="html">&lt;p&gt;Gaetan Piette: /* Helpmanager */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ce guide à pour but de vous aprpendre à créer un mode de jeu. Si vous venez juste de commencer à scripter pour MTA, il serait préférable que vous lisiez les autres tutoriels de l apage principale.&lt;br /&gt;
 &lt;br /&gt;
==Introduction==&lt;br /&gt;
Un mode de jeu est une ressource qui une fois démarrée contrôle tout les éléments du gameplay. Cela inclus l'explication du mode de jeu aux joueurs. Par exemple expliquer comment gagner des points ou de l'argent. (Mode de jeu existans : race, deathmatch, ctf, freeroam et bien d'autres).&lt;br /&gt;
&lt;br /&gt;
==Que signifie &amp;quot;coder proprement un mode de jeu&amp;quot; ?==&lt;br /&gt;
Pour faire simple, un mode de jeu doit utilisé les fonctionnalités du système de map dans MTA. Cela signifie que le code des maps doit être accompagné des position des véhicule, spawn des joueur et autres. Cela permet au mode de jeu d'être indépendant des maps proposées par les joueurs.&lt;br /&gt;
&lt;br /&gt;
Instead, the gamemode should be able to load .map files which define these data. This way the gamemode can have multiple maps; also, people can create .map files for the gamemode with MTA's map editor, which is much more convenient than writing code.&lt;br /&gt;
&lt;br /&gt;
An obvious example of a &amp;quot;proper gamemode&amp;quot; is MTA:Race. It allows usermade maps with lots of possibilities within the .map file. To alter spawnpoints, objects etc., the user doesn't need to edit the gamemode itself.&lt;br /&gt;
&lt;br /&gt;
===Fichier MAP===&lt;br /&gt;
Les fichiers map sont en XML avec l'extension .map. Ils définissent l'environnement pour un mode de jeu ou plusieurs si la map est compatible avec d'aures. Ils ne sont cependant pas supposés changer les règles du jeu. Les règles sont définies dans le mode de jeu.&lt;br /&gt;
&lt;br /&gt;
Chaque élémment dans une map correspond à un noeud dans le fichier .map. Il y a une syntaxe particulière pour les points de spawn, objets ou véhicules. Cependant il est possible, pour des cas d'ajouts d'objets spéciaux d'inventer votre propre syntaxe.&lt;br /&gt;
&lt;br /&gt;
====Exemple====&lt;br /&gt;
Commencons par un mode de jeu bien connu, la capture de drapeau. Une map pour ce mode de jeu à besoin de point de spawn et de positions pour les drapeaux des deux équipes. On peut aussi y ajouter des véhicules et d'autres objets. Un fichier de map simplifié pourrait ressembler à ça :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;map&amp;gt;&lt;br /&gt;
    &amp;lt;spawnpoint id=&amp;quot;spawnpoint1&amp;quot; posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;877.25219726563&amp;quot; rot=&amp;quot;63.350006103516&amp;quot; model=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;pickup id=&amp;quot;Armor 1&amp;quot; posX=&amp;quot;1911.083984375&amp;quot; posY=&amp;quot;-1658.8798828125&amp;quot; posZ=&amp;quot;885.40216064453&amp;quot; type=&amp;quot;armor&amp;quot; health=&amp;quot;50&amp;quot; respawn=&amp;quot;60000&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;flag posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;877.25219726563&amp;quot; team=&amp;quot;blue&amp;quot; /&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dans le code ci-dessus on peut apercevoir trois éléments : un point de spawn,un pickup et un flag.&lt;br /&gt;
Le pickup permettera une fois pris par le joueur de lui rendre 50 points de vie, celui-ci respawn toute les 60 secondes.&lt;br /&gt;
Le flag est ici définit au niveau de sa position et de sa couleur (propre à l'équipe).&lt;br /&gt;
Le point de spawn et le pickup peuvent être utilisé par une ressource externe. Les éléments personnalisés doievent être gérés par le mode de jeu.&lt;br /&gt;
&lt;br /&gt;
Pour résumé, votre objectif est de facilité la vie des mappeurs. Ceux-ci ne doivent pas avoir à se tracasser du script concernant le mode de jeu.&lt;br /&gt;
&lt;br /&gt;
====Exemple de récupération d'informations sur un .map====&lt;br /&gt;
Votre mode de jeu doit appelés les éléments personnalisés définit dans le fichier .map afin des les utilisés. Ce n'est pas bien compliqué et voici une démonstration ci-dessous.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- récupère une liste avec tout les éléments de type flag&lt;br /&gt;
local flagElements = getElementsByType ( &amp;quot;flag&amp;quot; )&lt;br /&gt;
-- On boucle sur cette liste pour récupérer les positions&lt;br /&gt;
for key, value in pairs(flagElements) do&lt;br /&gt;
	-- Récupération des informations&lt;br /&gt;
	local posX = getElementData ( value, &amp;quot;posX&amp;quot; )&lt;br /&gt;
	local posY = getElementData ( value, &amp;quot;posY&amp;quot; )&lt;br /&gt;
	local posZ = getElementData ( value, &amp;quot;posZ&amp;quot; )&lt;br /&gt;
	local team = getElementData ( value, &amp;quot;team&amp;quot; )&lt;br /&gt;
	-- Création de l'objet flag&lt;br /&gt;
	createObject ( 1337, posX, posY, posZ )&lt;br /&gt;
	-- Affichage dans le tchat que le dreapau est créé&lt;br /&gt;
	outputChatBox ( &amp;quot;Base for team &amp;quot; .. team .. &amp;quot; created&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
La fonction [[getElementsByType]] récupère une table de tout les éléments d'un certain type. (le type correspond au noeud créé dans le fichier .map)&lt;br /&gt;
Fonctionne pour les objets presonnalisé mais aussi pour les objets présents par défauts dans MTA comme &amp;quot;vehicle&amp;quot; ou &amp;quot;player&amp;quot;.&lt;br /&gt;
[[getElementData]] peut être utilisé pour récupérer les atributs XML définis dans le fichier .map.&lt;br /&gt;
Pour exemple, un objet est créé à la position du drapeau et un message s'affiche dans le tchat pour prévenir les joueurs. En réalité, cette action sera plutôt réalisée lors du chargement de la map. Par contre on peut imaginer une action lorsqu'un joueur s'empare du drapeau ennemi.&lt;br /&gt;
&lt;br /&gt;
==Map Manager==&lt;br /&gt;
Après avoir lu les sections ci-dessus il doit vous paraître clair qu'un mode de jeu est composé en deux parties :&lt;br /&gt;
* La ressource du mode de jeu (Unique)&lt;br /&gt;
* Les maps qui accompagnent le mode de jeu&lt;br /&gt;
&lt;br /&gt;
A la place d'écrire un [[Map manager]] pour chaque mode de jeu différent, le [[Map manager]] de base fournit des fonctions pour charger mode de jeu et maps. Il suffit simplement d'entrer un commande correcte (par exemple 'gamemode ctf ctf-italy'), cette action va démarrer le mode de jeu et la map pendant que l'évênement déclenché ([[onGamemodeMapStart]]) avertira le mode de jeu q'une map est chargée. La ressource 'ctf' peut alors accéder au informations de la map. Le mode de jeu peut alors faire spawn les joueurs. &lt;br /&gt;
&lt;br /&gt;
===Comment utiliser le Map Manager===&lt;br /&gt;
Pour utiliser le Map Manager, votre mode de jeu doit être ciblé en premier lieu. Vous devez en fait configurer l'attribut &amp;quot;type&amp;quot; dans la baile &amp;lt;info&amp;gt; du meta.xml avec le mode de jeu souhaité. L'attribut &amp;quot;name&amp;quot; peut contenir un non plus convivial comme 'Capture de drapeau', c'estl enom qui sera affiché dans la liste des serveurs à la place du om de la ressource par défaut.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- meta.xml in &amp;quot;shootermode&amp;quot; gamemode --&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info type=&amp;quot;gamemode&amp;quot; name=&amp;quot;Shooter Mode 2.0&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Si votre mode de jeu utilise des maps personnalisées, vous devriez utiliser les évênements suivant :&lt;br /&gt;
* onGamemodeMapStart&lt;br /&gt;
* onGamemodeMapStop (Si la map doit-être déchargée)&lt;br /&gt;
&lt;br /&gt;
Les évênements ci-dessus sont appelés quand une map de votre mode démarre ou s'arrête. Le paramètre passé par ces évênement n'est rien d'autre que le nom de la ressource.&lt;br /&gt;
Avec les fonctions sur les évênements, vous pouvez extraire toute les informations de la map ainsi que du fichier de configuration.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function startCtfMap( startedMap ) -- startedMap contient une référence vers la ressource de la map&lt;br /&gt;
    local mapRoot = getResourceRootElement( startedMap )        -- recoit le noeud principal de la map démarrée&lt;br /&gt;
    local flagElements = getElementsByType ( &amp;quot;flag&amp;quot; , mapRoot ) -- recoit tout les drapeausx de la map et les stocke dans un tableau&lt;br /&gt;
    -- Démarrage du chargement des informations&lt;br /&gt;
    -- Spawn les joueurs etc&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onGamemodeMapStart&amp;quot;, getRootElement(), startCtfMap)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Faire des maps compatibles===&lt;br /&gt;
Les maps sont des ressources séparées du mode de jeu de telle sorte qu'il ne faut pas modofier le mode de jeu pour chaque nouvelle map. Les maps peuent aussi contenir des scripts et configurations propres à elles.&lt;br /&gt;
&lt;br /&gt;
Pour faire une map compatible avec votre mode, il suffit d'ouvrir le meta.xml et de mettre l'attribut &amp;quot;type&amp;quot; à 'map' et l'attribut &amp;quot;gamemode&amp;quot; doit être composé d'une liste des mode de jeu compatible avec la map (modes séparé d'une virgule).&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!--map's meta.xml--&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;shootermode,assault,tdm&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Une fois que tout est configuré, les administrateurs peuvent utiliser le panel ou les commandes start/stop suivit du nom du mode.&lt;br /&gt;
/gamemode gamemodeName [NomDeLaMap] (paramètre optionel qui permet de démarré une map avec le mode, par défaut pas de map)&lt;br /&gt;
/changemap mapName [NomDuModeDeJeu] (paramètre optionnel qui permet dans le cas ou la map est démarrée de lancé le mode de jeu qui lui convient, par défaut le mode de jeu actif)&lt;br /&gt;
&lt;br /&gt;
[[Map manager]] possède d'autres fonctions qui pourrait vous être utliles, mais elle ne sont pas toutes présentées ici.&lt;br /&gt;
&lt;br /&gt;
==Autres possibilités==&lt;br /&gt;
Il y a une multitude d'autres ressources avec lesquelles les modes de jeu peuvent interférer.&lt;br /&gt;
&lt;br /&gt;
===Helpmanager===&lt;br /&gt;
L'Helpmanager est une interface en jeu pour les joueurs qui on besopin d'aide. Si vous utilisez l'HelpManager pour l'aide de votre mode de jeu, tous les joueurs qui l'on utilisé précédement serront plus à l'aise car la plupart des modes l'utilise. Il affiche aussi les différentes ressources dans des onglet, si configuré pour.&lt;br /&gt;
&lt;br /&gt;
Il y à deux façons d'utiliser le HelpManager :&lt;br /&gt;
* Fournir un simple texte qui explique le mode de jeu.&lt;br /&gt;
* Utilisation des éléments graphiques (GUI) (Recommandé)&lt;br /&gt;
&lt;br /&gt;
N'hésitez pas à lire la page sur le HelpManager pour en savoir plus.&lt;br /&gt;
&lt;br /&gt;
===Scoreboard===&lt;br /&gt;
Scoreboard displays players and teams currently ingame. You add custom columns to it to provide map specific information. For example the column 'points' in the 'ctf' gamemode could represent the player's points gained through kills or captures. As usual, see the scoreboard help page for more information.&lt;br /&gt;
&lt;br /&gt;
===Map cycler===&lt;br /&gt;
The map cycler controls what gamemodes and maps are played on a server. You can specifiy for example how many times in a row a map will be played until it switches to the next. To achieve this, you need to tell the map cycler when your gamemode finished (e.g. when a round ends).&lt;br /&gt;
&lt;br /&gt;
[[it:Scrivere una gamemode]]&lt;br /&gt;
[[ru:Writing Gamemodes]]&lt;br /&gt;
[[de:Gamemodes schreiben]]&lt;/div&gt;</summary>
		<author><name>Gaetan Piette</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Cr%C3%A9er_un_mode_de_jeu&amp;diff=39240</id>
		<title>Créer un mode de jeu</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Cr%C3%A9er_un_mode_de_jeu&amp;diff=39240"/>
		<updated>2014-04-04T14:54:20Z</updated>

		<summary type="html">&lt;p&gt;Gaetan Piette: /* What else should you do */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ce guide à pour but de vous aprpendre à créer un mode de jeu. Si vous venez juste de commencer à scripter pour MTA, il serait préférable que vous lisiez les autres tutoriels de l apage principale.&lt;br /&gt;
 &lt;br /&gt;
==Introduction==&lt;br /&gt;
Un mode de jeu est une ressource qui une fois démarrée contrôle tout les éléments du gameplay. Cela inclus l'explication du mode de jeu aux joueurs. Par exemple expliquer comment gagner des points ou de l'argent. (Mode de jeu existans : race, deathmatch, ctf, freeroam et bien d'autres).&lt;br /&gt;
&lt;br /&gt;
==Que signifie &amp;quot;coder proprement un mode de jeu&amp;quot; ?==&lt;br /&gt;
Pour faire simple, un mode de jeu doit utilisé les fonctionnalités du système de map dans MTA. Cela signifie que le code des maps doit être accompagné des position des véhicule, spawn des joueur et autres. Cela permet au mode de jeu d'être indépendant des maps proposées par les joueurs.&lt;br /&gt;
&lt;br /&gt;
Instead, the gamemode should be able to load .map files which define these data. This way the gamemode can have multiple maps; also, people can create .map files for the gamemode with MTA's map editor, which is much more convenient than writing code.&lt;br /&gt;
&lt;br /&gt;
An obvious example of a &amp;quot;proper gamemode&amp;quot; is MTA:Race. It allows usermade maps with lots of possibilities within the .map file. To alter spawnpoints, objects etc., the user doesn't need to edit the gamemode itself.&lt;br /&gt;
&lt;br /&gt;
===Fichier MAP===&lt;br /&gt;
Les fichiers map sont en XML avec l'extension .map. Ils définissent l'environnement pour un mode de jeu ou plusieurs si la map est compatible avec d'aures. Ils ne sont cependant pas supposés changer les règles du jeu. Les règles sont définies dans le mode de jeu.&lt;br /&gt;
&lt;br /&gt;
Chaque élémment dans une map correspond à un noeud dans le fichier .map. Il y a une syntaxe particulière pour les points de spawn, objets ou véhicules. Cependant il est possible, pour des cas d'ajouts d'objets spéciaux d'inventer votre propre syntaxe.&lt;br /&gt;
&lt;br /&gt;
====Exemple====&lt;br /&gt;
Commencons par un mode de jeu bien connu, la capture de drapeau. Une map pour ce mode de jeu à besoin de point de spawn et de positions pour les drapeaux des deux équipes. On peut aussi y ajouter des véhicules et d'autres objets. Un fichier de map simplifié pourrait ressembler à ça :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;map&amp;gt;&lt;br /&gt;
    &amp;lt;spawnpoint id=&amp;quot;spawnpoint1&amp;quot; posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;877.25219726563&amp;quot; rot=&amp;quot;63.350006103516&amp;quot; model=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;pickup id=&amp;quot;Armor 1&amp;quot; posX=&amp;quot;1911.083984375&amp;quot; posY=&amp;quot;-1658.8798828125&amp;quot; posZ=&amp;quot;885.40216064453&amp;quot; type=&amp;quot;armor&amp;quot; health=&amp;quot;50&amp;quot; respawn=&amp;quot;60000&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;flag posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;877.25219726563&amp;quot; team=&amp;quot;blue&amp;quot; /&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dans le code ci-dessus on peut apercevoir trois éléments : un point de spawn,un pickup et un flag.&lt;br /&gt;
Le pickup permettera une fois pris par le joueur de lui rendre 50 points de vie, celui-ci respawn toute les 60 secondes.&lt;br /&gt;
Le flag est ici définit au niveau de sa position et de sa couleur (propre à l'équipe).&lt;br /&gt;
Le point de spawn et le pickup peuvent être utilisé par une ressource externe. Les éléments personnalisés doievent être gérés par le mode de jeu.&lt;br /&gt;
&lt;br /&gt;
Pour résumé, votre objectif est de facilité la vie des mappeurs. Ceux-ci ne doivent pas avoir à se tracasser du script concernant le mode de jeu.&lt;br /&gt;
&lt;br /&gt;
====Exemple de récupération d'informations sur un .map====&lt;br /&gt;
Votre mode de jeu doit appelés les éléments personnalisés définit dans le fichier .map afin des les utilisés. Ce n'est pas bien compliqué et voici une démonstration ci-dessous.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- récupère une liste avec tout les éléments de type flag&lt;br /&gt;
local flagElements = getElementsByType ( &amp;quot;flag&amp;quot; )&lt;br /&gt;
-- On boucle sur cette liste pour récupérer les positions&lt;br /&gt;
for key, value in pairs(flagElements) do&lt;br /&gt;
	-- Récupération des informations&lt;br /&gt;
	local posX = getElementData ( value, &amp;quot;posX&amp;quot; )&lt;br /&gt;
	local posY = getElementData ( value, &amp;quot;posY&amp;quot; )&lt;br /&gt;
	local posZ = getElementData ( value, &amp;quot;posZ&amp;quot; )&lt;br /&gt;
	local team = getElementData ( value, &amp;quot;team&amp;quot; )&lt;br /&gt;
	-- Création de l'objet flag&lt;br /&gt;
	createObject ( 1337, posX, posY, posZ )&lt;br /&gt;
	-- Affichage dans le tchat que le dreapau est créé&lt;br /&gt;
	outputChatBox ( &amp;quot;Base for team &amp;quot; .. team .. &amp;quot; created&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
La fonction [[getElementsByType]] récupère une table de tout les éléments d'un certain type. (le type correspond au noeud créé dans le fichier .map)&lt;br /&gt;
Fonctionne pour les objets presonnalisé mais aussi pour les objets présents par défauts dans MTA comme &amp;quot;vehicle&amp;quot; ou &amp;quot;player&amp;quot;.&lt;br /&gt;
[[getElementData]] peut être utilisé pour récupérer les atributs XML définis dans le fichier .map.&lt;br /&gt;
Pour exemple, un objet est créé à la position du drapeau et un message s'affiche dans le tchat pour prévenir les joueurs. En réalité, cette action sera plutôt réalisée lors du chargement de la map. Par contre on peut imaginer une action lorsqu'un joueur s'empare du drapeau ennemi.&lt;br /&gt;
&lt;br /&gt;
==Map Manager==&lt;br /&gt;
Après avoir lu les sections ci-dessus il doit vous paraître clair qu'un mode de jeu est composé en deux parties :&lt;br /&gt;
* La ressource du mode de jeu (Unique)&lt;br /&gt;
* Les maps qui accompagnent le mode de jeu&lt;br /&gt;
&lt;br /&gt;
A la place d'écrire un [[Map manager]] pour chaque mode de jeu différent, le [[Map manager]] de base fournit des fonctions pour charger mode de jeu et maps. Il suffit simplement d'entrer un commande correcte (par exemple 'gamemode ctf ctf-italy'), cette action va démarrer le mode de jeu et la map pendant que l'évênement déclenché ([[onGamemodeMapStart]]) avertira le mode de jeu q'une map est chargée. La ressource 'ctf' peut alors accéder au informations de la map. Le mode de jeu peut alors faire spawn les joueurs. &lt;br /&gt;
&lt;br /&gt;
===Comment utiliser le Map Manager===&lt;br /&gt;
Pour utiliser le Map Manager, votre mode de jeu doit être ciblé en premier lieu. Vous devez en fait configurer l'attribut &amp;quot;type&amp;quot; dans la baile &amp;lt;info&amp;gt; du meta.xml avec le mode de jeu souhaité. L'attribut &amp;quot;name&amp;quot; peut contenir un non plus convivial comme 'Capture de drapeau', c'estl enom qui sera affiché dans la liste des serveurs à la place du om de la ressource par défaut.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- meta.xml in &amp;quot;shootermode&amp;quot; gamemode --&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info type=&amp;quot;gamemode&amp;quot; name=&amp;quot;Shooter Mode 2.0&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Si votre mode de jeu utilise des maps personnalisées, vous devriez utiliser les évênements suivant :&lt;br /&gt;
* onGamemodeMapStart&lt;br /&gt;
* onGamemodeMapStop (Si la map doit-être déchargée)&lt;br /&gt;
&lt;br /&gt;
Les évênements ci-dessus sont appelés quand une map de votre mode démarre ou s'arrête. Le paramètre passé par ces évênement n'est rien d'autre que le nom de la ressource.&lt;br /&gt;
Avec les fonctions sur les évênements, vous pouvez extraire toute les informations de la map ainsi que du fichier de configuration.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function startCtfMap( startedMap ) -- startedMap contient une référence vers la ressource de la map&lt;br /&gt;
    local mapRoot = getResourceRootElement( startedMap )        -- recoit le noeud principal de la map démarrée&lt;br /&gt;
    local flagElements = getElementsByType ( &amp;quot;flag&amp;quot; , mapRoot ) -- recoit tout les drapeausx de la map et les stocke dans un tableau&lt;br /&gt;
    -- Démarrage du chargement des informations&lt;br /&gt;
    -- Spawn les joueurs etc&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onGamemodeMapStart&amp;quot;, getRootElement(), startCtfMap)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Faire des maps compatibles===&lt;br /&gt;
Les maps sont des ressources séparées du mode de jeu de telle sorte qu'il ne faut pas modofier le mode de jeu pour chaque nouvelle map. Les maps peuent aussi contenir des scripts et configurations propres à elles.&lt;br /&gt;
&lt;br /&gt;
Pour faire une map compatible avec votre mode, il suffit d'ouvrir le meta.xml et de mettre l'attribut &amp;quot;type&amp;quot; à 'map' et l'attribut &amp;quot;gamemode&amp;quot; doit être composé d'une liste des mode de jeu compatible avec la map (modes séparé d'une virgule).&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!--map's meta.xml--&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;shootermode,assault,tdm&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Une fois que tout est configuré, les administrateurs peuvent utiliser le panel ou les commandes start/stop suivit du nom du mode.&lt;br /&gt;
/gamemode gamemodeName [NomDeLaMap] (paramètre optionel qui permet de démarré une map avec le mode, par défaut pas de map)&lt;br /&gt;
/changemap mapName [NomDuModeDeJeu] (paramètre optionnel qui permet dans le cas ou la map est démarrée de lancé le mode de jeu qui lui convient, par défaut le mode de jeu actif)&lt;br /&gt;
&lt;br /&gt;
[[Map manager]] possède d'autres fonctions qui pourrait vous être utliles, mais elle ne sont pas toutes présentées ici.&lt;br /&gt;
&lt;br /&gt;
==Autres possibilités==&lt;br /&gt;
Il y a une multitude d'autres ressources avec lesquelles les modes de jeu peuvent interférer.&lt;br /&gt;
&lt;br /&gt;
===Helpmanager===&lt;br /&gt;
L'Helpmanager est une interface en jeu pour les joueurs qui on besopin d'aide. Si vous utilisez l'HelpManager pour l'aide de votre mode de jeu, tous les joueurs qui l'on utilisé précédement serront plus à l'aise car la plupart des modes l'utilise. Il affiche aussi les différentes ressources dans des onglet, si configuré pour.&lt;br /&gt;
&lt;br /&gt;
Il y à deux façons d'utiliser le HelpManager :&lt;br /&gt;
* Fournir un simple texte qui explique le mode de jeu.&lt;br /&gt;
* Request a GUI element from the helpmanager that will be displayed in its own tab in the helpmanager window and lets you add any GUI elements to it. This is the recommended way for gamemodes that need to display more complex information that needs its own GUI.&lt;br /&gt;
&lt;br /&gt;
Read the helpmanager page for details on how to do it.&lt;br /&gt;
&lt;br /&gt;
===Scoreboard===&lt;br /&gt;
Scoreboard displays players and teams currently ingame. You add custom columns to it to provide map specific information. For example the column 'points' in the 'ctf' gamemode could represent the player's points gained through kills or captures. As usual, see the scoreboard help page for more information.&lt;br /&gt;
&lt;br /&gt;
===Map cycler===&lt;br /&gt;
The map cycler controls what gamemodes and maps are played on a server. You can specifiy for example how many times in a row a map will be played until it switches to the next. To achieve this, you need to tell the map cycler when your gamemode finished (e.g. when a round ends).&lt;br /&gt;
&lt;br /&gt;
[[it:Scrivere una gamemode]]&lt;br /&gt;
[[ru:Writing Gamemodes]]&lt;br /&gt;
[[de:Gamemodes schreiben]]&lt;/div&gt;</summary>
		<author><name>Gaetan Piette</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Cr%C3%A9er_un_mode_de_jeu&amp;diff=39239</id>
		<title>Créer un mode de jeu</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Cr%C3%A9er_un_mode_de_jeu&amp;diff=39239"/>
		<updated>2014-04-04T14:39:37Z</updated>

		<summary type="html">&lt;p&gt;Gaetan Piette: /* Map Manager */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ce guide à pour but de vous aprpendre à créer un mode de jeu. Si vous venez juste de commencer à scripter pour MTA, il serait préférable que vous lisiez les autres tutoriels de l apage principale.&lt;br /&gt;
 &lt;br /&gt;
==Introduction==&lt;br /&gt;
Un mode de jeu est une ressource qui une fois démarrée contrôle tout les éléments du gameplay. Cela inclus l'explication du mode de jeu aux joueurs. Par exemple expliquer comment gagner des points ou de l'argent. (Mode de jeu existans : race, deathmatch, ctf, freeroam et bien d'autres).&lt;br /&gt;
&lt;br /&gt;
==Que signifie &amp;quot;coder proprement un mode de jeu&amp;quot; ?==&lt;br /&gt;
Pour faire simple, un mode de jeu doit utilisé les fonctionnalités du système de map dans MTA. Cela signifie que le code des maps doit être accompagné des position des véhicule, spawn des joueur et autres. Cela permet au mode de jeu d'être indépendant des maps proposées par les joueurs.&lt;br /&gt;
&lt;br /&gt;
Instead, the gamemode should be able to load .map files which define these data. This way the gamemode can have multiple maps; also, people can create .map files for the gamemode with MTA's map editor, which is much more convenient than writing code.&lt;br /&gt;
&lt;br /&gt;
An obvious example of a &amp;quot;proper gamemode&amp;quot; is MTA:Race. It allows usermade maps with lots of possibilities within the .map file. To alter spawnpoints, objects etc., the user doesn't need to edit the gamemode itself.&lt;br /&gt;
&lt;br /&gt;
===Fichier MAP===&lt;br /&gt;
Les fichiers map sont en XML avec l'extension .map. Ils définissent l'environnement pour un mode de jeu ou plusieurs si la map est compatible avec d'aures. Ils ne sont cependant pas supposés changer les règles du jeu. Les règles sont définies dans le mode de jeu.&lt;br /&gt;
&lt;br /&gt;
Chaque élémment dans une map correspond à un noeud dans le fichier .map. Il y a une syntaxe particulière pour les points de spawn, objets ou véhicules. Cependant il est possible, pour des cas d'ajouts d'objets spéciaux d'inventer votre propre syntaxe.&lt;br /&gt;
&lt;br /&gt;
====Exemple====&lt;br /&gt;
Commencons par un mode de jeu bien connu, la capture de drapeau. Une map pour ce mode de jeu à besoin de point de spawn et de positions pour les drapeaux des deux équipes. On peut aussi y ajouter des véhicules et d'autres objets. Un fichier de map simplifié pourrait ressembler à ça :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;map&amp;gt;&lt;br /&gt;
    &amp;lt;spawnpoint id=&amp;quot;spawnpoint1&amp;quot; posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;877.25219726563&amp;quot; rot=&amp;quot;63.350006103516&amp;quot; model=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;pickup id=&amp;quot;Armor 1&amp;quot; posX=&amp;quot;1911.083984375&amp;quot; posY=&amp;quot;-1658.8798828125&amp;quot; posZ=&amp;quot;885.40216064453&amp;quot; type=&amp;quot;armor&amp;quot; health=&amp;quot;50&amp;quot; respawn=&amp;quot;60000&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;flag posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;877.25219726563&amp;quot; team=&amp;quot;blue&amp;quot; /&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dans le code ci-dessus on peut apercevoir trois éléments : un point de spawn,un pickup et un flag.&lt;br /&gt;
Le pickup permettera une fois pris par le joueur de lui rendre 50 points de vie, celui-ci respawn toute les 60 secondes.&lt;br /&gt;
Le flag est ici définit au niveau de sa position et de sa couleur (propre à l'équipe).&lt;br /&gt;
Le point de spawn et le pickup peuvent être utilisé par une ressource externe. Les éléments personnalisés doievent être gérés par le mode de jeu.&lt;br /&gt;
&lt;br /&gt;
Pour résumé, votre objectif est de facilité la vie des mappeurs. Ceux-ci ne doivent pas avoir à se tracasser du script concernant le mode de jeu.&lt;br /&gt;
&lt;br /&gt;
====Exemple de récupération d'informations sur un .map====&lt;br /&gt;
Votre mode de jeu doit appelés les éléments personnalisés définit dans le fichier .map afin des les utilisés. Ce n'est pas bien compliqué et voici une démonstration ci-dessous.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- récupère une liste avec tout les éléments de type flag&lt;br /&gt;
local flagElements = getElementsByType ( &amp;quot;flag&amp;quot; )&lt;br /&gt;
-- On boucle sur cette liste pour récupérer les positions&lt;br /&gt;
for key, value in pairs(flagElements) do&lt;br /&gt;
	-- Récupération des informations&lt;br /&gt;
	local posX = getElementData ( value, &amp;quot;posX&amp;quot; )&lt;br /&gt;
	local posY = getElementData ( value, &amp;quot;posY&amp;quot; )&lt;br /&gt;
	local posZ = getElementData ( value, &amp;quot;posZ&amp;quot; )&lt;br /&gt;
	local team = getElementData ( value, &amp;quot;team&amp;quot; )&lt;br /&gt;
	-- Création de l'objet flag&lt;br /&gt;
	createObject ( 1337, posX, posY, posZ )&lt;br /&gt;
	-- Affichage dans le tchat que le dreapau est créé&lt;br /&gt;
	outputChatBox ( &amp;quot;Base for team &amp;quot; .. team .. &amp;quot; created&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
La fonction [[getElementsByType]] récupère une table de tout les éléments d'un certain type. (le type correspond au noeud créé dans le fichier .map)&lt;br /&gt;
Fonctionne pour les objets presonnalisé mais aussi pour les objets présents par défauts dans MTA comme &amp;quot;vehicle&amp;quot; ou &amp;quot;player&amp;quot;.&lt;br /&gt;
[[getElementData]] peut être utilisé pour récupérer les atributs XML définis dans le fichier .map.&lt;br /&gt;
Pour exemple, un objet est créé à la position du drapeau et un message s'affiche dans le tchat pour prévenir les joueurs. En réalité, cette action sera plutôt réalisée lors du chargement de la map. Par contre on peut imaginer une action lorsqu'un joueur s'empare du drapeau ennemi.&lt;br /&gt;
&lt;br /&gt;
==Map Manager==&lt;br /&gt;
Après avoir lu les sections ci-dessus il doit vous paraître clair qu'un mode de jeu est composé en deux parties :&lt;br /&gt;
* La ressource du mode de jeu (Unique)&lt;br /&gt;
* Les maps qui accompagnent le mode de jeu&lt;br /&gt;
&lt;br /&gt;
A la place d'écrire un [[Map manager]] pour chaque mode de jeu différent, le [[Map manager]] de base fournit des fonctions pour charger mode de jeu et maps. Il suffit simplement d'entrer un commande correcte (par exemple 'gamemode ctf ctf-italy'), cette action va démarrer le mode de jeu et la map pendant que l'évênement déclenché ([[onGamemodeMapStart]]) avertira le mode de jeu q'une map est chargée. La ressource 'ctf' peut alors accéder au informations de la map. Le mode de jeu peut alors faire spawn les joueurs. &lt;br /&gt;
&lt;br /&gt;
===Comment utiliser le Map Manager===&lt;br /&gt;
Pour utiliser le Map Manager, votre mode de jeu doit être ciblé en premier lieu. Vous devez en fait configurer l'attribut &amp;quot;type&amp;quot; dans la baile &amp;lt;info&amp;gt; du meta.xml avec le mode de jeu souhaité. L'attribut &amp;quot;name&amp;quot; peut contenir un non plus convivial comme 'Capture de drapeau', c'estl enom qui sera affiché dans la liste des serveurs à la place du om de la ressource par défaut.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- meta.xml in &amp;quot;shootermode&amp;quot; gamemode --&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info type=&amp;quot;gamemode&amp;quot; name=&amp;quot;Shooter Mode 2.0&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Si votre mode de jeu utilise des maps personnalisées, vous devriez utiliser les évênements suivant :&lt;br /&gt;
* onGamemodeMapStart&lt;br /&gt;
* onGamemodeMapStop (Si la map doit-être déchargée)&lt;br /&gt;
&lt;br /&gt;
Les évênements ci-dessus sont appelés quand une map de votre mode démarre ou s'arrête. Le paramètre passé par ces évênement n'est rien d'autre que le nom de la ressource.&lt;br /&gt;
Avec les fonctions sur les évênements, vous pouvez extraire toute les informations de la map ainsi que du fichier de configuration.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function startCtfMap( startedMap ) -- startedMap contient une référence vers la ressource de la map&lt;br /&gt;
    local mapRoot = getResourceRootElement( startedMap )        -- recoit le noeud principal de la map démarrée&lt;br /&gt;
    local flagElements = getElementsByType ( &amp;quot;flag&amp;quot; , mapRoot ) -- recoit tout les drapeausx de la map et les stocke dans un tableau&lt;br /&gt;
    -- Démarrage du chargement des informations&lt;br /&gt;
    -- Spawn les joueurs etc&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onGamemodeMapStart&amp;quot;, getRootElement(), startCtfMap)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Faire des maps compatibles===&lt;br /&gt;
Les maps sont des ressources séparées du mode de jeu de telle sorte qu'il ne faut pas modofier le mode de jeu pour chaque nouvelle map. Les maps peuent aussi contenir des scripts et configurations propres à elles.&lt;br /&gt;
&lt;br /&gt;
Pour faire une map compatible avec votre mode, il suffit d'ouvrir le meta.xml et de mettre l'attribut &amp;quot;type&amp;quot; à 'map' et l'attribut &amp;quot;gamemode&amp;quot; doit être composé d'une liste des mode de jeu compatible avec la map (modes séparé d'une virgule).&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!--map's meta.xml--&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;shootermode,assault,tdm&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Une fois que tout est configuré, les administrateurs peuvent utiliser le panel ou les commandes start/stop suivit du nom du mode.&lt;br /&gt;
/gamemode gamemodeName [NomDeLaMap] (paramètre optionel qui permet de démarré une map avec le mode, par défaut pas de map)&lt;br /&gt;
/changemap mapName [NomDuModeDeJeu] (paramètre optionnel qui permet dans le cas ou la map est démarrée de lancé le mode de jeu qui lui convient, par défaut le mode de jeu actif)&lt;br /&gt;
&lt;br /&gt;
[[Map manager]] possède d'autres fonctions qui pourrait vous être utliles, mais elle ne sont pas toutes présentées ici.&lt;br /&gt;
&lt;br /&gt;
==What else should you do==&lt;br /&gt;
There are several other resources that gamemodes should use/be compliant with.&lt;br /&gt;
&lt;br /&gt;
===Helpmanager===&lt;br /&gt;
The helpmanager is ought to be the standard interface for players when they need help. If you use the helpmanager to display your gamemode's help, every player that used helpmanager before (e.g. in other gamemodes) will immediately know how to get there. It also displays help for different resources running resources in one window, if necessary.&lt;br /&gt;
&lt;br /&gt;
There are basicially two ways to use the helpmanager:&lt;br /&gt;
* Provide a simple text that explains how to use your gamemode&lt;br /&gt;
* Request a GUI element from the helpmanager that will be displayed in its own tab in the helpmanager window and lets you add any GUI elements to it. This is the recommended way for gamemodes that need to display more complex information that needs its own GUI.&lt;br /&gt;
&lt;br /&gt;
Read the helpmanager page for details on how to do it.&lt;br /&gt;
&lt;br /&gt;
===Scoreboard===&lt;br /&gt;
Scoreboard displays players and teams currently ingame. You add custom columns to it to provide map specific information. For example the column 'points' in the 'ctf' gamemode could represent the player's points gained through kills or captures. As usual, see the scoreboard help page for more information.&lt;br /&gt;
&lt;br /&gt;
===Map cycler===&lt;br /&gt;
The map cycler controls what gamemodes and maps are played on a server. You can specifiy for example how many times in a row a map will be played until it switches to the next. To achieve this, you need to tell the map cycler when your gamemode finished (e.g. when a round ends).&lt;br /&gt;
&lt;br /&gt;
[[it:Scrivere una gamemode]]&lt;br /&gt;
[[ru:Writing Gamemodes]]&lt;br /&gt;
[[de:Gamemodes schreiben]]&lt;/div&gt;</summary>
		<author><name>Gaetan Piette</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Cr%C3%A9er_un_mode_de_jeu&amp;diff=39238</id>
		<title>Créer un mode de jeu</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Cr%C3%A9er_un_mode_de_jeu&amp;diff=39238"/>
		<updated>2014-04-04T14:11:47Z</updated>

		<summary type="html">&lt;p&gt;Gaetan Piette: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ce guide à pour but de vous aprpendre à créer un mode de jeu. Si vous venez juste de commencer à scripter pour MTA, il serait préférable que vous lisiez les autres tutoriels de l apage principale.&lt;br /&gt;
 &lt;br /&gt;
==Introduction==&lt;br /&gt;
Un mode de jeu est une ressource qui une fois démarrée contrôle tout les éléments du gameplay. Cela inclus l'explication du mode de jeu aux joueurs. Par exemple expliquer comment gagner des points ou de l'argent. (Mode de jeu existans : race, deathmatch, ctf, freeroam et bien d'autres).&lt;br /&gt;
&lt;br /&gt;
==Que signifie &amp;quot;coder proprement un mode de jeu&amp;quot; ?==&lt;br /&gt;
Pour faire simple, un mode de jeu doit utilisé les fonctionnalités du système de map dans MTA. Cela signifie que le code des maps doit être accompagné des position des véhicule, spawn des joueur et autres. Cela permet au mode de jeu d'être indépendant des maps proposées par les joueurs.&lt;br /&gt;
&lt;br /&gt;
Instead, the gamemode should be able to load .map files which define these data. This way the gamemode can have multiple maps; also, people can create .map files for the gamemode with MTA's map editor, which is much more convenient than writing code.&lt;br /&gt;
&lt;br /&gt;
An obvious example of a &amp;quot;proper gamemode&amp;quot; is MTA:Race. It allows usermade maps with lots of possibilities within the .map file. To alter spawnpoints, objects etc., the user doesn't need to edit the gamemode itself.&lt;br /&gt;
&lt;br /&gt;
===Fichier MAP===&lt;br /&gt;
Les fichiers map sont en XML avec l'extension .map. Ils définissent l'environnement pour un mode de jeu ou plusieurs si la map est compatible avec d'aures. Ils ne sont cependant pas supposés changer les règles du jeu. Les règles sont définies dans le mode de jeu.&lt;br /&gt;
&lt;br /&gt;
Chaque élémment dans une map correspond à un noeud dans le fichier .map. Il y a une syntaxe particulière pour les points de spawn, objets ou véhicules. Cependant il est possible, pour des cas d'ajouts d'objets spéciaux d'inventer votre propre syntaxe.&lt;br /&gt;
&lt;br /&gt;
====Exemple====&lt;br /&gt;
Commencons par un mode de jeu bien connu, la capture de drapeau. Une map pour ce mode de jeu à besoin de point de spawn et de positions pour les drapeaux des deux équipes. On peut aussi y ajouter des véhicules et d'autres objets. Un fichier de map simplifié pourrait ressembler à ça :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;map&amp;gt;&lt;br /&gt;
    &amp;lt;spawnpoint id=&amp;quot;spawnpoint1&amp;quot; posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;877.25219726563&amp;quot; rot=&amp;quot;63.350006103516&amp;quot; model=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;pickup id=&amp;quot;Armor 1&amp;quot; posX=&amp;quot;1911.083984375&amp;quot; posY=&amp;quot;-1658.8798828125&amp;quot; posZ=&amp;quot;885.40216064453&amp;quot; type=&amp;quot;armor&amp;quot; health=&amp;quot;50&amp;quot; respawn=&amp;quot;60000&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;flag posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;877.25219726563&amp;quot; team=&amp;quot;blue&amp;quot; /&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dans le code ci-dessus on peut apercevoir trois éléments : un point de spawn,un pickup et un flag.&lt;br /&gt;
Le pickup permettera une fois pris par le joueur de lui rendre 50 points de vie, celui-ci respawn toute les 60 secondes.&lt;br /&gt;
Le flag est ici définit au niveau de sa position et de sa couleur (propre à l'équipe).&lt;br /&gt;
Le point de spawn et le pickup peuvent être utilisé par une ressource externe. Les éléments personnalisés doievent être gérés par le mode de jeu.&lt;br /&gt;
&lt;br /&gt;
Pour résumé, votre objectif est de facilité la vie des mappeurs. Ceux-ci ne doivent pas avoir à se tracasser du script concernant le mode de jeu.&lt;br /&gt;
&lt;br /&gt;
====Exemple de récupération d'informations sur un .map====&lt;br /&gt;
Votre mode de jeu doit appelés les éléments personnalisés définit dans le fichier .map afin des les utilisés. Ce n'est pas bien compliqué et voici une démonstration ci-dessous.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- récupère une liste avec tout les éléments de type flag&lt;br /&gt;
local flagElements = getElementsByType ( &amp;quot;flag&amp;quot; )&lt;br /&gt;
-- On boucle sur cette liste pour récupérer les positions&lt;br /&gt;
for key, value in pairs(flagElements) do&lt;br /&gt;
	-- Récupération des informations&lt;br /&gt;
	local posX = getElementData ( value, &amp;quot;posX&amp;quot; )&lt;br /&gt;
	local posY = getElementData ( value, &amp;quot;posY&amp;quot; )&lt;br /&gt;
	local posZ = getElementData ( value, &amp;quot;posZ&amp;quot; )&lt;br /&gt;
	local team = getElementData ( value, &amp;quot;team&amp;quot; )&lt;br /&gt;
	-- Création de l'objet flag&lt;br /&gt;
	createObject ( 1337, posX, posY, posZ )&lt;br /&gt;
	-- Affichage dans le tchat que le dreapau est créé&lt;br /&gt;
	outputChatBox ( &amp;quot;Base for team &amp;quot; .. team .. &amp;quot; created&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
La fonction [[getElementsByType]] récupère une table de tout les éléments d'un certain type. (le type correspond au noeud créé dans le fichier .map)&lt;br /&gt;
Fonctionne pour les objets presonnalisé mais aussi pour les objets présents par défauts dans MTA comme &amp;quot;vehicle&amp;quot; ou &amp;quot;player&amp;quot;.&lt;br /&gt;
[[getElementData]] peut être utilisé pour récupérer les atributs XML définis dans le fichier .map.&lt;br /&gt;
Pour exemple, un objet est créé à la position du drapeau et un message s'affiche dans le tchat pour prévenir les joueurs. En réalité, cette action sera plutôt réalisée lors du chargement de la map. Par contre on peut imaginer une action lorsqu'un joueur s'empare du drapeau ennemi.&lt;br /&gt;
&lt;br /&gt;
==Map Manager==&lt;br /&gt;
Après avoir lu les sections ci-dessus il doit vous paraître clair qu'un mode de jeu est composé en deux parties :&lt;br /&gt;
* La ressource du mode de jeu (Unique)&lt;br /&gt;
* Les maps qui accompagnent le mode de jeu&lt;br /&gt;
&lt;br /&gt;
Now instead of writing a map-loader for every single gamemode, the [[Map manager]] provides functions to load gamemodes and maps. Simply put, when you enter the correct command (for example 'gamemode ctf ctf-italy') it will start both resources 'ctf' and 'ctf-italy' while triggering an event ([[onGamemodeMapStart]]) to tell the 'ctf' resource that a map was loaded. The 'ctf' resource can then access the information 'ctf-italy' contains and start spawning players etc.&lt;br /&gt;
&lt;br /&gt;
===How to use the mapmanager===&lt;br /&gt;
To use the mapmanager service, your gamemode resource has to be tagged as such first. More specifically you'll be setting the &amp;quot;type&amp;quot; attribute of its &amp;lt;info&amp;gt; tag to &amp;quot;gamemode&amp;quot; inside meta.xml. Also, you can set the &amp;quot;name&amp;quot; attribute to a friendly name (like &amp;quot;Capture the flag&amp;quot;) that will be shown on ASE instead of the resource name.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- meta.xml in &amp;quot;cowcatapult&amp;quot; gamemode --&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info type=&amp;quot;gamemode&amp;quot; name=&amp;quot;Cow catapulting 2.0&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If your gamemode is going to load custom maps, you should add handlers for&lt;br /&gt;
* onGamemodeMapStart&lt;br /&gt;
* onGamemodeMapStop (if any unloading is necessary)&lt;br /&gt;
These are fired when a map for your gamemode is started or stopped, and pass the map resource as a parameter.&lt;br /&gt;
Within the handler function for these events you can extract all info you need from the resource's map files and configuration files.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function startCtfMap( startedMap ) -- startedMap contains a reference to the resource of the map&lt;br /&gt;
    local mapRoot = getResourceRootElement( startedMap )        -- get the root node of the started map&lt;br /&gt;
    local flagElements = getElementsByType ( &amp;quot;flag&amp;quot; , mapRoot ) -- get all flags in the map and store them in a table&lt;br /&gt;
    -- go on loading information like in the example above&lt;br /&gt;
    -- spawn players etc.&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onGamemodeMapStart&amp;quot;, getRootElement(), startCtfMap)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Making maps compatible===&lt;br /&gt;
Maps are separate resources. This is done so no editing of the gamemode resource is ever necessary in order to create a custom map, and also allows you to pack map-specific scripts/config files with them.&lt;br /&gt;
&lt;br /&gt;
To make a map compatible with your gamemode, open its resource's meta.xml and tag it as well: the &amp;quot;type&amp;quot; attribute must be set to &amp;quot;map&amp;quot;, and the &amp;quot;gamemodes&amp;quot; attribute must be a comma-separated list (no spaces) of gamemode resource names that the map works with.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!--map's meta.xml--&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;cowcatapult,assault,tdm&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have everything set up, admins will use these two commands to start/stop gamemodes:&lt;br /&gt;
/gamemode gamemodeName [mapName] (optional parameter allows picking an initial map, defaults to none)&lt;br /&gt;
/changemap mapName [gamemodeName] (optional parameter specifies the gamemode to start the map with, defaults to the current one)&lt;br /&gt;
&lt;br /&gt;
[[Map manager]] exports a few more access functions which you don't have to use, but may be useful.&lt;br /&gt;
&lt;br /&gt;
==What else should you do==&lt;br /&gt;
There are several other resources that gamemodes should use/be compliant with.&lt;br /&gt;
&lt;br /&gt;
===Helpmanager===&lt;br /&gt;
The helpmanager is ought to be the standard interface for players when they need help. If you use the helpmanager to display your gamemode's help, every player that used helpmanager before (e.g. in other gamemodes) will immediately know how to get there. It also displays help for different resources running resources in one window, if necessary.&lt;br /&gt;
&lt;br /&gt;
There are basicially two ways to use the helpmanager:&lt;br /&gt;
* Provide a simple text that explains how to use your gamemode&lt;br /&gt;
* Request a GUI element from the helpmanager that will be displayed in its own tab in the helpmanager window and lets you add any GUI elements to it. This is the recommended way for gamemodes that need to display more complex information that needs its own GUI.&lt;br /&gt;
&lt;br /&gt;
Read the helpmanager page for details on how to do it.&lt;br /&gt;
&lt;br /&gt;
===Scoreboard===&lt;br /&gt;
Scoreboard displays players and teams currently ingame. You add custom columns to it to provide map specific information. For example the column 'points' in the 'ctf' gamemode could represent the player's points gained through kills or captures. As usual, see the scoreboard help page for more information.&lt;br /&gt;
&lt;br /&gt;
===Map cycler===&lt;br /&gt;
The map cycler controls what gamemodes and maps are played on a server. You can specifiy for example how many times in a row a map will be played until it switches to the next. To achieve this, you need to tell the map cycler when your gamemode finished (e.g. when a round ends).&lt;br /&gt;
&lt;br /&gt;
[[it:Scrivere una gamemode]]&lt;br /&gt;
[[ru:Writing Gamemodes]]&lt;br /&gt;
[[de:Gamemodes schreiben]]&lt;/div&gt;</summary>
		<author><name>Gaetan Piette</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Cr%C3%A9er_un_mode_de_jeu&amp;diff=39237</id>
		<title>Créer un mode de jeu</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Cr%C3%A9er_un_mode_de_jeu&amp;diff=39237"/>
		<updated>2014-04-04T10:10:14Z</updated>

		<summary type="html">&lt;p&gt;Gaetan Piette: /* Map manager */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ce guide à pour but de vous aprpendre à créer un mode de jeu. Si vous venez juste de commencer à scripter pour MTA, il serait préférable que vous lisiez les autres tutoriels de l apage principale.&lt;br /&gt;
 &lt;br /&gt;
==Introduction==&lt;br /&gt;
Un mode de jeu est une ressource qu iune fois démarrée contrôle tout les éléments du gameplay. Cela inclus l'explication du mode de jeu aux joueurs. Par exemple expliquer comment gagner des points ou de l'argent. (Mode de jeu existans : race, deathmatch, ctf, freeroam et bien d'autres).&lt;br /&gt;
&lt;br /&gt;
==Que signifie &amp;quot;coder proprement un mode de jeu&amp;quot; ?==&lt;br /&gt;
Pour faire simple, un mode de jeu doit utilisé les fonctionnalités du système de map dans MTA. Cela signifie que le code des maps doit être accompagné des position des véhicule, spawn des joueur et autres. Cela permet au mode de jeu d'être indépendant des maps proposées par les joueurs.&lt;br /&gt;
&lt;br /&gt;
Instead, the gamemode should be able to load .map files which define these data. This way the gamemode can have multiple maps; also, people can create .map files for the gamemode with MTA's map editor, which is much more convenient than writing code.&lt;br /&gt;
&lt;br /&gt;
An obvious example of a &amp;quot;proper gamemode&amp;quot; is MTA:Race. It allows usermade maps with lots of possibilities within the .map file. To alter spawnpoints, objects etc., the user doesn't need to edit the gamemode itself.&lt;br /&gt;
&lt;br /&gt;
===Fichier MAP===&lt;br /&gt;
Les fichiers map sont en XML avec l'extension .map. Ils définissent l'environnement pour un mode de jeu ou plusieurs si la map est compatible avec d'aures. Ils ne sont cependant pas supposés changer les règles du jeu. Les règles sont définies dans le mode de jeu.&lt;br /&gt;
&lt;br /&gt;
Chaque élémment dans une map correspond à un noeud dans le fichier .map. Il y a une syntaxe particulière pour les points de spawn, objets ou véhicules. Cependant il est possible, pour des cas d'ajouts d'objets spéciaux d'inventer votre propre syntaxe.&lt;br /&gt;
&lt;br /&gt;
====Exemple====&lt;br /&gt;
Commencons par un mode de jeu bien connu, la capture de drapeau. Une map pour ce mode de jeu à besoin de point de spawn et de positions pour les drapeaux des deux équipes. On peut aussi y ajouter des véhicules et d'autres objets. Un fichier de map simplifié pourrait ressembler à ça :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;map&amp;gt;&lt;br /&gt;
    &amp;lt;spawnpoint id=&amp;quot;spawnpoint1&amp;quot; posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;877.25219726563&amp;quot; rot=&amp;quot;63.350006103516&amp;quot; model=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;pickup id=&amp;quot;Armor 1&amp;quot; posX=&amp;quot;1911.083984375&amp;quot; posY=&amp;quot;-1658.8798828125&amp;quot; posZ=&amp;quot;885.40216064453&amp;quot; type=&amp;quot;armor&amp;quot; health=&amp;quot;50&amp;quot; respawn=&amp;quot;60000&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;flag posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;877.25219726563&amp;quot; team=&amp;quot;blue&amp;quot; /&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dans le code ci-dessus on peut apercevoir trois éléments : un point de spawn,un pickup et un flag.&lt;br /&gt;
Le pickup permettera une fois pris par le joueur de lui rendre 50 points de vie, celui-ci respawn toute les 60 secondes.&lt;br /&gt;
Le flag est ici définit au niveau de sa position et de sa couleur (propre à l'équipe).&lt;br /&gt;
Le point de spawn et le pickup peuvent être utilisé par une ressource externe. Les éléments personnalisés doievent être gérés par le mode de jeu.&lt;br /&gt;
&lt;br /&gt;
Pour résumé, votre objectif est de facilité la vie des mappeurs. Ceux-ci ne doivent pas avoir à se tracasser du script concernant le mode de jeu.&lt;br /&gt;
&lt;br /&gt;
====Exemple de récupération d'informations sur un .map====&lt;br /&gt;
Votre mode de jeu doit appelés les éléments personnalisés définit dans le fichier .map afin des les utilisés. Ce n'est pas bien compliqué et voici une démonstration ci-dessous.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- récupère une liste avec tout les éléments de type flag&lt;br /&gt;
local flagElements = getElementsByType ( &amp;quot;flag&amp;quot; )&lt;br /&gt;
-- On boucle sur cette liste pour récupérer les positions&lt;br /&gt;
for key, value in pairs(flagElements) do&lt;br /&gt;
	-- Récupération des informations&lt;br /&gt;
	local posX = getElementData ( value, &amp;quot;posX&amp;quot; )&lt;br /&gt;
	local posY = getElementData ( value, &amp;quot;posY&amp;quot; )&lt;br /&gt;
	local posZ = getElementData ( value, &amp;quot;posZ&amp;quot; )&lt;br /&gt;
	local team = getElementData ( value, &amp;quot;team&amp;quot; )&lt;br /&gt;
	-- Création de l'objet flag&lt;br /&gt;
	createObject ( 1337, posX, posY, posZ )&lt;br /&gt;
	-- Affichage dans le tchat que le dreapau est créé&lt;br /&gt;
	outputChatBox ( &amp;quot;Base for team &amp;quot; .. team .. &amp;quot; created&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
La fonction [[getElementsByType]] récupère une table de tout les éléments d'un certain type. (le type correspond au noeud créé dans le fichier .map)&lt;br /&gt;
Fonctionne pour les objets presonnalisé mais aussi pour les objets présents par défauts dans MTA comme &amp;quot;vehicle&amp;quot; ou &amp;quot;player&amp;quot;.&lt;br /&gt;
[[getElementData]] peut être utilisé pour récupérer les atributs XML définis dans le fichier .map.&lt;br /&gt;
Pour exemple, un objet est créé à la position du drapeau et un message s'affiche dans le tchat pour prévenir les joueurs. En réalité, cette action sera plutôt réalisée lors du chargement de la map. Par contre on peut imaginer une action lorsqu'un joueur s'empare du drapeau ennemi.&lt;br /&gt;
&lt;br /&gt;
==Map Manager==&lt;br /&gt;
Après avoir lu les sections ci-dessus il doit vous paraître clair qu'un mode de jeu est composé en deux parties :&lt;br /&gt;
* La ressource du mode de jeu (Unique)&lt;br /&gt;
* Les maps qui accompagnent le mode de jeu&lt;br /&gt;
&lt;br /&gt;
Now instead of writing a map-loader for every single gamemode, the [[Map manager]] provides functions to load gamemodes and maps. Simply put, when you enter the correct command (for example 'gamemode ctf ctf-italy') it will start both resources 'ctf' and 'ctf-italy' while triggering an event ([[onGamemodeMapStart]]) to tell the 'ctf' resource that a map was loaded. The 'ctf' resource can then access the information 'ctf-italy' contains and start spawning players etc.&lt;br /&gt;
&lt;br /&gt;
===How to use the mapmanager===&lt;br /&gt;
To use the mapmanager service, your gamemode resource has to be tagged as such first. More specifically you'll be setting the &amp;quot;type&amp;quot; attribute of its &amp;lt;info&amp;gt; tag to &amp;quot;gamemode&amp;quot; inside meta.xml. Also, you can set the &amp;quot;name&amp;quot; attribute to a friendly name (like &amp;quot;Capture the flag&amp;quot;) that will be shown on ASE instead of the resource name.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- meta.xml in &amp;quot;cowcatapult&amp;quot; gamemode --&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info type=&amp;quot;gamemode&amp;quot; name=&amp;quot;Cow catapulting 2.0&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If your gamemode is going to load custom maps, you should add handlers for&lt;br /&gt;
* onGamemodeMapStart&lt;br /&gt;
* onGamemodeMapStop (if any unloading is necessary)&lt;br /&gt;
These are fired when a map for your gamemode is started or stopped, and pass the map resource as a parameter.&lt;br /&gt;
Within the handler function for these events you can extract all info you need from the resource's map files and configuration files.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function startCtfMap( startedMap ) -- startedMap contains a reference to the resource of the map&lt;br /&gt;
    local mapRoot = getResourceRootElement( startedMap )        -- get the root node of the started map&lt;br /&gt;
    local flagElements = getElementsByType ( &amp;quot;flag&amp;quot; , mapRoot ) -- get all flags in the map and store them in a table&lt;br /&gt;
    -- go on loading information like in the example above&lt;br /&gt;
    -- spawn players etc.&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onGamemodeMapStart&amp;quot;, getRootElement(), startCtfMap)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Making maps compatible===&lt;br /&gt;
Maps are separate resources. This is done so no editing of the gamemode resource is ever necessary in order to create a custom map, and also allows you to pack map-specific scripts/config files with them.&lt;br /&gt;
&lt;br /&gt;
To make a map compatible with your gamemode, open its resource's meta.xml and tag it as well: the &amp;quot;type&amp;quot; attribute must be set to &amp;quot;map&amp;quot;, and the &amp;quot;gamemodes&amp;quot; attribute must be a comma-separated list (no spaces) of gamemode resource names that the map works with.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!--map's meta.xml--&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;cowcatapult,assault,tdm&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have everything set up, admins will use these two commands to start/stop gamemodes:&lt;br /&gt;
/gamemode gamemodeName [mapName] (optional parameter allows picking an initial map, defaults to none)&lt;br /&gt;
/changemap mapName [gamemodeName] (optional parameter specifies the gamemode to start the map with, defaults to the current one)&lt;br /&gt;
&lt;br /&gt;
[[Map manager]] exports a few more access functions which you don't have to use, but may be useful.&lt;br /&gt;
&lt;br /&gt;
==What else should you do==&lt;br /&gt;
There are several other resources that gamemodes should use/be compliant with.&lt;br /&gt;
&lt;br /&gt;
===Helpmanager===&lt;br /&gt;
The helpmanager is ought to be the standard interface for players when they need help. If you use the helpmanager to display your gamemode's help, every player that used helpmanager before (e.g. in other gamemodes) will immediately know how to get there. It also displays help for different resources running resources in one window, if necessary.&lt;br /&gt;
&lt;br /&gt;
There are basicially two ways to use the helpmanager:&lt;br /&gt;
* Provide a simple text that explains how to use your gamemode&lt;br /&gt;
* Request a GUI element from the helpmanager that will be displayed in its own tab in the helpmanager window and lets you add any GUI elements to it. This is the recommended way for gamemodes that need to display more complex information that needs its own GUI.&lt;br /&gt;
&lt;br /&gt;
Read the helpmanager page for details on how to do it.&lt;br /&gt;
&lt;br /&gt;
===Scoreboard===&lt;br /&gt;
Scoreboard displays players and teams currently ingame. You add custom columns to it to provide map specific information. For example the column 'points' in the 'ctf' gamemode could represent the player's points gained through kills or captures. As usual, see the scoreboard help page for more information.&lt;br /&gt;
&lt;br /&gt;
===Map cycler===&lt;br /&gt;
The map cycler controls what gamemodes and maps are played on a server. You can specifiy for example how many times in a row a map will be played until it switches to the next. To achieve this, you need to tell the map cycler when your gamemode finished (e.g. when a round ends).&lt;br /&gt;
&lt;br /&gt;
[[it:Scrivere una gamemode]]&lt;br /&gt;
[[ru:Writing Gamemodes]]&lt;br /&gt;
[[de:Gamemodes schreiben]]&lt;/div&gt;</summary>
		<author><name>Gaetan Piette</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Cr%C3%A9er_un_mode_de_jeu&amp;diff=39236</id>
		<title>Créer un mode de jeu</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Cr%C3%A9er_un_mode_de_jeu&amp;diff=39236"/>
		<updated>2014-04-04T10:07:51Z</updated>

		<summary type="html">&lt;p&gt;Gaetan Piette: /* Exemple de récupération d'informations sur un .map */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ce guide à pour but de vous aprpendre à créer un mode de jeu. Si vous venez juste de commencer à scripter pour MTA, il serait préférable que vous lisiez les autres tutoriels de l apage principale.&lt;br /&gt;
 &lt;br /&gt;
==Introduction==&lt;br /&gt;
Un mode de jeu est une ressource qu iune fois démarrée contrôle tout les éléments du gameplay. Cela inclus l'explication du mode de jeu aux joueurs. Par exemple expliquer comment gagner des points ou de l'argent. (Mode de jeu existans : race, deathmatch, ctf, freeroam et bien d'autres).&lt;br /&gt;
&lt;br /&gt;
==Que signifie &amp;quot;coder proprement un mode de jeu&amp;quot; ?==&lt;br /&gt;
Pour faire simple, un mode de jeu doit utilisé les fonctionnalités du système de map dans MTA. Cela signifie que le code des maps doit être accompagné des position des véhicule, spawn des joueur et autres. Cela permet au mode de jeu d'être indépendant des maps proposées par les joueurs.&lt;br /&gt;
&lt;br /&gt;
Instead, the gamemode should be able to load .map files which define these data. This way the gamemode can have multiple maps; also, people can create .map files for the gamemode with MTA's map editor, which is much more convenient than writing code.&lt;br /&gt;
&lt;br /&gt;
An obvious example of a &amp;quot;proper gamemode&amp;quot; is MTA:Race. It allows usermade maps with lots of possibilities within the .map file. To alter spawnpoints, objects etc., the user doesn't need to edit the gamemode itself.&lt;br /&gt;
&lt;br /&gt;
===Fichier MAP===&lt;br /&gt;
Les fichiers map sont en XML avec l'extension .map. Ils définissent l'environnement pour un mode de jeu ou plusieurs si la map est compatible avec d'aures. Ils ne sont cependant pas supposés changer les règles du jeu. Les règles sont définies dans le mode de jeu.&lt;br /&gt;
&lt;br /&gt;
Chaque élémment dans une map correspond à un noeud dans le fichier .map. Il y a une syntaxe particulière pour les points de spawn, objets ou véhicules. Cependant il est possible, pour des cas d'ajouts d'objets spéciaux d'inventer votre propre syntaxe.&lt;br /&gt;
&lt;br /&gt;
====Exemple====&lt;br /&gt;
Commencons par un mode de jeu bien connu, la capture de drapeau. Une map pour ce mode de jeu à besoin de point de spawn et de positions pour les drapeaux des deux équipes. On peut aussi y ajouter des véhicules et d'autres objets. Un fichier de map simplifié pourrait ressembler à ça :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;map&amp;gt;&lt;br /&gt;
    &amp;lt;spawnpoint id=&amp;quot;spawnpoint1&amp;quot; posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;877.25219726563&amp;quot; rot=&amp;quot;63.350006103516&amp;quot; model=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;pickup id=&amp;quot;Armor 1&amp;quot; posX=&amp;quot;1911.083984375&amp;quot; posY=&amp;quot;-1658.8798828125&amp;quot; posZ=&amp;quot;885.40216064453&amp;quot; type=&amp;quot;armor&amp;quot; health=&amp;quot;50&amp;quot; respawn=&amp;quot;60000&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;flag posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;877.25219726563&amp;quot; team=&amp;quot;blue&amp;quot; /&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dans le code ci-dessus on peut apercevoir trois éléments : un point de spawn,un pickup et un flag.&lt;br /&gt;
Le pickup permettera une fois pris par le joueur de lui rendre 50 points de vie, celui-ci respawn toute les 60 secondes.&lt;br /&gt;
Le flag est ici définit au niveau de sa position et de sa couleur (propre à l'équipe).&lt;br /&gt;
Le point de spawn et le pickup peuvent être utilisé par une ressource externe. Les éléments personnalisés doievent être gérés par le mode de jeu.&lt;br /&gt;
&lt;br /&gt;
Pour résumé, votre objectif est de facilité la vie des mappeurs. Ceux-ci ne doivent pas avoir à se tracasser du script concernant le mode de jeu.&lt;br /&gt;
&lt;br /&gt;
====Exemple de récupération d'informations sur un .map====&lt;br /&gt;
Votre mode de jeu doit appelés les éléments personnalisés définit dans le fichier .map afin des les utilisés. Ce n'est pas bien compliqué et voici une démonstration ci-dessous.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- récupère une liste avec tout les éléments de type flag&lt;br /&gt;
local flagElements = getElementsByType ( &amp;quot;flag&amp;quot; )&lt;br /&gt;
-- On boucle sur cette liste pour récupérer les positions&lt;br /&gt;
for key, value in pairs(flagElements) do&lt;br /&gt;
	-- Récupération des informations&lt;br /&gt;
	local posX = getElementData ( value, &amp;quot;posX&amp;quot; )&lt;br /&gt;
	local posY = getElementData ( value, &amp;quot;posY&amp;quot; )&lt;br /&gt;
	local posZ = getElementData ( value, &amp;quot;posZ&amp;quot; )&lt;br /&gt;
	local team = getElementData ( value, &amp;quot;team&amp;quot; )&lt;br /&gt;
	-- Création de l'objet flag&lt;br /&gt;
	createObject ( 1337, posX, posY, posZ )&lt;br /&gt;
	-- Affichage dans le tchat que le dreapau est créé&lt;br /&gt;
	outputChatBox ( &amp;quot;Base for team &amp;quot; .. team .. &amp;quot; created&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
La fonction [[getElementsByType]] récupère une table de tout les éléments d'un certain type. (le type correspond au noeud créé dans le fichier .map)&lt;br /&gt;
Fonctionne pour les objets presonnalisé mais aussi pour les objets présents par défauts dans MTA comme &amp;quot;vehicle&amp;quot; ou &amp;quot;player&amp;quot;.&lt;br /&gt;
[[getElementData]] peut être utilisé pour récupérer les atributs XML définis dans le fichier .map.&lt;br /&gt;
Pour exemple, un objet est créé à la position du drapeau et un message s'affiche dans le tchat pour prévenir les joueurs. En réalité, cette action sera plutôt réalisée lors du chargement de la map. Par contre on peut imaginer une action lorsqu'un joueur s'empare du drapeau ennemi.&lt;br /&gt;
&lt;br /&gt;
==Map manager==&lt;br /&gt;
Having read the section above it should be clear that a gamemode should always consist of two parts:&lt;br /&gt;
* The gamemode resource that always stays the same&lt;br /&gt;
* Many different maps resources that give the gamemode map-specific information&lt;br /&gt;
&lt;br /&gt;
Now instead of writing a map-loader for every single gamemode, the [[Map manager]] provides functions to load gamemodes and maps. Simply put, when you enter the correct command (for example 'gamemode ctf ctf-italy') it will start both resources 'ctf' and 'ctf-italy' while triggering an event ([[onGamemodeMapStart]]) to tell the 'ctf' resource that a map was loaded. The 'ctf' resource can then access the information 'ctf-italy' contains and start spawning players etc.&lt;br /&gt;
&lt;br /&gt;
===How to use the mapmanager===&lt;br /&gt;
To use the mapmanager service, your gamemode resource has to be tagged as such first. More specifically you'll be setting the &amp;quot;type&amp;quot; attribute of its &amp;lt;info&amp;gt; tag to &amp;quot;gamemode&amp;quot; inside meta.xml. Also, you can set the &amp;quot;name&amp;quot; attribute to a friendly name (like &amp;quot;Capture the flag&amp;quot;) that will be shown on ASE instead of the resource name.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- meta.xml in &amp;quot;cowcatapult&amp;quot; gamemode --&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info type=&amp;quot;gamemode&amp;quot; name=&amp;quot;Cow catapulting 2.0&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If your gamemode is going to load custom maps, you should add handlers for&lt;br /&gt;
* onGamemodeMapStart&lt;br /&gt;
* onGamemodeMapStop (if any unloading is necessary)&lt;br /&gt;
These are fired when a map for your gamemode is started or stopped, and pass the map resource as a parameter.&lt;br /&gt;
Within the handler function for these events you can extract all info you need from the resource's map files and configuration files.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function startCtfMap( startedMap ) -- startedMap contains a reference to the resource of the map&lt;br /&gt;
    local mapRoot = getResourceRootElement( startedMap )        -- get the root node of the started map&lt;br /&gt;
    local flagElements = getElementsByType ( &amp;quot;flag&amp;quot; , mapRoot ) -- get all flags in the map and store them in a table&lt;br /&gt;
    -- go on loading information like in the example above&lt;br /&gt;
    -- spawn players etc.&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onGamemodeMapStart&amp;quot;, getRootElement(), startCtfMap)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Making maps compatible===&lt;br /&gt;
Maps are separate resources. This is done so no editing of the gamemode resource is ever necessary in order to create a custom map, and also allows you to pack map-specific scripts/config files with them.&lt;br /&gt;
&lt;br /&gt;
To make a map compatible with your gamemode, open its resource's meta.xml and tag it as well: the &amp;quot;type&amp;quot; attribute must be set to &amp;quot;map&amp;quot;, and the &amp;quot;gamemodes&amp;quot; attribute must be a comma-separated list (no spaces) of gamemode resource names that the map works with.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!--map's meta.xml--&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;cowcatapult,assault,tdm&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have everything set up, admins will use these two commands to start/stop gamemodes:&lt;br /&gt;
/gamemode gamemodeName [mapName] (optional parameter allows picking an initial map, defaults to none)&lt;br /&gt;
/changemap mapName [gamemodeName] (optional parameter specifies the gamemode to start the map with, defaults to the current one)&lt;br /&gt;
&lt;br /&gt;
[[Map manager]] exports a few more access functions which you don't have to use, but may be useful.&lt;br /&gt;
&lt;br /&gt;
==What else should you do==&lt;br /&gt;
There are several other resources that gamemodes should use/be compliant with.&lt;br /&gt;
&lt;br /&gt;
===Helpmanager===&lt;br /&gt;
The helpmanager is ought to be the standard interface for players when they need help. If you use the helpmanager to display your gamemode's help, every player that used helpmanager before (e.g. in other gamemodes) will immediately know how to get there. It also displays help for different resources running resources in one window, if necessary.&lt;br /&gt;
&lt;br /&gt;
There are basicially two ways to use the helpmanager:&lt;br /&gt;
* Provide a simple text that explains how to use your gamemode&lt;br /&gt;
* Request a GUI element from the helpmanager that will be displayed in its own tab in the helpmanager window and lets you add any GUI elements to it. This is the recommended way for gamemodes that need to display more complex information that needs its own GUI.&lt;br /&gt;
&lt;br /&gt;
Read the helpmanager page for details on how to do it.&lt;br /&gt;
&lt;br /&gt;
===Scoreboard===&lt;br /&gt;
Scoreboard displays players and teams currently ingame. You add custom columns to it to provide map specific information. For example the column 'points' in the 'ctf' gamemode could represent the player's points gained through kills or captures. As usual, see the scoreboard help page for more information.&lt;br /&gt;
&lt;br /&gt;
===Map cycler===&lt;br /&gt;
The map cycler controls what gamemodes and maps are played on a server. You can specifiy for example how many times in a row a map will be played until it switches to the next. To achieve this, you need to tell the map cycler when your gamemode finished (e.g. when a round ends).&lt;br /&gt;
&lt;br /&gt;
[[it:Scrivere una gamemode]]&lt;br /&gt;
[[ru:Writing Gamemodes]]&lt;br /&gt;
[[de:Gamemodes schreiben]]&lt;/div&gt;</summary>
		<author><name>Gaetan Piette</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Cr%C3%A9er_un_mode_de_jeu&amp;diff=39235</id>
		<title>Créer un mode de jeu</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Cr%C3%A9er_un_mode_de_jeu&amp;diff=39235"/>
		<updated>2014-04-04T09:53:53Z</updated>

		<summary type="html">&lt;p&gt;Gaetan Piette: /* Exemple */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ce guide à pour but de vous aprpendre à créer un mode de jeu. Si vous venez juste de commencer à scripter pour MTA, il serait préférable que vous lisiez les autres tutoriels de l apage principale.&lt;br /&gt;
 &lt;br /&gt;
==Introduction==&lt;br /&gt;
Un mode de jeu est une ressource qu iune fois démarrée contrôle tout les éléments du gameplay. Cela inclus l'explication du mode de jeu aux joueurs. Par exemple expliquer comment gagner des points ou de l'argent. (Mode de jeu existans : race, deathmatch, ctf, freeroam et bien d'autres).&lt;br /&gt;
&lt;br /&gt;
==Que signifie &amp;quot;coder proprement un mode de jeu&amp;quot; ?==&lt;br /&gt;
Pour faire simple, un mode de jeu doit utilisé les fonctionnalités du système de map dans MTA. Cela signifie que le code des maps doit être accompagné des position des véhicule, spawn des joueur et autres. Cela permet au mode de jeu d'être indépendant des maps proposées par les joueurs.&lt;br /&gt;
&lt;br /&gt;
Instead, the gamemode should be able to load .map files which define these data. This way the gamemode can have multiple maps; also, people can create .map files for the gamemode with MTA's map editor, which is much more convenient than writing code.&lt;br /&gt;
&lt;br /&gt;
An obvious example of a &amp;quot;proper gamemode&amp;quot; is MTA:Race. It allows usermade maps with lots of possibilities within the .map file. To alter spawnpoints, objects etc., the user doesn't need to edit the gamemode itself.&lt;br /&gt;
&lt;br /&gt;
===Fichier MAP===&lt;br /&gt;
Les fichiers map sont en XML avec l'extension .map. Ils définissent l'environnement pour un mode de jeu ou plusieurs si la map est compatible avec d'aures. Ils ne sont cependant pas supposés changer les règles du jeu. Les règles sont définies dans le mode de jeu.&lt;br /&gt;
&lt;br /&gt;
Chaque élémment dans une map correspond à un noeud dans le fichier .map. Il y a une syntaxe particulière pour les points de spawn, objets ou véhicules. Cependant il est possible, pour des cas d'ajouts d'objets spéciaux d'inventer votre propre syntaxe.&lt;br /&gt;
&lt;br /&gt;
====Exemple====&lt;br /&gt;
Commencons par un mode de jeu bien connu, la capture de drapeau. Une map pour ce mode de jeu à besoin de point de spawn et de positions pour les drapeaux des deux équipes. On peut aussi y ajouter des véhicules et d'autres objets. Un fichier de map simplifié pourrait ressembler à ça :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;map&amp;gt;&lt;br /&gt;
    &amp;lt;spawnpoint id=&amp;quot;spawnpoint1&amp;quot; posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;877.25219726563&amp;quot; rot=&amp;quot;63.350006103516&amp;quot; model=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;pickup id=&amp;quot;Armor 1&amp;quot; posX=&amp;quot;1911.083984375&amp;quot; posY=&amp;quot;-1658.8798828125&amp;quot; posZ=&amp;quot;885.40216064453&amp;quot; type=&amp;quot;armor&amp;quot; health=&amp;quot;50&amp;quot; respawn=&amp;quot;60000&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;flag posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;877.25219726563&amp;quot; team=&amp;quot;blue&amp;quot; /&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dans le code ci-dessus on peut apercevoir trois éléments : un point de spawn,un pickup et un flag.&lt;br /&gt;
Le pickup permettera une fois pris par le joueur de lui rendre 50 points de vie, celui-ci respawn toute les 60 secondes.&lt;br /&gt;
Le flag est ici définit au niveau de sa position et de sa couleur (propre à l'équipe).&lt;br /&gt;
Le point de spawn et le pickup peuvent être utilisé par une ressource externe. Les éléments personnalisés doievent être gérés par le mode de jeu.&lt;br /&gt;
&lt;br /&gt;
Pour résumé, votre objectif est de facilité la vie des mappeurs. Ceux-ci ne doivent pas avoir à se tracasser du script concernant le mode de jeu.&lt;br /&gt;
&lt;br /&gt;
====Exemple de récupération d'informations sur un .map====&lt;br /&gt;
As mentioned above, your gamemode needs de retrieve custom elements that are defined in a map file and process them. This is quite easy as demonstrated below.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- retrieve a table with all flag elements&lt;br /&gt;
local flagElements = getElementsByType ( &amp;quot;flag&amp;quot; )&lt;br /&gt;
-- loop through them&lt;br /&gt;
for key, value in pairs(flagElements) do&lt;br /&gt;
	-- get our info&lt;br /&gt;
	local posX = getElementData ( value, &amp;quot;posX&amp;quot; )&lt;br /&gt;
	local posY = getElementData ( value, &amp;quot;posY&amp;quot; )&lt;br /&gt;
	local posZ = getElementData ( value, &amp;quot;posZ&amp;quot; )&lt;br /&gt;
	local team = getElementData ( value, &amp;quot;team&amp;quot; )&lt;br /&gt;
	-- create an object according to the flag position&lt;br /&gt;
	createObject ( 1337, posX, posY, posZ )&lt;br /&gt;
	-- output the team that we created a base for&lt;br /&gt;
	outputChatBox ( &amp;quot;Base for team &amp;quot; .. team .. &amp;quot; created&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The [[getElementsByType]] function retrieves a table of all the elements of a certain type (the type corresponds to the node name in the .map file). This works for both custom types and built-in MTA types (like &amp;quot;vehicle&amp;quot; or &amp;quot;player&amp;quot;).&lt;br /&gt;
[[getElementData]] can be used to retrieve the xml attributes set in the .map file.&lt;br /&gt;
In this simple example, an object is created at the flag's location and a message is outputted in the chatbox. In reality, you will of course need to do more during map loading, like in this case setting up collision shapes to detect players taking the flag.&lt;br /&gt;
&lt;br /&gt;
==Map manager==&lt;br /&gt;
Having read the section above it should be clear that a gamemode should always consist of two parts:&lt;br /&gt;
* The gamemode resource that always stays the same&lt;br /&gt;
* Many different maps resources that give the gamemode map-specific information&lt;br /&gt;
&lt;br /&gt;
Now instead of writing a map-loader for every single gamemode, the [[Map manager]] provides functions to load gamemodes and maps. Simply put, when you enter the correct command (for example 'gamemode ctf ctf-italy') it will start both resources 'ctf' and 'ctf-italy' while triggering an event ([[onGamemodeMapStart]]) to tell the 'ctf' resource that a map was loaded. The 'ctf' resource can then access the information 'ctf-italy' contains and start spawning players etc.&lt;br /&gt;
&lt;br /&gt;
===How to use the mapmanager===&lt;br /&gt;
To use the mapmanager service, your gamemode resource has to be tagged as such first. More specifically you'll be setting the &amp;quot;type&amp;quot; attribute of its &amp;lt;info&amp;gt; tag to &amp;quot;gamemode&amp;quot; inside meta.xml. Also, you can set the &amp;quot;name&amp;quot; attribute to a friendly name (like &amp;quot;Capture the flag&amp;quot;) that will be shown on ASE instead of the resource name.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- meta.xml in &amp;quot;cowcatapult&amp;quot; gamemode --&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info type=&amp;quot;gamemode&amp;quot; name=&amp;quot;Cow catapulting 2.0&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If your gamemode is going to load custom maps, you should add handlers for&lt;br /&gt;
* onGamemodeMapStart&lt;br /&gt;
* onGamemodeMapStop (if any unloading is necessary)&lt;br /&gt;
These are fired when a map for your gamemode is started or stopped, and pass the map resource as a parameter.&lt;br /&gt;
Within the handler function for these events you can extract all info you need from the resource's map files and configuration files.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function startCtfMap( startedMap ) -- startedMap contains a reference to the resource of the map&lt;br /&gt;
    local mapRoot = getResourceRootElement( startedMap )        -- get the root node of the started map&lt;br /&gt;
    local flagElements = getElementsByType ( &amp;quot;flag&amp;quot; , mapRoot ) -- get all flags in the map and store them in a table&lt;br /&gt;
    -- go on loading information like in the example above&lt;br /&gt;
    -- spawn players etc.&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onGamemodeMapStart&amp;quot;, getRootElement(), startCtfMap)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Making maps compatible===&lt;br /&gt;
Maps are separate resources. This is done so no editing of the gamemode resource is ever necessary in order to create a custom map, and also allows you to pack map-specific scripts/config files with them.&lt;br /&gt;
&lt;br /&gt;
To make a map compatible with your gamemode, open its resource's meta.xml and tag it as well: the &amp;quot;type&amp;quot; attribute must be set to &amp;quot;map&amp;quot;, and the &amp;quot;gamemodes&amp;quot; attribute must be a comma-separated list (no spaces) of gamemode resource names that the map works with.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!--map's meta.xml--&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;cowcatapult,assault,tdm&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have everything set up, admins will use these two commands to start/stop gamemodes:&lt;br /&gt;
/gamemode gamemodeName [mapName] (optional parameter allows picking an initial map, defaults to none)&lt;br /&gt;
/changemap mapName [gamemodeName] (optional parameter specifies the gamemode to start the map with, defaults to the current one)&lt;br /&gt;
&lt;br /&gt;
[[Map manager]] exports a few more access functions which you don't have to use, but may be useful.&lt;br /&gt;
&lt;br /&gt;
==What else should you do==&lt;br /&gt;
There are several other resources that gamemodes should use/be compliant with.&lt;br /&gt;
&lt;br /&gt;
===Helpmanager===&lt;br /&gt;
The helpmanager is ought to be the standard interface for players when they need help. If you use the helpmanager to display your gamemode's help, every player that used helpmanager before (e.g. in other gamemodes) will immediately know how to get there. It also displays help for different resources running resources in one window, if necessary.&lt;br /&gt;
&lt;br /&gt;
There are basicially two ways to use the helpmanager:&lt;br /&gt;
* Provide a simple text that explains how to use your gamemode&lt;br /&gt;
* Request a GUI element from the helpmanager that will be displayed in its own tab in the helpmanager window and lets you add any GUI elements to it. This is the recommended way for gamemodes that need to display more complex information that needs its own GUI.&lt;br /&gt;
&lt;br /&gt;
Read the helpmanager page for details on how to do it.&lt;br /&gt;
&lt;br /&gt;
===Scoreboard===&lt;br /&gt;
Scoreboard displays players and teams currently ingame. You add custom columns to it to provide map specific information. For example the column 'points' in the 'ctf' gamemode could represent the player's points gained through kills or captures. As usual, see the scoreboard help page for more information.&lt;br /&gt;
&lt;br /&gt;
===Map cycler===&lt;br /&gt;
The map cycler controls what gamemodes and maps are played on a server. You can specifiy for example how many times in a row a map will be played until it switches to the next. To achieve this, you need to tell the map cycler when your gamemode finished (e.g. when a round ends).&lt;br /&gt;
&lt;br /&gt;
[[it:Scrivere una gamemode]]&lt;br /&gt;
[[ru:Writing Gamemodes]]&lt;br /&gt;
[[de:Gamemodes schreiben]]&lt;/div&gt;</summary>
		<author><name>Gaetan Piette</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Cr%C3%A9er_un_mode_de_jeu&amp;diff=39234</id>
		<title>Créer un mode de jeu</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Cr%C3%A9er_un_mode_de_jeu&amp;diff=39234"/>
		<updated>2014-04-04T09:47:12Z</updated>

		<summary type="html">&lt;p&gt;Gaetan Piette: /* Fichier MAP */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ce guide à pour but de vous aprpendre à créer un mode de jeu. Si vous venez juste de commencer à scripter pour MTA, il serait préférable que vous lisiez les autres tutoriels de l apage principale.&lt;br /&gt;
 &lt;br /&gt;
==Introduction==&lt;br /&gt;
Un mode de jeu est une ressource qu iune fois démarrée contrôle tout les éléments du gameplay. Cela inclus l'explication du mode de jeu aux joueurs. Par exemple expliquer comment gagner des points ou de l'argent. (Mode de jeu existans : race, deathmatch, ctf, freeroam et bien d'autres).&lt;br /&gt;
&lt;br /&gt;
==Que signifie &amp;quot;coder proprement un mode de jeu&amp;quot; ?==&lt;br /&gt;
Pour faire simple, un mode de jeu doit utilisé les fonctionnalités du système de map dans MTA. Cela signifie que le code des maps doit être accompagné des position des véhicule, spawn des joueur et autres. Cela permet au mode de jeu d'être indépendant des maps proposées par les joueurs.&lt;br /&gt;
&lt;br /&gt;
Instead, the gamemode should be able to load .map files which define these data. This way the gamemode can have multiple maps; also, people can create .map files for the gamemode with MTA's map editor, which is much more convenient than writing code.&lt;br /&gt;
&lt;br /&gt;
An obvious example of a &amp;quot;proper gamemode&amp;quot; is MTA:Race. It allows usermade maps with lots of possibilities within the .map file. To alter spawnpoints, objects etc., the user doesn't need to edit the gamemode itself.&lt;br /&gt;
&lt;br /&gt;
===Fichier MAP===&lt;br /&gt;
Les fichiers map sont en XML avec l'extension .map. Ils définissent l'environnement pour un mode de jeu ou plusieurs si la map est compatible avec d'aures. Ils ne sont cependant pas supposés changer les règles du jeu. Les règles sont définies dans le mode de jeu.&lt;br /&gt;
&lt;br /&gt;
Chaque élémment dans une map correspond à un noeud dans le fichier .map. Il y a une syntaxe particulière pour les points de spawn, objets ou véhicules. Cependant il est possible, pour des cas d'ajouts d'objets spéciaux d'inventer votre propre syntaxe.&lt;br /&gt;
&lt;br /&gt;
====Exemple====&lt;br /&gt;
Commencons par un mode de jeu bien connu, la capture de drapeau. Une map pour ce mode de jeu à besoin de point de spawn et de positions pour les drapeaux des deux équipes. On peut aussi y ajouter des véhicules et d'autres objets. Un fichier de map simplifié pourrait ressembler à ça :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;map&amp;gt;&lt;br /&gt;
    &amp;lt;spawnpoint id=&amp;quot;spawnpoint1&amp;quot; posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;877.25219726563&amp;quot; rot=&amp;quot;63.350006103516&amp;quot; model=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;pickup id=&amp;quot;Armor 1&amp;quot; posX=&amp;quot;1911.083984375&amp;quot; posY=&amp;quot;-1658.8798828125&amp;quot; posZ=&amp;quot;885.40216064453&amp;quot; type=&amp;quot;armor&amp;quot; health=&amp;quot;50&amp;quot; respawn=&amp;quot;60000&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;flag posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;877.25219726563&amp;quot; team=&amp;quot;blue&amp;quot; /&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dans le code ci-dessus on peut apercevoir deux éléments : un point de spawn et un pickup.&lt;br /&gt;
Le pickup permettera une fois pris par le joueur de lui rendre 50 points de vie, celui-ci respawn toute les 60 secondes.&lt;br /&gt;
More importantly, this .map has a custom &amp;quot;flag&amp;quot; node which defines the position and color of the flag. The spawnpoint and pickup can be handled by existing external resources, custom elements have to be processed by the gamemode.&lt;br /&gt;
&lt;br /&gt;
To summarize - we want mass mapper input as we saw in MTA:Race. Users should NOT have to touch the gamemode script itself at all.&lt;br /&gt;
&lt;br /&gt;
====Exemple de récupération d'informations sur un .map====&lt;br /&gt;
As mentioned above, your gamemode needs de retrieve custom elements that are defined in a map file and process them. This is quite easy as demonstrated below.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- retrieve a table with all flag elements&lt;br /&gt;
local flagElements = getElementsByType ( &amp;quot;flag&amp;quot; )&lt;br /&gt;
-- loop through them&lt;br /&gt;
for key, value in pairs(flagElements) do&lt;br /&gt;
	-- get our info&lt;br /&gt;
	local posX = getElementData ( value, &amp;quot;posX&amp;quot; )&lt;br /&gt;
	local posY = getElementData ( value, &amp;quot;posY&amp;quot; )&lt;br /&gt;
	local posZ = getElementData ( value, &amp;quot;posZ&amp;quot; )&lt;br /&gt;
	local team = getElementData ( value, &amp;quot;team&amp;quot; )&lt;br /&gt;
	-- create an object according to the flag position&lt;br /&gt;
	createObject ( 1337, posX, posY, posZ )&lt;br /&gt;
	-- output the team that we created a base for&lt;br /&gt;
	outputChatBox ( &amp;quot;Base for team &amp;quot; .. team .. &amp;quot; created&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The [[getElementsByType]] function retrieves a table of all the elements of a certain type (the type corresponds to the node name in the .map file). This works for both custom types and built-in MTA types (like &amp;quot;vehicle&amp;quot; or &amp;quot;player&amp;quot;).&lt;br /&gt;
[[getElementData]] can be used to retrieve the xml attributes set in the .map file.&lt;br /&gt;
In this simple example, an object is created at the flag's location and a message is outputted in the chatbox. In reality, you will of course need to do more during map loading, like in this case setting up collision shapes to detect players taking the flag.&lt;br /&gt;
&lt;br /&gt;
==Map manager==&lt;br /&gt;
Having read the section above it should be clear that a gamemode should always consist of two parts:&lt;br /&gt;
* The gamemode resource that always stays the same&lt;br /&gt;
* Many different maps resources that give the gamemode map-specific information&lt;br /&gt;
&lt;br /&gt;
Now instead of writing a map-loader for every single gamemode, the [[Map manager]] provides functions to load gamemodes and maps. Simply put, when you enter the correct command (for example 'gamemode ctf ctf-italy') it will start both resources 'ctf' and 'ctf-italy' while triggering an event ([[onGamemodeMapStart]]) to tell the 'ctf' resource that a map was loaded. The 'ctf' resource can then access the information 'ctf-italy' contains and start spawning players etc.&lt;br /&gt;
&lt;br /&gt;
===How to use the mapmanager===&lt;br /&gt;
To use the mapmanager service, your gamemode resource has to be tagged as such first. More specifically you'll be setting the &amp;quot;type&amp;quot; attribute of its &amp;lt;info&amp;gt; tag to &amp;quot;gamemode&amp;quot; inside meta.xml. Also, you can set the &amp;quot;name&amp;quot; attribute to a friendly name (like &amp;quot;Capture the flag&amp;quot;) that will be shown on ASE instead of the resource name.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- meta.xml in &amp;quot;cowcatapult&amp;quot; gamemode --&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info type=&amp;quot;gamemode&amp;quot; name=&amp;quot;Cow catapulting 2.0&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If your gamemode is going to load custom maps, you should add handlers for&lt;br /&gt;
* onGamemodeMapStart&lt;br /&gt;
* onGamemodeMapStop (if any unloading is necessary)&lt;br /&gt;
These are fired when a map for your gamemode is started or stopped, and pass the map resource as a parameter.&lt;br /&gt;
Within the handler function for these events you can extract all info you need from the resource's map files and configuration files.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function startCtfMap( startedMap ) -- startedMap contains a reference to the resource of the map&lt;br /&gt;
    local mapRoot = getResourceRootElement( startedMap )        -- get the root node of the started map&lt;br /&gt;
    local flagElements = getElementsByType ( &amp;quot;flag&amp;quot; , mapRoot ) -- get all flags in the map and store them in a table&lt;br /&gt;
    -- go on loading information like in the example above&lt;br /&gt;
    -- spawn players etc.&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onGamemodeMapStart&amp;quot;, getRootElement(), startCtfMap)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Making maps compatible===&lt;br /&gt;
Maps are separate resources. This is done so no editing of the gamemode resource is ever necessary in order to create a custom map, and also allows you to pack map-specific scripts/config files with them.&lt;br /&gt;
&lt;br /&gt;
To make a map compatible with your gamemode, open its resource's meta.xml and tag it as well: the &amp;quot;type&amp;quot; attribute must be set to &amp;quot;map&amp;quot;, and the &amp;quot;gamemodes&amp;quot; attribute must be a comma-separated list (no spaces) of gamemode resource names that the map works with.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!--map's meta.xml--&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;cowcatapult,assault,tdm&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have everything set up, admins will use these two commands to start/stop gamemodes:&lt;br /&gt;
/gamemode gamemodeName [mapName] (optional parameter allows picking an initial map, defaults to none)&lt;br /&gt;
/changemap mapName [gamemodeName] (optional parameter specifies the gamemode to start the map with, defaults to the current one)&lt;br /&gt;
&lt;br /&gt;
[[Map manager]] exports a few more access functions which you don't have to use, but may be useful.&lt;br /&gt;
&lt;br /&gt;
==What else should you do==&lt;br /&gt;
There are several other resources that gamemodes should use/be compliant with.&lt;br /&gt;
&lt;br /&gt;
===Helpmanager===&lt;br /&gt;
The helpmanager is ought to be the standard interface for players when they need help. If you use the helpmanager to display your gamemode's help, every player that used helpmanager before (e.g. in other gamemodes) will immediately know how to get there. It also displays help for different resources running resources in one window, if necessary.&lt;br /&gt;
&lt;br /&gt;
There are basicially two ways to use the helpmanager:&lt;br /&gt;
* Provide a simple text that explains how to use your gamemode&lt;br /&gt;
* Request a GUI element from the helpmanager that will be displayed in its own tab in the helpmanager window and lets you add any GUI elements to it. This is the recommended way for gamemodes that need to display more complex information that needs its own GUI.&lt;br /&gt;
&lt;br /&gt;
Read the helpmanager page for details on how to do it.&lt;br /&gt;
&lt;br /&gt;
===Scoreboard===&lt;br /&gt;
Scoreboard displays players and teams currently ingame. You add custom columns to it to provide map specific information. For example the column 'points' in the 'ctf' gamemode could represent the player's points gained through kills or captures. As usual, see the scoreboard help page for more information.&lt;br /&gt;
&lt;br /&gt;
===Map cycler===&lt;br /&gt;
The map cycler controls what gamemodes and maps are played on a server. You can specifiy for example how many times in a row a map will be played until it switches to the next. To achieve this, you need to tell the map cycler when your gamemode finished (e.g. when a round ends).&lt;br /&gt;
&lt;br /&gt;
[[it:Scrivere una gamemode]]&lt;br /&gt;
[[ru:Writing Gamemodes]]&lt;br /&gt;
[[de:Gamemodes schreiben]]&lt;/div&gt;</summary>
		<author><name>Gaetan Piette</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Cr%C3%A9er_un_mode_de_jeu&amp;diff=39233</id>
		<title>Créer un mode de jeu</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Cr%C3%A9er_un_mode_de_jeu&amp;diff=39233"/>
		<updated>2014-04-04T09:32:16Z</updated>

		<summary type="html">&lt;p&gt;Gaetan Piette: /* Que signifie &amp;quot;coder proprement un mode de jeu&amp;quot; ? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ce guide à pour but de vous aprpendre à créer un mode de jeu. Si vous venez juste de commencer à scripter pour MTA, il serait préférable que vous lisiez les autres tutoriels de l apage principale.&lt;br /&gt;
 &lt;br /&gt;
==Introduction==&lt;br /&gt;
Un mode de jeu est une ressource qu iune fois démarrée contrôle tout les éléments du gameplay. Cela inclus l'explication du mode de jeu aux joueurs. Par exemple expliquer comment gagner des points ou de l'argent. (Mode de jeu existans : race, deathmatch, ctf, freeroam et bien d'autres).&lt;br /&gt;
&lt;br /&gt;
==Que signifie &amp;quot;coder proprement un mode de jeu&amp;quot; ?==&lt;br /&gt;
Pour faire simple, un mode de jeu doit utilisé les fonctionnalités du système de map dans MTA. Cela signifie que le code des maps doit être accompagné des position des véhicule, spawn des joueur et autres. Cela permet au mode de jeu d'être indépendant des maps proposées par les joueurs.&lt;br /&gt;
&lt;br /&gt;
Instead, the gamemode should be able to load .map files which define these data. This way the gamemode can have multiple maps; also, people can create .map files for the gamemode with MTA's map editor, which is much more convenient than writing code.&lt;br /&gt;
&lt;br /&gt;
An obvious example of a &amp;quot;proper gamemode&amp;quot; is MTA:Race. It allows usermade maps with lots of possibilities within the .map file. To alter spawnpoints, objects etc., the user doesn't need to edit the gamemode itself.&lt;br /&gt;
&lt;br /&gt;
===Fichier MAP===&lt;br /&gt;
Map files are basically XML documents with a .map extension. They define an environment to play one or more specific gamemodes in. They are however not supposed to change the rules of the game - those are defined by the gamemode.&lt;br /&gt;
&lt;br /&gt;
Each element in a map corresponds to a node in the .map file. There is standard syntax for common things like spawnpoints, objects and vehicles; however, for &amp;quot;special&amp;quot;, gamemode specific information, you need to invent your own syntax.&lt;br /&gt;
&lt;br /&gt;
====Exemple====&lt;br /&gt;
Let's take a Capture the Flag gamemode as an example. A map for this gamemode needs to mainly define spawnpoints and flag locations, and eventually objects and vehicles. A simplified map file could look like this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;map&amp;gt;&lt;br /&gt;
    &amp;lt;spawnpoint id=&amp;quot;spawnpoint1&amp;quot; posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;877.25219726563&amp;quot; rot=&amp;quot;63.350006103516&amp;quot; model=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;pickup id=&amp;quot;Armor 1&amp;quot; posX=&amp;quot;1911.083984375&amp;quot; posY=&amp;quot;-1658.8798828125&amp;quot; posZ=&amp;quot;885.40216064453&amp;quot; type=&amp;quot;armor&amp;quot; health=&amp;quot;50&amp;quot; respawn=&amp;quot;60000&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;flag posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;877.25219726563&amp;quot; team=&amp;quot;blue&amp;quot; /&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you can see two MTA elements - a spawnpoint and a pickup. More importantly, this .map has a custom &amp;quot;flag&amp;quot; node which defines the position and color of the flag. The spawnpoint and pickup can be handled by existing external resources, custom elements have to be processed by the gamemode.&lt;br /&gt;
&lt;br /&gt;
To summarize - we want mass mapper input as we saw in MTA:Race. Users should NOT have to touch the gamemode script itself at all.&lt;br /&gt;
&lt;br /&gt;
====Exemple de récupération d'informations sur un .map====&lt;br /&gt;
As mentioned above, your gamemode needs de retrieve custom elements that are defined in a map file and process them. This is quite easy as demonstrated below.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- retrieve a table with all flag elements&lt;br /&gt;
local flagElements = getElementsByType ( &amp;quot;flag&amp;quot; )&lt;br /&gt;
-- loop through them&lt;br /&gt;
for key, value in pairs(flagElements) do&lt;br /&gt;
	-- get our info&lt;br /&gt;
	local posX = getElementData ( value, &amp;quot;posX&amp;quot; )&lt;br /&gt;
	local posY = getElementData ( value, &amp;quot;posY&amp;quot; )&lt;br /&gt;
	local posZ = getElementData ( value, &amp;quot;posZ&amp;quot; )&lt;br /&gt;
	local team = getElementData ( value, &amp;quot;team&amp;quot; )&lt;br /&gt;
	-- create an object according to the flag position&lt;br /&gt;
	createObject ( 1337, posX, posY, posZ )&lt;br /&gt;
	-- output the team that we created a base for&lt;br /&gt;
	outputChatBox ( &amp;quot;Base for team &amp;quot; .. team .. &amp;quot; created&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The [[getElementsByType]] function retrieves a table of all the elements of a certain type (the type corresponds to the node name in the .map file). This works for both custom types and built-in MTA types (like &amp;quot;vehicle&amp;quot; or &amp;quot;player&amp;quot;).&lt;br /&gt;
[[getElementData]] can be used to retrieve the xml attributes set in the .map file.&lt;br /&gt;
In this simple example, an object is created at the flag's location and a message is outputted in the chatbox. In reality, you will of course need to do more during map loading, like in this case setting up collision shapes to detect players taking the flag.&lt;br /&gt;
&lt;br /&gt;
==Map manager==&lt;br /&gt;
Having read the section above it should be clear that a gamemode should always consist of two parts:&lt;br /&gt;
* The gamemode resource that always stays the same&lt;br /&gt;
* Many different maps resources that give the gamemode map-specific information&lt;br /&gt;
&lt;br /&gt;
Now instead of writing a map-loader for every single gamemode, the [[Map manager]] provides functions to load gamemodes and maps. Simply put, when you enter the correct command (for example 'gamemode ctf ctf-italy') it will start both resources 'ctf' and 'ctf-italy' while triggering an event ([[onGamemodeMapStart]]) to tell the 'ctf' resource that a map was loaded. The 'ctf' resource can then access the information 'ctf-italy' contains and start spawning players etc.&lt;br /&gt;
&lt;br /&gt;
===How to use the mapmanager===&lt;br /&gt;
To use the mapmanager service, your gamemode resource has to be tagged as such first. More specifically you'll be setting the &amp;quot;type&amp;quot; attribute of its &amp;lt;info&amp;gt; tag to &amp;quot;gamemode&amp;quot; inside meta.xml. Also, you can set the &amp;quot;name&amp;quot; attribute to a friendly name (like &amp;quot;Capture the flag&amp;quot;) that will be shown on ASE instead of the resource name.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- meta.xml in &amp;quot;cowcatapult&amp;quot; gamemode --&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info type=&amp;quot;gamemode&amp;quot; name=&amp;quot;Cow catapulting 2.0&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If your gamemode is going to load custom maps, you should add handlers for&lt;br /&gt;
* onGamemodeMapStart&lt;br /&gt;
* onGamemodeMapStop (if any unloading is necessary)&lt;br /&gt;
These are fired when a map for your gamemode is started or stopped, and pass the map resource as a parameter.&lt;br /&gt;
Within the handler function for these events you can extract all info you need from the resource's map files and configuration files.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function startCtfMap( startedMap ) -- startedMap contains a reference to the resource of the map&lt;br /&gt;
    local mapRoot = getResourceRootElement( startedMap )        -- get the root node of the started map&lt;br /&gt;
    local flagElements = getElementsByType ( &amp;quot;flag&amp;quot; , mapRoot ) -- get all flags in the map and store them in a table&lt;br /&gt;
    -- go on loading information like in the example above&lt;br /&gt;
    -- spawn players etc.&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onGamemodeMapStart&amp;quot;, getRootElement(), startCtfMap)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Making maps compatible===&lt;br /&gt;
Maps are separate resources. This is done so no editing of the gamemode resource is ever necessary in order to create a custom map, and also allows you to pack map-specific scripts/config files with them.&lt;br /&gt;
&lt;br /&gt;
To make a map compatible with your gamemode, open its resource's meta.xml and tag it as well: the &amp;quot;type&amp;quot; attribute must be set to &amp;quot;map&amp;quot;, and the &amp;quot;gamemodes&amp;quot; attribute must be a comma-separated list (no spaces) of gamemode resource names that the map works with.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!--map's meta.xml--&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;cowcatapult,assault,tdm&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have everything set up, admins will use these two commands to start/stop gamemodes:&lt;br /&gt;
/gamemode gamemodeName [mapName] (optional parameter allows picking an initial map, defaults to none)&lt;br /&gt;
/changemap mapName [gamemodeName] (optional parameter specifies the gamemode to start the map with, defaults to the current one)&lt;br /&gt;
&lt;br /&gt;
[[Map manager]] exports a few more access functions which you don't have to use, but may be useful.&lt;br /&gt;
&lt;br /&gt;
==What else should you do==&lt;br /&gt;
There are several other resources that gamemodes should use/be compliant with.&lt;br /&gt;
&lt;br /&gt;
===Helpmanager===&lt;br /&gt;
The helpmanager is ought to be the standard interface for players when they need help. If you use the helpmanager to display your gamemode's help, every player that used helpmanager before (e.g. in other gamemodes) will immediately know how to get there. It also displays help for different resources running resources in one window, if necessary.&lt;br /&gt;
&lt;br /&gt;
There are basicially two ways to use the helpmanager:&lt;br /&gt;
* Provide a simple text that explains how to use your gamemode&lt;br /&gt;
* Request a GUI element from the helpmanager that will be displayed in its own tab in the helpmanager window and lets you add any GUI elements to it. This is the recommended way for gamemodes that need to display more complex information that needs its own GUI.&lt;br /&gt;
&lt;br /&gt;
Read the helpmanager page for details on how to do it.&lt;br /&gt;
&lt;br /&gt;
===Scoreboard===&lt;br /&gt;
Scoreboard displays players and teams currently ingame. You add custom columns to it to provide map specific information. For example the column 'points' in the 'ctf' gamemode could represent the player's points gained through kills or captures. As usual, see the scoreboard help page for more information.&lt;br /&gt;
&lt;br /&gt;
===Map cycler===&lt;br /&gt;
The map cycler controls what gamemodes and maps are played on a server. You can specifiy for example how many times in a row a map will be played until it switches to the next. To achieve this, you need to tell the map cycler when your gamemode finished (e.g. when a round ends).&lt;br /&gt;
&lt;br /&gt;
[[it:Scrivere una gamemode]]&lt;br /&gt;
[[ru:Writing Gamemodes]]&lt;br /&gt;
[[de:Gamemodes schreiben]]&lt;/div&gt;</summary>
		<author><name>Gaetan Piette</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Cr%C3%A9er_un_mode_de_jeu&amp;diff=39232</id>
		<title>Créer un mode de jeu</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Cr%C3%A9er_un_mode_de_jeu&amp;diff=39232"/>
		<updated>2014-04-04T09:31:22Z</updated>

		<summary type="html">&lt;p&gt;Gaetan Piette: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ce guide à pour but de vous aprpendre à créer un mode de jeu. Si vous venez juste de commencer à scripter pour MTA, il serait préférable que vous lisiez les autres tutoriels de l apage principale.&lt;br /&gt;
 &lt;br /&gt;
==Introduction==&lt;br /&gt;
Un mode de jeu est une ressource qu iune fois démarrée contrôle tout les éléments du gameplay. Cela inclus l'explication du mode de jeu aux joueurs. Par exemple expliquer comment gagner des points ou de l'argent. (Mode de jeu existans : race, deathmatch, ctf, freeroam et bien d'autres).&lt;br /&gt;
&lt;br /&gt;
==Que signifie &amp;quot;coder proprement un mode de jeu&amp;quot; ?==&lt;br /&gt;
Pour faire simple, un mode de jeu doit utilisé les fonctionnalités du système de map dans MTA. Cela signifie que le code des maps doit être accompagné des position des véhicule, spawn des joueur et autres. Cela permet au mode de jeu d'être indépendant des maps proposées par les joueurs.&lt;br /&gt;
&lt;br /&gt;
Instead, the gamemode should be able to load .map files which define these data. This way the gamemode can have multiple maps; also, people can create .map files for the gamemode with MTA's map editor, which is much more convenient than writing code.&lt;br /&gt;
&lt;br /&gt;
An obvious example of a &amp;quot;proper gamemode&amp;quot; is MTA:Race. It allows usermade maps with lots of possibilities within the .map file. To alter spawnpoints, objects etc., the user doesn't need to edit the gamemode itself.&lt;br /&gt;
&lt;br /&gt;
===Map Files===&lt;br /&gt;
Map files are basically XML documents with a .map extension. They define an environment to play one or more specific gamemodes in. They are however not supposed to change the rules of the game - those are defined by the gamemode.&lt;br /&gt;
&lt;br /&gt;
Each element in a map corresponds to a node in the .map file. There is standard syntax for common things like spawnpoints, objects and vehicles; however, for &amp;quot;special&amp;quot;, gamemode specific information, you need to invent your own syntax.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
Let's take a Capture the Flag gamemode as an example. A map for this gamemode needs to mainly define spawnpoints and flag locations, and eventually objects and vehicles. A simplified map file could look like this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;map&amp;gt;&lt;br /&gt;
    &amp;lt;spawnpoint id=&amp;quot;spawnpoint1&amp;quot; posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;877.25219726563&amp;quot; rot=&amp;quot;63.350006103516&amp;quot; model=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;pickup id=&amp;quot;Armor 1&amp;quot; posX=&amp;quot;1911.083984375&amp;quot; posY=&amp;quot;-1658.8798828125&amp;quot; posZ=&amp;quot;885.40216064453&amp;quot; type=&amp;quot;armor&amp;quot; health=&amp;quot;50&amp;quot; respawn=&amp;quot;60000&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;flag posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;877.25219726563&amp;quot; team=&amp;quot;blue&amp;quot; /&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you can see two MTA elements - a spawnpoint and a pickup. More importantly, this .map has a custom &amp;quot;flag&amp;quot; node which defines the position and color of the flag. The spawnpoint and pickup can be handled by existing external resources, custom elements have to be processed by the gamemode.&lt;br /&gt;
&lt;br /&gt;
To summarize - we want mass mapper input as we saw in MTA:Race. Users should NOT have to touch the gamemode script itself at all.&lt;br /&gt;
&lt;br /&gt;
====Example of getting the .map information====&lt;br /&gt;
As mentioned above, your gamemode needs de retrieve custom elements that are defined in a map file and process them. This is quite easy as demonstrated below.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- retrieve a table with all flag elements&lt;br /&gt;
local flagElements = getElementsByType ( &amp;quot;flag&amp;quot; )&lt;br /&gt;
-- loop through them&lt;br /&gt;
for key, value in pairs(flagElements) do&lt;br /&gt;
	-- get our info&lt;br /&gt;
	local posX = getElementData ( value, &amp;quot;posX&amp;quot; )&lt;br /&gt;
	local posY = getElementData ( value, &amp;quot;posY&amp;quot; )&lt;br /&gt;
	local posZ = getElementData ( value, &amp;quot;posZ&amp;quot; )&lt;br /&gt;
	local team = getElementData ( value, &amp;quot;team&amp;quot; )&lt;br /&gt;
	-- create an object according to the flag position&lt;br /&gt;
	createObject ( 1337, posX, posY, posZ )&lt;br /&gt;
	-- output the team that we created a base for&lt;br /&gt;
	outputChatBox ( &amp;quot;Base for team &amp;quot; .. team .. &amp;quot; created&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The [[getElementsByType]] function retrieves a table of all the elements of a certain type (the type corresponds to the node name in the .map file). This works for both custom types and built-in MTA types (like &amp;quot;vehicle&amp;quot; or &amp;quot;player&amp;quot;).&lt;br /&gt;
[[getElementData]] can be used to retrieve the xml attributes set in the .map file.&lt;br /&gt;
In this simple example, an object is created at the flag's location and a message is outputted in the chatbox. In reality, you will of course need to do more during map loading, like in this case setting up collision shapes to detect players taking the flag.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Map manager==&lt;br /&gt;
Having read the section above it should be clear that a gamemode should always consist of two parts:&lt;br /&gt;
* The gamemode resource that always stays the same&lt;br /&gt;
* Many different maps resources that give the gamemode map-specific information&lt;br /&gt;
&lt;br /&gt;
Now instead of writing a map-loader for every single gamemode, the [[Map manager]] provides functions to load gamemodes and maps. Simply put, when you enter the correct command (for example 'gamemode ctf ctf-italy') it will start both resources 'ctf' and 'ctf-italy' while triggering an event ([[onGamemodeMapStart]]) to tell the 'ctf' resource that a map was loaded. The 'ctf' resource can then access the information 'ctf-italy' contains and start spawning players etc.&lt;br /&gt;
&lt;br /&gt;
===How to use the mapmanager===&lt;br /&gt;
To use the mapmanager service, your gamemode resource has to be tagged as such first. More specifically you'll be setting the &amp;quot;type&amp;quot; attribute of its &amp;lt;info&amp;gt; tag to &amp;quot;gamemode&amp;quot; inside meta.xml. Also, you can set the &amp;quot;name&amp;quot; attribute to a friendly name (like &amp;quot;Capture the flag&amp;quot;) that will be shown on ASE instead of the resource name.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- meta.xml in &amp;quot;cowcatapult&amp;quot; gamemode --&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info type=&amp;quot;gamemode&amp;quot; name=&amp;quot;Cow catapulting 2.0&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If your gamemode is going to load custom maps, you should add handlers for&lt;br /&gt;
* onGamemodeMapStart&lt;br /&gt;
* onGamemodeMapStop (if any unloading is necessary)&lt;br /&gt;
These are fired when a map for your gamemode is started or stopped, and pass the map resource as a parameter.&lt;br /&gt;
Within the handler function for these events you can extract all info you need from the resource's map files and configuration files.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function startCtfMap( startedMap ) -- startedMap contains a reference to the resource of the map&lt;br /&gt;
    local mapRoot = getResourceRootElement( startedMap )        -- get the root node of the started map&lt;br /&gt;
    local flagElements = getElementsByType ( &amp;quot;flag&amp;quot; , mapRoot ) -- get all flags in the map and store them in a table&lt;br /&gt;
    -- go on loading information like in the example above&lt;br /&gt;
    -- spawn players etc.&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onGamemodeMapStart&amp;quot;, getRootElement(), startCtfMap)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Making maps compatible===&lt;br /&gt;
Maps are separate resources. This is done so no editing of the gamemode resource is ever necessary in order to create a custom map, and also allows you to pack map-specific scripts/config files with them.&lt;br /&gt;
&lt;br /&gt;
To make a map compatible with your gamemode, open its resource's meta.xml and tag it as well: the &amp;quot;type&amp;quot; attribute must be set to &amp;quot;map&amp;quot;, and the &amp;quot;gamemodes&amp;quot; attribute must be a comma-separated list (no spaces) of gamemode resource names that the map works with.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!--map's meta.xml--&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;cowcatapult,assault,tdm&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have everything set up, admins will use these two commands to start/stop gamemodes:&lt;br /&gt;
/gamemode gamemodeName [mapName] (optional parameter allows picking an initial map, defaults to none)&lt;br /&gt;
/changemap mapName [gamemodeName] (optional parameter specifies the gamemode to start the map with, defaults to the current one)&lt;br /&gt;
&lt;br /&gt;
[[Map manager]] exports a few more access functions which you don't have to use, but may be useful.&lt;br /&gt;
&lt;br /&gt;
==What else should you do==&lt;br /&gt;
There are several other resources that gamemodes should use/be compliant with.&lt;br /&gt;
&lt;br /&gt;
===Helpmanager===&lt;br /&gt;
The helpmanager is ought to be the standard interface for players when they need help. If you use the helpmanager to display your gamemode's help, every player that used helpmanager before (e.g. in other gamemodes) will immediately know how to get there. It also displays help for different resources running resources in one window, if necessary.&lt;br /&gt;
&lt;br /&gt;
There are basicially two ways to use the helpmanager:&lt;br /&gt;
* Provide a simple text that explains how to use your gamemode&lt;br /&gt;
* Request a GUI element from the helpmanager that will be displayed in its own tab in the helpmanager window and lets you add any GUI elements to it. This is the recommended way for gamemodes that need to display more complex information that needs its own GUI.&lt;br /&gt;
&lt;br /&gt;
Read the helpmanager page for details on how to do it.&lt;br /&gt;
&lt;br /&gt;
===Scoreboard===&lt;br /&gt;
Scoreboard displays players and teams currently ingame. You add custom columns to it to provide map specific information. For example the column 'points' in the 'ctf' gamemode could represent the player's points gained through kills or captures. As usual, see the scoreboard help page for more information.&lt;br /&gt;
&lt;br /&gt;
===Map cycler===&lt;br /&gt;
The map cycler controls what gamemodes and maps are played on a server. You can specifiy for example how many times in a row a map will be played until it switches to the next. To achieve this, you need to tell the map cycler when your gamemode finished (e.g. when a round ends).&lt;br /&gt;
&lt;br /&gt;
[[it:Scrivere una gamemode]]&lt;br /&gt;
[[ru:Writing Gamemodes]]&lt;br /&gt;
[[de:Gamemodes schreiben]]&lt;/div&gt;</summary>
		<author><name>Gaetan Piette</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Cr%C3%A9er_un_mode_de_jeu&amp;diff=39231</id>
		<title>Créer un mode de jeu</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Cr%C3%A9er_un_mode_de_jeu&amp;diff=39231"/>
		<updated>2014-04-04T09:22:47Z</updated>

		<summary type="html">&lt;p&gt;Gaetan Piette: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ce guide à pour but de vous aprpendre à créer un mode de jeu. Si vous venez juste de commencer à scripter pour MTA, il serait préférable que vous lisiez les autres tutoriels de l apage principale.&lt;br /&gt;
 &lt;br /&gt;
==Introduction==&lt;br /&gt;
Un mode de jeu est une ressource qu iune fois démarrée contrôle tout les éléments du gameplay. Cela inclus l'explication du mode de jeu aux joueurs. Par exemple expliquer comment gagner des points ou de l'argent. (Mode de jeu existans : race, deathmatch, ctf, freeroam et bien d'autres).&lt;br /&gt;
&lt;br /&gt;
==Que signifie &amp;quot;coder proprement un mode de jeu&amp;quot; ?==&lt;br /&gt;
Pour faire simple, un mode de jeu doit utilisé les fonctionnalités du système de map dans MTA. Cela signifie que le code des maps pas être différent d'un autre mode de jeu. Les position des véhicule et joueur de gère dans le code du mode de jeu et non dans la map.&lt;br /&gt;
&lt;br /&gt;
Instead, the gamemode should be able to load .map files which define these data. This way the gamemode can have multiple maps; also, people can create .map files for the gamemode with MTA's map editor, which is much more convenient than writing code.&lt;br /&gt;
&lt;br /&gt;
An obvious example of a &amp;quot;proper gamemode&amp;quot; is MTA:Race. It allows usermade maps with lots of possibilities within the .map file. To alter spawnpoints, objects etc., the user doesn't need to edit the gamemode itself.&lt;br /&gt;
&lt;br /&gt;
===Map Files===&lt;br /&gt;
Map files are basically XML documents with a .map extension. They define an environment to play one or more specific gamemodes in. They are however not supposed to change the rules of the game - those are defined by the gamemode.&lt;br /&gt;
&lt;br /&gt;
Each element in a map corresponds to a node in the .map file. There is standard syntax for common things like spawnpoints, objects and vehicles; however, for &amp;quot;special&amp;quot;, gamemode specific information, you need to invent your own syntax.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
Let's take a Capture the Flag gamemode as an example. A map for this gamemode needs to mainly define spawnpoints and flag locations, and eventually objects and vehicles. A simplified map file could look like this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;map&amp;gt;&lt;br /&gt;
    &amp;lt;spawnpoint id=&amp;quot;spawnpoint1&amp;quot; posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;877.25219726563&amp;quot; rot=&amp;quot;63.350006103516&amp;quot; model=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;pickup id=&amp;quot;Armor 1&amp;quot; posX=&amp;quot;1911.083984375&amp;quot; posY=&amp;quot;-1658.8798828125&amp;quot; posZ=&amp;quot;885.40216064453&amp;quot; type=&amp;quot;armor&amp;quot; health=&amp;quot;50&amp;quot; respawn=&amp;quot;60000&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;flag posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;877.25219726563&amp;quot; team=&amp;quot;blue&amp;quot; /&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you can see two MTA elements - a spawnpoint and a pickup. More importantly, this .map has a custom &amp;quot;flag&amp;quot; node which defines the position and color of the flag. The spawnpoint and pickup can be handled by existing external resources, custom elements have to be processed by the gamemode.&lt;br /&gt;
&lt;br /&gt;
To summarize - we want mass mapper input as we saw in MTA:Race. Users should NOT have to touch the gamemode script itself at all.&lt;br /&gt;
&lt;br /&gt;
====Example of getting the .map information====&lt;br /&gt;
As mentioned above, your gamemode needs de retrieve custom elements that are defined in a map file and process them. This is quite easy as demonstrated below.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- retrieve a table with all flag elements&lt;br /&gt;
local flagElements = getElementsByType ( &amp;quot;flag&amp;quot; )&lt;br /&gt;
-- loop through them&lt;br /&gt;
for key, value in pairs(flagElements) do&lt;br /&gt;
	-- get our info&lt;br /&gt;
	local posX = getElementData ( value, &amp;quot;posX&amp;quot; )&lt;br /&gt;
	local posY = getElementData ( value, &amp;quot;posY&amp;quot; )&lt;br /&gt;
	local posZ = getElementData ( value, &amp;quot;posZ&amp;quot; )&lt;br /&gt;
	local team = getElementData ( value, &amp;quot;team&amp;quot; )&lt;br /&gt;
	-- create an object according to the flag position&lt;br /&gt;
	createObject ( 1337, posX, posY, posZ )&lt;br /&gt;
	-- output the team that we created a base for&lt;br /&gt;
	outputChatBox ( &amp;quot;Base for team &amp;quot; .. team .. &amp;quot; created&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The [[getElementsByType]] function retrieves a table of all the elements of a certain type (the type corresponds to the node name in the .map file). This works for both custom types and built-in MTA types (like &amp;quot;vehicle&amp;quot; or &amp;quot;player&amp;quot;).&lt;br /&gt;
[[getElementData]] can be used to retrieve the xml attributes set in the .map file.&lt;br /&gt;
In this simple example, an object is created at the flag's location and a message is outputted in the chatbox. In reality, you will of course need to do more during map loading, like in this case setting up collision shapes to detect players taking the flag.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Map manager==&lt;br /&gt;
Having read the section above it should be clear that a gamemode should always consist of two parts:&lt;br /&gt;
* The gamemode resource that always stays the same&lt;br /&gt;
* Many different maps resources that give the gamemode map-specific information&lt;br /&gt;
&lt;br /&gt;
Now instead of writing a map-loader for every single gamemode, the [[Map manager]] provides functions to load gamemodes and maps. Simply put, when you enter the correct command (for example 'gamemode ctf ctf-italy') it will start both resources 'ctf' and 'ctf-italy' while triggering an event ([[onGamemodeMapStart]]) to tell the 'ctf' resource that a map was loaded. The 'ctf' resource can then access the information 'ctf-italy' contains and start spawning players etc.&lt;br /&gt;
&lt;br /&gt;
===How to use the mapmanager===&lt;br /&gt;
To use the mapmanager service, your gamemode resource has to be tagged as such first. More specifically you'll be setting the &amp;quot;type&amp;quot; attribute of its &amp;lt;info&amp;gt; tag to &amp;quot;gamemode&amp;quot; inside meta.xml. Also, you can set the &amp;quot;name&amp;quot; attribute to a friendly name (like &amp;quot;Capture the flag&amp;quot;) that will be shown on ASE instead of the resource name.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- meta.xml in &amp;quot;cowcatapult&amp;quot; gamemode --&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info type=&amp;quot;gamemode&amp;quot; name=&amp;quot;Cow catapulting 2.0&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If your gamemode is going to load custom maps, you should add handlers for&lt;br /&gt;
* onGamemodeMapStart&lt;br /&gt;
* onGamemodeMapStop (if any unloading is necessary)&lt;br /&gt;
These are fired when a map for your gamemode is started or stopped, and pass the map resource as a parameter.&lt;br /&gt;
Within the handler function for these events you can extract all info you need from the resource's map files and configuration files.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function startCtfMap( startedMap ) -- startedMap contains a reference to the resource of the map&lt;br /&gt;
    local mapRoot = getResourceRootElement( startedMap )        -- get the root node of the started map&lt;br /&gt;
    local flagElements = getElementsByType ( &amp;quot;flag&amp;quot; , mapRoot ) -- get all flags in the map and store them in a table&lt;br /&gt;
    -- go on loading information like in the example above&lt;br /&gt;
    -- spawn players etc.&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onGamemodeMapStart&amp;quot;, getRootElement(), startCtfMap)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Making maps compatible===&lt;br /&gt;
Maps are separate resources. This is done so no editing of the gamemode resource is ever necessary in order to create a custom map, and also allows you to pack map-specific scripts/config files with them.&lt;br /&gt;
&lt;br /&gt;
To make a map compatible with your gamemode, open its resource's meta.xml and tag it as well: the &amp;quot;type&amp;quot; attribute must be set to &amp;quot;map&amp;quot;, and the &amp;quot;gamemodes&amp;quot; attribute must be a comma-separated list (no spaces) of gamemode resource names that the map works with.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!--map's meta.xml--&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;cowcatapult,assault,tdm&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have everything set up, admins will use these two commands to start/stop gamemodes:&lt;br /&gt;
/gamemode gamemodeName [mapName] (optional parameter allows picking an initial map, defaults to none)&lt;br /&gt;
/changemap mapName [gamemodeName] (optional parameter specifies the gamemode to start the map with, defaults to the current one)&lt;br /&gt;
&lt;br /&gt;
[[Map manager]] exports a few more access functions which you don't have to use, but may be useful.&lt;br /&gt;
&lt;br /&gt;
==What else should you do==&lt;br /&gt;
There are several other resources that gamemodes should use/be compliant with.&lt;br /&gt;
&lt;br /&gt;
===Helpmanager===&lt;br /&gt;
The helpmanager is ought to be the standard interface for players when they need help. If you use the helpmanager to display your gamemode's help, every player that used helpmanager before (e.g. in other gamemodes) will immediately know how to get there. It also displays help for different resources running resources in one window, if necessary.&lt;br /&gt;
&lt;br /&gt;
There are basicially two ways to use the helpmanager:&lt;br /&gt;
* Provide a simple text that explains how to use your gamemode&lt;br /&gt;
* Request a GUI element from the helpmanager that will be displayed in its own tab in the helpmanager window and lets you add any GUI elements to it. This is the recommended way for gamemodes that need to display more complex information that needs its own GUI.&lt;br /&gt;
&lt;br /&gt;
Read the helpmanager page for details on how to do it.&lt;br /&gt;
&lt;br /&gt;
===Scoreboard===&lt;br /&gt;
Scoreboard displays players and teams currently ingame. You add custom columns to it to provide map specific information. For example the column 'points' in the 'ctf' gamemode could represent the player's points gained through kills or captures. As usual, see the scoreboard help page for more information.&lt;br /&gt;
&lt;br /&gt;
===Map cycler===&lt;br /&gt;
The map cycler controls what gamemodes and maps are played on a server. You can specifiy for example how many times in a row a map will be played until it switches to the next. To achieve this, you need to tell the map cycler when your gamemode finished (e.g. when a round ends).&lt;br /&gt;
&lt;br /&gt;
[[it:Scrivere una gamemode]]&lt;br /&gt;
[[ru:Writing Gamemodes]]&lt;br /&gt;
[[de:Gamemodes schreiben]]&lt;/div&gt;</summary>
		<author><name>Gaetan Piette</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Page_d%27accueil&amp;diff=39230</id>
		<title>Page d'accueil</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Page_d%27accueil&amp;diff=39230"/>
		<updated>2014-04-04T09:10:48Z</updated>

		<summary type="html">&lt;p&gt;Gaetan Piette: /* Programmer */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;background: #FFEEAA; padding: 5px; float:right; width: 30%;&amp;quot;&amp;gt;Dernière version stable de '''Multi Theft Auto: San Andreas''' est '''{{Current Version|full}}'''. Rendez-vous sur la [http://mtasa.com/ page principale] pour la télécharger.&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Vous pouvez aussi télécharger une [http://nightly.mtasa.com/ beta] pour avoir la dernière version ( non stable ).&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
Bienvenue sur le wiki de Multi Theft Auto. Sur ce wiki, vous trouverez toutes les informations sur Multi Theft Auto.&lt;br /&gt;
&lt;br /&gt;
Il y a [[How you can help|différents moyens de nous aider]]: créer une map, un gamemode, rediger des articles sur des fonctions, écrire un exemple, écrire un tutorial ou juste jouer à MTA et nous rapportez les bugs trouvés.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;0&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;50%&amp;quot; style=&amp;quot;vertical-align:top;&amp;quot; |&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px dotted #AAAAAA;padding:4px 8px 8px 8px;margin:10px;&amp;quot;&amp;gt;&lt;br /&gt;
====Pour commencer====&lt;br /&gt;
&lt;br /&gt;
* [[FR/Manuel_Client|Manuel Client]] ( Traduction: [http://wiki.multitheftauto.com/wiki/User:DrawKiie DrawKiie] )&lt;br /&gt;
* [[FR/Manuel_Serveur|Manuel Serveur]] ( Traduction: [http://wiki.multitheftauto.com/wiki/User:Rouche Rouche] )&lt;br /&gt;
* [[FR/Problemes_connus|Problèmes connus]] ( Traduction: [http://wiki.multitheftauto.com/wiki/User:Rouche Rouche] )&lt;br /&gt;
* [[FR/Migrer_de_MTARace_a_MTASA_1.0.x|Migrer de MTA:Race à MTA:SA 1.0.x]] ( Traduction: [http://wiki.multitheftauto.com/wiki/User:Rouche Rouche] )&lt;br /&gt;
* [[FR/A propos des Map|A propos des Map]] ( Traduction: [http://wiki.multitheftauto.com/wiki/User:Rouche Rouche] )&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px dotted #AAAAAA;padding:4px 8px 8px 8px;margin:10px;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Programmer====&lt;br /&gt;
&lt;br /&gt;
* [[FR/Introduction_Programmation|Introduction: La programmation]]&lt;br /&gt;
* [[FR/Introduction_GUI|Introduction: Le GUI]] ( Traduction: [http://wiki.multitheftauto.com/wiki/User:FatalTeror FatalTerror] )&lt;br /&gt;
* [[FR/Debugage|Tutoriel: Le débugage]] - Comment trouver les erreurs dans son script (Traduction:[http://wiki.multitheftauto.com/wiki/User:Vincenzo Vincenzo] alias Vincentdu90)&lt;br /&gt;
* [[FR/Ressources|Introduction: Les ressources]] (Traduction : [http://wiki.multitheftauto.com/wiki/User:Myk3L Myk3L])&lt;br /&gt;
** [[FR/Ressource_Acces_Internet|Introduction: L'accès depuis internet]] - Comment créer un site à partir d'une ressource (Traduction : [http://wiki.multitheftauto.com/wiki/User:Myk3L Myk3L])&lt;br /&gt;
** [[:Category:Resource|Catalogue des ressources]] &lt;br /&gt;
** [[FR/Meta.xml|Meta.xml]] - Derière chaque ressource ce trouve une meta pour la définir&lt;br /&gt;
** [[FR/ACL|ACL]] - Access Control List, pour définir les autorisations&lt;br /&gt;
* [[FR/Ecrire_Gamemode|Créer un gamemode]] ( Traduction: [http://wiki.multitheftauto.com/wiki/User:Rouche Rouche] - En Cours )&lt;br /&gt;
* [[FR/Fonctions_Utiles|Fonctions Utiles]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px dotted #AAAAAA;padding:4px 8px 8px 8px;margin:10px;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Bases de données====&lt;br /&gt;
Cette section décrit toutes les capacités fournies par le LUA/MTA ou par les ressources.&lt;br /&gt;
* [[:Category:Resource|Catalogue des ressources]] - Vous devriez le lire pour réaliser un script approprié.&lt;br /&gt;
* [[FR/Les_scripts_clients| Les scripts clients]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px dotted #AAAAAA;padding:4px 8px 8px 8px;margin:10px;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Aide générale du LUA====&lt;br /&gt;
Des pages conçues pour aider votre compréhension du Lua&lt;br /&gt;
*[http://www.lua.org/pil/index.html &amp;quot;Programming in Lua&amp;quot;]&lt;br /&gt;
**[http://www.lua.org/manual/5.1/#index Les fonctions Lua]&lt;br /&gt;
*[http://lua-users.org/wiki/TutorialDirectory wiki Lua]&lt;br /&gt;
*[http://nixstaller.berlios.de/manual/0.2/nixstaller_9.html Un guide général au Lua de Nixstaller]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;50%&amp;quot; style=&amp;quot;vertical-align:top;&amp;quot; |&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px dotted #AAAAAA;padding:4px 8px 8px 8px;margin:10px;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Map Editor====&lt;br /&gt;
*[[Resource:Editor|Manuel]]&lt;br /&gt;
*[[Resource:Editor/EDF|Editor Definition Format]]&lt;br /&gt;
*[[Resource:Editor/Plugins|Plugins]]&lt;br /&gt;
*[[Resource:Editor#FAQ|Questions Fréquentes]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px dotted #AAAAAA;padding:4px 8px 8px 8px;margin:10px;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Développer Multi Theft Auto====&lt;br /&gt;
* [[FR/Compiler_MTASA|Compiler MTASA sur Windows]]&lt;br /&gt;
* [[FR/Compiler_MTASA_Server_sur_Mac_OS_X|Compiler MTASA sur Mac OS X]]&lt;br /&gt;
* [[FR/Compiler_MTASA_Server_sur_GNU_Linux|Compiler MTASA sur GNU/Linux]]&lt;br /&gt;
* [[FR/Directives_de_codage|Directives de codage]]&lt;br /&gt;
* [http://code.google.com/p/mtasa-blue Google Code SVN]&lt;br /&gt;
* [[FR/Roadmap|Roadmap]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px dotted #AAAAAA;padding:4px 8px 8px 8px;margin:10px; background:#CCCCFF;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Références====&lt;br /&gt;
* [[FR/Fonctions_Clients|Fonctions Clients]]&lt;br /&gt;
* [[FR/Events_Clients|Events Clients]]&lt;br /&gt;
* [[FR/Fonctions_Serveurs|Fonctions Clients]]&lt;br /&gt;
* [[FR/Events_Serveurs|Events Clients]]&lt;br /&gt;
&amp;lt;!-- Incomplet * [[Module functions|Server-side external module scripting functions list]] --&amp;gt;&lt;br /&gt;
* [[FR/MTA Classes|MTA Classes]] - Les descriptions détaillées de tous les types personnalisés MTA&lt;br /&gt;
** [[FR/Element|MTA Elements]] / [[Element tree]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px dotted #AAAAAA;padding:4px 8px 8px 8px;margin:10px;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====[[Id|ID Listes]]====&lt;br /&gt;
*[[FR/Animations|Animations]]&lt;br /&gt;
*[[FR/Skins_Personnages|Skins Personnages]]&lt;br /&gt;
*[[FR/Vetements_CJ|Vêtements CJ]]&lt;br /&gt;
*[[FR/Garage|Garage IDs]]&lt;br /&gt;
*[[FR/Interieurs_IDs|Intérieurs IDs]]&lt;br /&gt;
*[[FR/Materiel_IDs|Matériel IDs]]&lt;br /&gt;
*[[FR/Projectiles|Projectiles]]&lt;br /&gt;
*[[FR/Radar Blips|Radar Blips]]&lt;br /&gt;
*[[FR/Sons|Sons]]&lt;br /&gt;
*[[FR/Vehicule_IDs|ID des véhicules]]&lt;br /&gt;
*[[FR/Vehicule_Couleurs|Couleurs véhicules]]&lt;br /&gt;
*[[FR/Vehicule_Upgrades|Tuning IDs]]&lt;br /&gt;
*[[FR/Armes|Armes]]&lt;br /&gt;
*[[FR/Meteos|Météos]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |&lt;br /&gt;
|}&lt;br /&gt;
{{Languages list|fr}}&lt;/div&gt;</summary>
		<author><name>Gaetan Piette</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Page_d%27accueil&amp;diff=39229</id>
		<title>Page d'accueil</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Page_d%27accueil&amp;diff=39229"/>
		<updated>2014-04-04T09:10:35Z</updated>

		<summary type="html">&lt;p&gt;Gaetan Piette: /* Programmer */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;background: #FFEEAA; padding: 5px; float:right; width: 30%;&amp;quot;&amp;gt;Dernière version stable de '''Multi Theft Auto: San Andreas''' est '''{{Current Version|full}}'''. Rendez-vous sur la [http://mtasa.com/ page principale] pour la télécharger.&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Vous pouvez aussi télécharger une [http://nightly.mtasa.com/ beta] pour avoir la dernière version ( non stable ).&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
Bienvenue sur le wiki de Multi Theft Auto. Sur ce wiki, vous trouverez toutes les informations sur Multi Theft Auto.&lt;br /&gt;
&lt;br /&gt;
Il y a [[How you can help|différents moyens de nous aider]]: créer une map, un gamemode, rediger des articles sur des fonctions, écrire un exemple, écrire un tutorial ou juste jouer à MTA et nous rapportez les bugs trouvés.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;0&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;50%&amp;quot; style=&amp;quot;vertical-align:top;&amp;quot; |&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px dotted #AAAAAA;padding:4px 8px 8px 8px;margin:10px;&amp;quot;&amp;gt;&lt;br /&gt;
====Pour commencer====&lt;br /&gt;
&lt;br /&gt;
* [[FR/Manuel_Client|Manuel Client]] ( Traduction: [http://wiki.multitheftauto.com/wiki/User:DrawKiie DrawKiie] )&lt;br /&gt;
* [[FR/Manuel_Serveur|Manuel Serveur]] ( Traduction: [http://wiki.multitheftauto.com/wiki/User:Rouche Rouche] )&lt;br /&gt;
* [[FR/Problemes_connus|Problèmes connus]] ( Traduction: [http://wiki.multitheftauto.com/wiki/User:Rouche Rouche] )&lt;br /&gt;
* [[FR/Migrer_de_MTARace_a_MTASA_1.0.x|Migrer de MTA:Race à MTA:SA 1.0.x]] ( Traduction: [http://wiki.multitheftauto.com/wiki/User:Rouche Rouche] )&lt;br /&gt;
* [[FR/A propos des Map|A propos des Map]] ( Traduction: [http://wiki.multitheftauto.com/wiki/User:Rouche Rouche] )&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px dotted #AAAAAA;padding:4px 8px 8px 8px;margin:10px;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Programmer====&lt;br /&gt;
&lt;br /&gt;
* [[FR/Introduction_Programmation|Introduction: La programmation]]&lt;br /&gt;
* [[FR/Introduction_GUI|Introduction: Le GUI]] ( Traduction: [http://wiki.multitheftauto.com/wiki/User:FatalTeror FatalTerror] )&lt;br /&gt;
* [[FR/Debugage|Tutoriel: Le débugage]] - Comment trouver les erreurs dans son script (Traduction:[http://wiki.multitheftauto.com/wiki/User:Vincenzo Vincenzo] alias Vincentdu90)&lt;br /&gt;
* [[FR/Ressources|Introduction: Les ressources]] (Traduction : [http://wiki.multitheftauto.com/wiki/User:Myk3L Myk3L])&lt;br /&gt;
** [[FR/Ressource_Acces_Internet|Introduction: L'accès depuis internet]] - Comment créer un site à partir d'une ressource (Traduction : [http://wiki.multitheftauto.com/wiki/User:Myk3L Myk3L])&lt;br /&gt;
** [[:Category:Resource|Catalogue des ressources]] &lt;br /&gt;
** [[FR/Meta.xml|Meta.xml]] - Derière chaque ressource ce trouve une meta pour la définir&lt;br /&gt;
** [[FR/ACL|ACL]] - Access Control List, pour définir les autorisations&lt;br /&gt;
* [[FR/Ecrire_Gamemode|Créer un gamemode]] ( Traduction: [http://wiki.multitheftauto.com/wiki/User:Rouche Rouche] )&lt;br /&gt;
* [[FR/Fonctions_Utiles|Fonctions Utiles]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px dotted #AAAAAA;padding:4px 8px 8px 8px;margin:10px;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Bases de données====&lt;br /&gt;
Cette section décrit toutes les capacités fournies par le LUA/MTA ou par les ressources.&lt;br /&gt;
* [[:Category:Resource|Catalogue des ressources]] - Vous devriez le lire pour réaliser un script approprié.&lt;br /&gt;
* [[FR/Les_scripts_clients| Les scripts clients]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px dotted #AAAAAA;padding:4px 8px 8px 8px;margin:10px;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Aide générale du LUA====&lt;br /&gt;
Des pages conçues pour aider votre compréhension du Lua&lt;br /&gt;
*[http://www.lua.org/pil/index.html &amp;quot;Programming in Lua&amp;quot;]&lt;br /&gt;
**[http://www.lua.org/manual/5.1/#index Les fonctions Lua]&lt;br /&gt;
*[http://lua-users.org/wiki/TutorialDirectory wiki Lua]&lt;br /&gt;
*[http://nixstaller.berlios.de/manual/0.2/nixstaller_9.html Un guide général au Lua de Nixstaller]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;50%&amp;quot; style=&amp;quot;vertical-align:top;&amp;quot; |&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px dotted #AAAAAA;padding:4px 8px 8px 8px;margin:10px;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Map Editor====&lt;br /&gt;
*[[Resource:Editor|Manuel]]&lt;br /&gt;
*[[Resource:Editor/EDF|Editor Definition Format]]&lt;br /&gt;
*[[Resource:Editor/Plugins|Plugins]]&lt;br /&gt;
*[[Resource:Editor#FAQ|Questions Fréquentes]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px dotted #AAAAAA;padding:4px 8px 8px 8px;margin:10px;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Développer Multi Theft Auto====&lt;br /&gt;
* [[FR/Compiler_MTASA|Compiler MTASA sur Windows]]&lt;br /&gt;
* [[FR/Compiler_MTASA_Server_sur_Mac_OS_X|Compiler MTASA sur Mac OS X]]&lt;br /&gt;
* [[FR/Compiler_MTASA_Server_sur_GNU_Linux|Compiler MTASA sur GNU/Linux]]&lt;br /&gt;
* [[FR/Directives_de_codage|Directives de codage]]&lt;br /&gt;
* [http://code.google.com/p/mtasa-blue Google Code SVN]&lt;br /&gt;
* [[FR/Roadmap|Roadmap]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px dotted #AAAAAA;padding:4px 8px 8px 8px;margin:10px; background:#CCCCFF;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Références====&lt;br /&gt;
* [[FR/Fonctions_Clients|Fonctions Clients]]&lt;br /&gt;
* [[FR/Events_Clients|Events Clients]]&lt;br /&gt;
* [[FR/Fonctions_Serveurs|Fonctions Clients]]&lt;br /&gt;
* [[FR/Events_Serveurs|Events Clients]]&lt;br /&gt;
&amp;lt;!-- Incomplet * [[Module functions|Server-side external module scripting functions list]] --&amp;gt;&lt;br /&gt;
* [[FR/MTA Classes|MTA Classes]] - Les descriptions détaillées de tous les types personnalisés MTA&lt;br /&gt;
** [[FR/Element|MTA Elements]] / [[Element tree]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px dotted #AAAAAA;padding:4px 8px 8px 8px;margin:10px;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====[[Id|ID Listes]]====&lt;br /&gt;
*[[FR/Animations|Animations]]&lt;br /&gt;
*[[FR/Skins_Personnages|Skins Personnages]]&lt;br /&gt;
*[[FR/Vetements_CJ|Vêtements CJ]]&lt;br /&gt;
*[[FR/Garage|Garage IDs]]&lt;br /&gt;
*[[FR/Interieurs_IDs|Intérieurs IDs]]&lt;br /&gt;
*[[FR/Materiel_IDs|Matériel IDs]]&lt;br /&gt;
*[[FR/Projectiles|Projectiles]]&lt;br /&gt;
*[[FR/Radar Blips|Radar Blips]]&lt;br /&gt;
*[[FR/Sons|Sons]]&lt;br /&gt;
*[[FR/Vehicule_IDs|ID des véhicules]]&lt;br /&gt;
*[[FR/Vehicule_Couleurs|Couleurs véhicules]]&lt;br /&gt;
*[[FR/Vehicule_Upgrades|Tuning IDs]]&lt;br /&gt;
*[[FR/Armes|Armes]]&lt;br /&gt;
*[[FR/Meteos|Météos]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |&lt;br /&gt;
|}&lt;br /&gt;
{{Languages list|fr}}&lt;/div&gt;</summary>
		<author><name>Gaetan Piette</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Cr%C3%A9er_un_mode_de_jeu&amp;diff=39228</id>
		<title>Créer un mode de jeu</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Cr%C3%A9er_un_mode_de_jeu&amp;diff=39228"/>
		<updated>2014-04-04T09:09:25Z</updated>

		<summary type="html">&lt;p&gt;Gaetan Piette: Created page with &amp;quot;This guide tries to outline the process of how to write a proper gamemode. If you just started with scripting for MTA, you may want to check the other scripting tutorials at the ...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This guide tries to outline the process of how to write a proper gamemode. If you just started with scripting for MTA, you may want to check the other scripting tutorials at the [[Main Page]] first.&lt;br /&gt;
==Introduction==&lt;br /&gt;
A gamemode is a resource that, once started, controls all of the gameplay. This may include telling the players what to do, spawning players, creating teams, defining what the players have to do to win or to get points and much more. Examples are Race and Deathmatch. &lt;br /&gt;
&lt;br /&gt;
==What does &amp;quot;proper gamemode&amp;quot; mean?==&lt;br /&gt;
To put it simply, a proper gamemode is one that makes full use of MTA's .map file system. This means that the gamemode code does not have any map-specific data hardcoded in it, like positions of players or cars. Instead, the gamemode should be able to load .map files which define these data. This way the gamemode can have multiple maps; also, people can create .map files for the gamemode with MTA's map editor, which is much more convenient than writing code.&lt;br /&gt;
&lt;br /&gt;
An obvious example of a &amp;quot;proper gamemode&amp;quot; is MTA:Race. It allows usermade maps with lots of possibilities within the .map file. To alter spawnpoints, objects etc., the user doesn't need to edit the gamemode itself.&lt;br /&gt;
&lt;br /&gt;
===Map Files===&lt;br /&gt;
Map files are basically XML documents with a .map extension. They define an environment to play one or more specific gamemodes in. They are however not supposed to change the rules of the game - those are defined by the gamemode.&lt;br /&gt;
&lt;br /&gt;
Each element in a map corresponds to a node in the .map file. There is standard syntax for common things like spawnpoints, objects and vehicles; however, for &amp;quot;special&amp;quot;, gamemode specific information, you need to invent your own syntax.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
Let's take a Capture the Flag gamemode as an example. A map for this gamemode needs to mainly define spawnpoints and flag locations, and eventually objects and vehicles. A simplified map file could look like this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;map&amp;gt;&lt;br /&gt;
    &amp;lt;spawnpoint id=&amp;quot;spawnpoint1&amp;quot; posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;877.25219726563&amp;quot; rot=&amp;quot;63.350006103516&amp;quot; model=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;pickup id=&amp;quot;Armor 1&amp;quot; posX=&amp;quot;1911.083984375&amp;quot; posY=&amp;quot;-1658.8798828125&amp;quot; posZ=&amp;quot;885.40216064453&amp;quot; type=&amp;quot;armor&amp;quot; health=&amp;quot;50&amp;quot; respawn=&amp;quot;60000&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;flag posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;877.25219726563&amp;quot; team=&amp;quot;blue&amp;quot; /&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you can see two MTA elements - a spawnpoint and a pickup. More importantly, this .map has a custom &amp;quot;flag&amp;quot; node which defines the position and color of the flag. The spawnpoint and pickup can be handled by existing external resources, custom elements have to be processed by the gamemode.&lt;br /&gt;
&lt;br /&gt;
To summarize - we want mass mapper input as we saw in MTA:Race. Users should NOT have to touch the gamemode script itself at all.&lt;br /&gt;
&lt;br /&gt;
====Example of getting the .map information====&lt;br /&gt;
As mentioned above, your gamemode needs de retrieve custom elements that are defined in a map file and process them. This is quite easy as demonstrated below.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- retrieve a table with all flag elements&lt;br /&gt;
local flagElements = getElementsByType ( &amp;quot;flag&amp;quot; )&lt;br /&gt;
-- loop through them&lt;br /&gt;
for key, value in pairs(flagElements) do&lt;br /&gt;
	-- get our info&lt;br /&gt;
	local posX = getElementData ( value, &amp;quot;posX&amp;quot; )&lt;br /&gt;
	local posY = getElementData ( value, &amp;quot;posY&amp;quot; )&lt;br /&gt;
	local posZ = getElementData ( value, &amp;quot;posZ&amp;quot; )&lt;br /&gt;
	local team = getElementData ( value, &amp;quot;team&amp;quot; )&lt;br /&gt;
	-- create an object according to the flag position&lt;br /&gt;
	createObject ( 1337, posX, posY, posZ )&lt;br /&gt;
	-- output the team that we created a base for&lt;br /&gt;
	outputChatBox ( &amp;quot;Base for team &amp;quot; .. team .. &amp;quot; created&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The [[getElementsByType]] function retrieves a table of all the elements of a certain type (the type corresponds to the node name in the .map file). This works for both custom types and built-in MTA types (like &amp;quot;vehicle&amp;quot; or &amp;quot;player&amp;quot;).&lt;br /&gt;
[[getElementData]] can be used to retrieve the xml attributes set in the .map file.&lt;br /&gt;
In this simple example, an object is created at the flag's location and a message is outputted in the chatbox. In reality, you will of course need to do more during map loading, like in this case setting up collision shapes to detect players taking the flag.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Map manager==&lt;br /&gt;
Having read the section above it should be clear that a gamemode should always consist of two parts:&lt;br /&gt;
* The gamemode resource that always stays the same&lt;br /&gt;
* Many different maps resources that give the gamemode map-specific information&lt;br /&gt;
&lt;br /&gt;
Now instead of writing a map-loader for every single gamemode, the [[Map manager]] provides functions to load gamemodes and maps. Simply put, when you enter the correct command (for example 'gamemode ctf ctf-italy') it will start both resources 'ctf' and 'ctf-italy' while triggering an event ([[onGamemodeMapStart]]) to tell the 'ctf' resource that a map was loaded. The 'ctf' resource can then access the information 'ctf-italy' contains and start spawning players etc.&lt;br /&gt;
&lt;br /&gt;
===How to use the mapmanager===&lt;br /&gt;
To use the mapmanager service, your gamemode resource has to be tagged as such first. More specifically you'll be setting the &amp;quot;type&amp;quot; attribute of its &amp;lt;info&amp;gt; tag to &amp;quot;gamemode&amp;quot; inside meta.xml. Also, you can set the &amp;quot;name&amp;quot; attribute to a friendly name (like &amp;quot;Capture the flag&amp;quot;) that will be shown on ASE instead of the resource name.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- meta.xml in &amp;quot;cowcatapult&amp;quot; gamemode --&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info type=&amp;quot;gamemode&amp;quot; name=&amp;quot;Cow catapulting 2.0&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If your gamemode is going to load custom maps, you should add handlers for&lt;br /&gt;
* onGamemodeMapStart&lt;br /&gt;
* onGamemodeMapStop (if any unloading is necessary)&lt;br /&gt;
These are fired when a map for your gamemode is started or stopped, and pass the map resource as a parameter.&lt;br /&gt;
Within the handler function for these events you can extract all info you need from the resource's map files and configuration files.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function startCtfMap( startedMap ) -- startedMap contains a reference to the resource of the map&lt;br /&gt;
    local mapRoot = getResourceRootElement( startedMap )        -- get the root node of the started map&lt;br /&gt;
    local flagElements = getElementsByType ( &amp;quot;flag&amp;quot; , mapRoot ) -- get all flags in the map and store them in a table&lt;br /&gt;
    -- go on loading information like in the example above&lt;br /&gt;
    -- spawn players etc.&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onGamemodeMapStart&amp;quot;, getRootElement(), startCtfMap)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Making maps compatible===&lt;br /&gt;
Maps are separate resources. This is done so no editing of the gamemode resource is ever necessary in order to create a custom map, and also allows you to pack map-specific scripts/config files with them.&lt;br /&gt;
&lt;br /&gt;
To make a map compatible with your gamemode, open its resource's meta.xml and tag it as well: the &amp;quot;type&amp;quot; attribute must be set to &amp;quot;map&amp;quot;, and the &amp;quot;gamemodes&amp;quot; attribute must be a comma-separated list (no spaces) of gamemode resource names that the map works with.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!--map's meta.xml--&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;cowcatapult,assault,tdm&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have everything set up, admins will use these two commands to start/stop gamemodes:&lt;br /&gt;
/gamemode gamemodeName [mapName] (optional parameter allows picking an initial map, defaults to none)&lt;br /&gt;
/changemap mapName [gamemodeName] (optional parameter specifies the gamemode to start the map with, defaults to the current one)&lt;br /&gt;
&lt;br /&gt;
[[Map manager]] exports a few more access functions which you don't have to use, but may be useful.&lt;br /&gt;
&lt;br /&gt;
==What else should you do==&lt;br /&gt;
There are several other resources that gamemodes should use/be compliant with.&lt;br /&gt;
&lt;br /&gt;
===Helpmanager===&lt;br /&gt;
The helpmanager is ought to be the standard interface for players when they need help. If you use the helpmanager to display your gamemode's help, every player that used helpmanager before (e.g. in other gamemodes) will immediately know how to get there. It also displays help for different resources running resources in one window, if necessary.&lt;br /&gt;
&lt;br /&gt;
There are basicially two ways to use the helpmanager:&lt;br /&gt;
* Provide a simple text that explains how to use your gamemode&lt;br /&gt;
* Request a GUI element from the helpmanager that will be displayed in its own tab in the helpmanager window and lets you add any GUI elements to it. This is the recommended way for gamemodes that need to display more complex information that needs its own GUI.&lt;br /&gt;
&lt;br /&gt;
Read the helpmanager page for details on how to do it.&lt;br /&gt;
&lt;br /&gt;
===Scoreboard===&lt;br /&gt;
Scoreboard displays players and teams currently ingame. You add custom columns to it to provide map specific information. For example the column 'points' in the 'ctf' gamemode could represent the player's points gained through kills or captures. As usual, see the scoreboard help page for more information.&lt;br /&gt;
&lt;br /&gt;
===Map cycler===&lt;br /&gt;
The map cycler controls what gamemodes and maps are played on a server. You can specifiy for example how many times in a row a map will be played until it switches to the next. To achieve this, you need to tell the map cycler when your gamemode finished (e.g. when a round ends).&lt;br /&gt;
&lt;br /&gt;
[[it:Scrivere una gamemode]]&lt;br /&gt;
[[ru:Writing Gamemodes]]&lt;br /&gt;
[[de:Gamemodes schreiben]]&lt;/div&gt;</summary>
		<author><name>Gaetan Piette</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Page_d%27accueil&amp;diff=39226</id>
		<title>Page d'accueil</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Page_d%27accueil&amp;diff=39226"/>
		<updated>2014-04-03T14:30:44Z</updated>

		<summary type="html">&lt;p&gt;Gaetan Piette: /* Programmer */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;background: #FFEEAA; padding: 5px; float:right; width: 30%;&amp;quot;&amp;gt;Dernière version stable de '''Multi Theft Auto: San Andreas''' est '''{{Current Version|full}}'''. Rendez-vous sur la [http://mtasa.com/ page principale] pour la télécharger.&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Vous pouvez aussi télécharger une [http://nightly.mtasa.com/ beta] pour avoir la dernière version ( non stable ).&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
Bienvenue sur le wiki de Multi Theft Auto. Sur ce wiki, vous trouverez toutes les informations sur Multi Theft Auto.&lt;br /&gt;
&lt;br /&gt;
Il y a [[How you can help|différents moyens de nous aider]]: créer une map, un gamemode, rediger des articles sur des fonctions, écrire un exemple, écrire un tutorial ou juste jouer à MTA et nous rapportez les bugs trouvés.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;0&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;50%&amp;quot; style=&amp;quot;vertical-align:top;&amp;quot; |&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px dotted #AAAAAA;padding:4px 8px 8px 8px;margin:10px;&amp;quot;&amp;gt;&lt;br /&gt;
====Pour commencer====&lt;br /&gt;
&lt;br /&gt;
* [[FR/Manuel_Client|Manuel Client]] ( Traduction: [http://wiki.multitheftauto.com/wiki/User:DrawKiie DrawKiie] )&lt;br /&gt;
* [[FR/Manuel_Serveur|Manuel Serveur]] ( Traduction: [http://wiki.multitheftauto.com/wiki/User:Rouche Rouche] )&lt;br /&gt;
* [[FR/Problemes_connus|Problèmes connus]] ( Traduction: [http://wiki.multitheftauto.com/wiki/User:Rouche Rouche] )&lt;br /&gt;
* [[FR/Migrer_de_MTARace_a_MTASA_1.0.x|Migrer de MTA:Race à MTA:SA 1.0.x]] ( Traduction: [http://wiki.multitheftauto.com/wiki/User:Rouche Rouche] )&lt;br /&gt;
* [[FR/A propos des Map|A propos des Map]] ( Traduction: [http://wiki.multitheftauto.com/wiki/User:Rouche Rouche] )&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px dotted #AAAAAA;padding:4px 8px 8px 8px;margin:10px;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Programmer====&lt;br /&gt;
&lt;br /&gt;
* [[FR/Introduction_Programmation|Introduction: La programmation]] ( Traduction: [http://wiki.multitheftauto.com/wiki/User:Rouche Rouche] )&lt;br /&gt;
* [[FR/Introduction_GUI|Introduction: Le GUI]] ( Traduction: [http://wiki.multitheftauto.com/wiki/User:FatalTeror FatalTerror] )&lt;br /&gt;
* [[FR/Debugage|Tutoriel: Le débugage]] - Comment trouver les erreurs dans son script (Traduction:[http://wiki.multitheftauto.com/wiki/User:Vincenzo Vincenzo] alias Vincentdu90)&lt;br /&gt;
* [[FR/Ressources|Introduction: Les ressources]] (Traduction : [http://wiki.multitheftauto.com/wiki/User:Myk3L Myk3L])&lt;br /&gt;
** [[FR/Ressource_Acces_Internet|Introduction: L'accès depuis internet]] - Comment créer un site à partir d'une ressource (Traduction : [http://wiki.multitheftauto.com/wiki/User:Myk3L Myk3L])&lt;br /&gt;
** [[:Category:Resource|Catalogue des ressources]] &lt;br /&gt;
** [[FR/Meta.xml|Meta.xml]] - Derière chaque ressource ce trouve une meta pour la définir&lt;br /&gt;
** [[FR/ACL|ACL]] - Access Control List, pour définir les autorisations&lt;br /&gt;
* [[FR/Ecrire_Gamemode|Créer un gamemode]]&lt;br /&gt;
* [[FR/Fonctions_Utiles|Fonctions Utiles]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px dotted #AAAAAA;padding:4px 8px 8px 8px;margin:10px;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Bases de données====&lt;br /&gt;
Cette section décrit toutes les capacités fournies par le LUA/MTA ou par les ressources.&lt;br /&gt;
* [[:Category:Resource|Catalogue des ressources]] - Vous devriez le lire pour réaliser un script approprié.&lt;br /&gt;
* [[FR/Les_scripts_clients| Les scripts clients]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px dotted #AAAAAA;padding:4px 8px 8px 8px;margin:10px;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Aide générale du LUA====&lt;br /&gt;
Des pages conçues pour aider votre compréhension du Lua&lt;br /&gt;
*[http://www.lua.org/pil/index.html &amp;quot;Programming in Lua&amp;quot;]&lt;br /&gt;
**[http://www.lua.org/manual/5.1/#index Les fonctions Lua]&lt;br /&gt;
*[http://lua-users.org/wiki/TutorialDirectory wiki Lua]&lt;br /&gt;
*[http://nixstaller.berlios.de/manual/0.2/nixstaller_9.html Un guide général au Lua de Nixstaller]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;50%&amp;quot; style=&amp;quot;vertical-align:top;&amp;quot; |&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px dotted #AAAAAA;padding:4px 8px 8px 8px;margin:10px;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Map Editor====&lt;br /&gt;
*[[Resource:Editor|Manuel]]&lt;br /&gt;
*[[Resource:Editor/EDF|Editor Definition Format]]&lt;br /&gt;
*[[Resource:Editor/Plugins|Plugins]]&lt;br /&gt;
*[[Resource:Editor#FAQ|Questions Fréquentes]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px dotted #AAAAAA;padding:4px 8px 8px 8px;margin:10px;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Développer Multi Theft Auto====&lt;br /&gt;
* [[FR/Compiler_MTASA|Compiler MTASA sur Windows]]&lt;br /&gt;
* [[FR/Compiler_MTASA_Server_sur_Mac_OS_X|Compiler MTASA sur Mac OS X]]&lt;br /&gt;
* [[FR/Compiler_MTASA_Server_sur_GNU_Linux|Compiler MTASA sur GNU/Linux]]&lt;br /&gt;
* [[FR/Directives_de_codage|Directives de codage]]&lt;br /&gt;
* [http://code.google.com/p/mtasa-blue Google Code SVN]&lt;br /&gt;
* [[FR/Roadmap|Roadmap]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px dotted #AAAAAA;padding:4px 8px 8px 8px;margin:10px; background:#CCCCFF;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Références====&lt;br /&gt;
* [[FR/Fonctions_Clients|Fonctions Clients]]&lt;br /&gt;
* [[FR/Events_Clients|Events Clients]]&lt;br /&gt;
* [[FR/Fonctions_Serveurs|Fonctions Clients]]&lt;br /&gt;
* [[FR/Events_Serveurs|Events Clients]]&lt;br /&gt;
&amp;lt;!-- Incomplet * [[Module functions|Server-side external module scripting functions list]] --&amp;gt;&lt;br /&gt;
* [[FR/MTA Classes|MTA Classes]] - Les descriptions détaillées de tous les types personnalisés MTA&lt;br /&gt;
** [[FR/Element|MTA Elements]] / [[Element tree]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px dotted #AAAAAA;padding:4px 8px 8px 8px;margin:10px;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====[[Id|ID Listes]]====&lt;br /&gt;
*[[FR/Animations|Animations]]&lt;br /&gt;
*[[FR/Skins_Personnages|Skins Personnages]]&lt;br /&gt;
*[[FR/Vetements_CJ|Vêtements CJ]]&lt;br /&gt;
*[[FR/Garage|Garage IDs]]&lt;br /&gt;
*[[FR/Interieurs_IDs|Intérieurs IDs]]&lt;br /&gt;
*[[FR/Materiel_IDs|Matériel IDs]]&lt;br /&gt;
*[[FR/Projectiles|Projectiles]]&lt;br /&gt;
*[[FR/Radar Blips|Radar Blips]]&lt;br /&gt;
*[[FR/Sons|Sons]]&lt;br /&gt;
*[[FR/Vehicule_IDs|ID des véhicules]]&lt;br /&gt;
*[[FR/Vehicule_Couleurs|Couleurs véhicules]]&lt;br /&gt;
*[[FR/Vehicule_Upgrades|Tuning IDs]]&lt;br /&gt;
*[[FR/Armes|Armes]]&lt;br /&gt;
*[[FR/Meteos|Météos]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |&lt;br /&gt;
|}&lt;br /&gt;
{{Languages list|fr}}&lt;/div&gt;</summary>
		<author><name>Gaetan Piette</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=FR/A_propos_des_Map&amp;diff=39225</id>
		<title>FR/A propos des Map</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=FR/A_propos_des_Map&amp;diff=39225"/>
		<updated>2014-04-03T14:27:37Z</updated>

		<summary type="html">&lt;p&gt;Gaetan Piette: /* Paramètres d'une Map */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Needs Checking|Either complete the translation or remove it.}}&lt;br /&gt;
Le &amp;quot;Map manager&amp;quot; est une ressource inclue dans la suite serveur de MTA DM. Elle offre des commandes, fonctions et événements pour les modes de jeu afin de dynamiser vos maps. Par exemple, quand un serveur doit charger plusieurs routes pour plusieurs maps, au lieu d'avoir le tout dans un seul script principal, ces routes peuvent êtres stockée dans plusieurs ressources et chargée simplement grâce à la fonction &amp;quot;changeGamemodeMap&amp;quot; quand une map démarre.&lt;br /&gt;
&lt;br /&gt;
Plus spécifiquement, le &amp;quot;Map manager&amp;quot; liste les modes de jeux et maps chargés sur le serveur. Il inclut un listing sur l'interface web, il rafraîchit cette liste fréquemment et met en gras les ressources et/ou maps actuellement entrain d'être utilisées. &lt;br /&gt;
&lt;br /&gt;
== Un Simple Tutoriel ==&lt;br /&gt;
Dans cette section nous allons poursuivre le travail commencé dans [[FR/Introduction_Programmation|Introduction to Scripting]]. Nous allons ajouter une ressource qui enregistre l'endroit de spawn des joueurs sur la map, le chargement de ce script se fera depuis le script principal.&lt;br /&gt;
&lt;br /&gt;
Premièrement, créez un dossier dans /Your MTA Server/mods/deathmatch/resources/, nommez-le &amp;quot;mymap&amp;quot;. Ensuite dans ce dossier, créez un fichier texte et nommez-le &amp;quot;meta.xml&amp;quot;, ce fichier est présent dans chaque scripts.&lt;br /&gt;
&lt;br /&gt;
Ecrivez les lignes suivantes dans le fichier ''meta.xml'' :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
   &amp;lt;info type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;myserver&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;map src=&amp;quot;mymap.map&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Prenez garde car ce fichier est &amp;quot;lié&amp;quot; avec le ''gamemodes=&amp;quot;&amp;quot;'' choisit, qui contient le nom de la ressource principale qu'utilise ce mode. le paramètre ''map'', indique le nom de la map qui sera afficher sur le serveur.&lt;br /&gt;
&lt;br /&gt;
Maintenant créez un nouveau fichier texte dans /mymap/ et nommez le &amp;quot;mymap.map&amp;quot;, écrivez y les lignes suivantes:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;map&amp;gt;&lt;br /&gt;
   &amp;lt;spawnpoint id=&amp;quot;spawnpoint1&amp;quot; posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;18&amp;quot; rot=&amp;quot;63.350006103516&amp;quot; model=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Notez que &amp;quot;spawnpoint&amp;quot; est le type de l'élément utilisé dans la fonction [[getElementsByType]], &amp;quot;id&amp;quot; est utilisée dans la fonction [[getElementByID]]&lt;br /&gt;
&lt;br /&gt;
Pour charger la map, le script principal doit pouvoir accéder aux maps par lui même. Quelques modifications sont à apportées dans script.lua situé dans &amp;quot;myserver&amp;quot;. Entrez les lignes suivantes :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function loadMap(startedMap)&lt;br /&gt;
	mapRoot = getResourceRootElement(startedMap)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEventHandler(&amp;quot;onGamemodeMapStart&amp;quot;, getRootElement(), loadMap)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Par défaut, l'evênement &amp;quot;onGamemodeMapStart&amp;quot; nous donne le &amp;quot;handle&amp;quot;(?) de la map (&amp;quot;startedMap&amp;quot;), lequel nous avons utilisé pour le &amp;quot;handle&amp;quot;(?) de la ressource contenant la map (&amp;quot;mapRoot&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
Avec la ressource &amp;quot;handle&amp;quot;(?), nous pouvons extraire les informations relatives au spawnpoint. Jetez un œil à la fonction joinHandler() dans script.lua, à la place de x, y and z, nous pouvons utiliser les informations de la map comme suit :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function joinHandler()&lt;br /&gt;
	local spawn = getElementsByType(&amp;quot;spawnpoint&amp;quot;, mapRoot)&lt;br /&gt;
	local x,y,z,r&lt;br /&gt;
	for key, value in pairs(spawn) do&lt;br /&gt;
		x = getElementData(value, &amp;quot;posX&amp;quot;)&lt;br /&gt;
		y = getElementData(value, &amp;quot;posY&amp;quot;)&lt;br /&gt;
		z = getElementData(value, &amp;quot;posZ&amp;quot;)&lt;br /&gt;
		r = getElementData(value, &amp;quot;rot&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
	spawnPlayer(source, x, y, z)&lt;br /&gt;
	fadeCamera(source, true)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancez maintenant votre gamemode avec la commande suivante via la console:&lt;br /&gt;
&lt;br /&gt;
'''gamemode myserver mymap'''&lt;br /&gt;
&lt;br /&gt;
==Usage==&lt;br /&gt;
Pour utiliser le map manager, vos ressources doivent d'abord être reconnues en tant que gamemodes ou maps.&lt;br /&gt;
&lt;br /&gt;
Vous devez remplir quelques informations pour votre fichier de configuration du '''gamemode resource''' :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;info description=&amp;quot;Votre Gamemode&amp;quot; type=&amp;quot;gamemode&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Map resources''' Les maps ont aussi besoin d'information dans le meta.xml, ''type=&amp;quot;map&amp;quot;'' et un ou plusieurs ''gamemodes''. Une map peut en effet être compatible avec plusieurs mode de jeu pour se faire il faudra séparer les modes par une virgule ''sans espaces''.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;info description=&amp;quot;A gamemode map&amp;quot; type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;ctv,koth&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Il ne peut y avoir qu’un mode de jeu 'Gamemode' Actif ou une map chargée à la fois.&lt;br /&gt;
&lt;br /&gt;
==Paramètres Supplémentaires==&lt;br /&gt;
Ces paramètres sont aussi à ajouter dans meta.xml.&lt;br /&gt;
&lt;br /&gt;
'''name:''' Entrez ici un message sympa qui sera afficher lors du démarrage de la ressource. C'est en quelques sorte un alias au cas ou le nom de votre ressource ne vous correspond pas.&lt;br /&gt;
&lt;br /&gt;
==Commandes==&lt;br /&gt;
'''changemap newmap [newgamemode]''' (changer le 'Gamemode' d'une map)&lt;br /&gt;
&lt;br /&gt;
'''changemode newgamemode [newmap]''' (lancer un mode de jeu 'Gamemode' et démarrez une map)&lt;br /&gt;
&lt;br /&gt;
'''gamemode newgamemode [newmap]''' (idem que la précédente)&lt;br /&gt;
&lt;br /&gt;
'''stopmode''' (Arrête le mode de jeu et la map en cours)&lt;br /&gt;
&lt;br /&gt;
'''stopmap''' (Arrête la map en cours)&lt;br /&gt;
&lt;br /&gt;
'''maps [gamemode]''' (liste toutes les maps sur le serveurs, ajoutez en option le mode pour lequel vous voulez connaître les maps)&lt;br /&gt;
&lt;br /&gt;
'''gamemodes''' (Liste tout les mode de jeu)&lt;br /&gt;
&lt;br /&gt;
==Paramètres==&lt;br /&gt;
'''*mapmanager.color''' [hex color string] (change la couleur de sortie des message du mapmanager) (Par défaut : #E1AA5A)&lt;br /&gt;
&lt;br /&gt;
'''*mapmanager.messages''' [boolean] (si les changements de map/gm sont activés) (Par défaut : true)&lt;br /&gt;
&lt;br /&gt;
'''*mapmanager.ASE''' [boolean] (si le manager doit charger en mode ASE) (Par défaut : true)&lt;br /&gt;
&lt;br /&gt;
==Autres fonctions==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool changeGamemode ( resource newGamemode, [ resource mapToLoadWith ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Changement de mode de jeu, on peut aussi lui donner une map initial à charger.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool changeGamemodeMap ( resource newMap, [ resource gamemodeToChangeTo ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Change le mode de jeu d'une map pour un nouveau, on peut choisir un mode de jeu à charger une fois cette map rechargée.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;table getGamemodes ( )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Renvoie une table des tout les modes de jeu et leur pointeurs.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;table getGamemodesCompatibleWithMap ( resource theMap )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Retourne une table de tout les modes de jeu compatibles.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;table getMaps ( )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Reourne une table de toutes les ressources en rapport avec la map.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;table getMapsCompatibleWithGamemode ( [ resource theGamemode ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Retourne une table de tout les modes de jeu compatibles. Si l'argument &amp;quot;theGamemode&amp;quot; est inexistant, ça retourne toutes les maps qui n'ont aucun mode de jeu compatible..&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;resource getRunningGamemode ( )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Renvoie le mode de jeu actif.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;resource getRunningGamemodeMap ( )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Renvoie le mode de jeu de la map en cours.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool isGamemode ( resource theGamemode )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Déterminie si une ressources est un mode de jeu ou pas.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool isGamemodeCompatibleWithMap ( resource theGamemode, resource theMap )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Déterminie si une map est compatible avec un mode de jeu ou pas.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool isMap ( resource theMap )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Détermine si ressources est une map ou pas.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool isMapCompatibleWithGamemode ( resource theMap, resource theGamemode )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Déterminie si une map est compatible avec un gamemode ou pas.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool stopGamemode ( )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Arrêter le mode de jeux actif ainsi que la map chargée.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool stopGamemodeMap ( )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Arrêter la map active.&lt;br /&gt;
&lt;br /&gt;
==Evênement Appelés==&lt;br /&gt;
''(Pour tous ces évênements, &amp;quot;source&amp;quot; est la ressource racine des élément.)''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;onGamemodeStart ( resource startedGamemode )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Appelé lors du démarrage d'un mode de jeu.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;onGamemodeStop ( resource stoppedGamemode )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Appelé quand on arrête un mode de jeu.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;onGamemodeMapStart ( resource startedMap )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Appelé quand la map d'un mode de jeu démarre.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;onGamemodeMapStop ( resource stoppedMap )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Appelé quand la map de mode de jeu est stoppée.&lt;br /&gt;
&lt;br /&gt;
==Paramètres d'une Map==&lt;br /&gt;
Les paramètres suivants [[settings system|registry]] sont appliqué par le &amp;quot;Map Manager&amp;quot; quand une map est démarée :&lt;br /&gt;
&amp;lt;br&amp;gt;'''gamespeed''' [number]: la vitesse du jeu sur la map.&lt;br /&gt;
&amp;lt;br&amp;gt;'''gravity''' [number]: la gravité de la map.&lt;br /&gt;
&amp;lt;br&amp;gt;'''time''' [Sous la forme suivante '''hh:mm''']: l'heure du jeu avec cette map.&lt;br /&gt;
&amp;lt;br&amp;gt;'''weather''' [number]: la météo de la map.&lt;br /&gt;
&amp;lt;br&amp;gt;'''waveheight''' [number]: la hauteur de l'eau pour cette map.&lt;br /&gt;
&amp;lt;br&amp;gt;'''locked_time''' [boolean]: décide si le temps est verouillé ou non.&lt;br /&gt;
&amp;lt;br&amp;gt;'''minplayers''' [number]: décide du nombre minimum de joueurs pour démarrer la map.&lt;br /&gt;
&amp;lt;br&amp;gt;'''maxplayers''' [number]: décide du nombre maximum de joueurs que peut accepter la map.&lt;br /&gt;
&lt;br /&gt;
[[it:Map manager]]&lt;br /&gt;
[[ru:Resource:Mapmanager]]&lt;/div&gt;</summary>
		<author><name>Gaetan Piette</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=FR/A_propos_des_Map&amp;diff=39224</id>
		<title>FR/A propos des Map</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=FR/A_propos_des_Map&amp;diff=39224"/>
		<updated>2014-04-03T14:27:17Z</updated>

		<summary type="html">&lt;p&gt;Gaetan Piette: /* Supported map settings */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Needs Checking|Either complete the translation or remove it.}}&lt;br /&gt;
Le &amp;quot;Map manager&amp;quot; est une ressource inclue dans la suite serveur de MTA DM. Elle offre des commandes, fonctions et événements pour les modes de jeu afin de dynamiser vos maps. Par exemple, quand un serveur doit charger plusieurs routes pour plusieurs maps, au lieu d'avoir le tout dans un seul script principal, ces routes peuvent êtres stockée dans plusieurs ressources et chargée simplement grâce à la fonction &amp;quot;changeGamemodeMap&amp;quot; quand une map démarre.&lt;br /&gt;
&lt;br /&gt;
Plus spécifiquement, le &amp;quot;Map manager&amp;quot; liste les modes de jeux et maps chargés sur le serveur. Il inclut un listing sur l'interface web, il rafraîchit cette liste fréquemment et met en gras les ressources et/ou maps actuellement entrain d'être utilisées. &lt;br /&gt;
&lt;br /&gt;
== Un Simple Tutoriel ==&lt;br /&gt;
Dans cette section nous allons poursuivre le travail commencé dans [[FR/Introduction_Programmation|Introduction to Scripting]]. Nous allons ajouter une ressource qui enregistre l'endroit de spawn des joueurs sur la map, le chargement de ce script se fera depuis le script principal.&lt;br /&gt;
&lt;br /&gt;
Premièrement, créez un dossier dans /Your MTA Server/mods/deathmatch/resources/, nommez-le &amp;quot;mymap&amp;quot;. Ensuite dans ce dossier, créez un fichier texte et nommez-le &amp;quot;meta.xml&amp;quot;, ce fichier est présent dans chaque scripts.&lt;br /&gt;
&lt;br /&gt;
Ecrivez les lignes suivantes dans le fichier ''meta.xml'' :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
   &amp;lt;info type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;myserver&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;map src=&amp;quot;mymap.map&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Prenez garde car ce fichier est &amp;quot;lié&amp;quot; avec le ''gamemodes=&amp;quot;&amp;quot;'' choisit, qui contient le nom de la ressource principale qu'utilise ce mode. le paramètre ''map'', indique le nom de la map qui sera afficher sur le serveur.&lt;br /&gt;
&lt;br /&gt;
Maintenant créez un nouveau fichier texte dans /mymap/ et nommez le &amp;quot;mymap.map&amp;quot;, écrivez y les lignes suivantes:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;map&amp;gt;&lt;br /&gt;
   &amp;lt;spawnpoint id=&amp;quot;spawnpoint1&amp;quot; posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;18&amp;quot; rot=&amp;quot;63.350006103516&amp;quot; model=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Notez que &amp;quot;spawnpoint&amp;quot; est le type de l'élément utilisé dans la fonction [[getElementsByType]], &amp;quot;id&amp;quot; est utilisée dans la fonction [[getElementByID]]&lt;br /&gt;
&lt;br /&gt;
Pour charger la map, le script principal doit pouvoir accéder aux maps par lui même. Quelques modifications sont à apportées dans script.lua situé dans &amp;quot;myserver&amp;quot;. Entrez les lignes suivantes :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function loadMap(startedMap)&lt;br /&gt;
	mapRoot = getResourceRootElement(startedMap)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEventHandler(&amp;quot;onGamemodeMapStart&amp;quot;, getRootElement(), loadMap)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Par défaut, l'evênement &amp;quot;onGamemodeMapStart&amp;quot; nous donne le &amp;quot;handle&amp;quot;(?) de la map (&amp;quot;startedMap&amp;quot;), lequel nous avons utilisé pour le &amp;quot;handle&amp;quot;(?) de la ressource contenant la map (&amp;quot;mapRoot&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
Avec la ressource &amp;quot;handle&amp;quot;(?), nous pouvons extraire les informations relatives au spawnpoint. Jetez un œil à la fonction joinHandler() dans script.lua, à la place de x, y and z, nous pouvons utiliser les informations de la map comme suit :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function joinHandler()&lt;br /&gt;
	local spawn = getElementsByType(&amp;quot;spawnpoint&amp;quot;, mapRoot)&lt;br /&gt;
	local x,y,z,r&lt;br /&gt;
	for key, value in pairs(spawn) do&lt;br /&gt;
		x = getElementData(value, &amp;quot;posX&amp;quot;)&lt;br /&gt;
		y = getElementData(value, &amp;quot;posY&amp;quot;)&lt;br /&gt;
		z = getElementData(value, &amp;quot;posZ&amp;quot;)&lt;br /&gt;
		r = getElementData(value, &amp;quot;rot&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
	spawnPlayer(source, x, y, z)&lt;br /&gt;
	fadeCamera(source, true)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancez maintenant votre gamemode avec la commande suivante via la console:&lt;br /&gt;
&lt;br /&gt;
'''gamemode myserver mymap'''&lt;br /&gt;
&lt;br /&gt;
==Usage==&lt;br /&gt;
Pour utiliser le map manager, vos ressources doivent d'abord être reconnues en tant que gamemodes ou maps.&lt;br /&gt;
&lt;br /&gt;
Vous devez remplir quelques informations pour votre fichier de configuration du '''gamemode resource''' :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;info description=&amp;quot;Votre Gamemode&amp;quot; type=&amp;quot;gamemode&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Map resources''' Les maps ont aussi besoin d'information dans le meta.xml, ''type=&amp;quot;map&amp;quot;'' et un ou plusieurs ''gamemodes''. Une map peut en effet être compatible avec plusieurs mode de jeu pour se faire il faudra séparer les modes par une virgule ''sans espaces''.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;info description=&amp;quot;A gamemode map&amp;quot; type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;ctv,koth&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Il ne peut y avoir qu’un mode de jeu 'Gamemode' Actif ou une map chargée à la fois.&lt;br /&gt;
&lt;br /&gt;
==Paramètres Supplémentaires==&lt;br /&gt;
Ces paramètres sont aussi à ajouter dans meta.xml.&lt;br /&gt;
&lt;br /&gt;
'''name:''' Entrez ici un message sympa qui sera afficher lors du démarrage de la ressource. C'est en quelques sorte un alias au cas ou le nom de votre ressource ne vous correspond pas.&lt;br /&gt;
&lt;br /&gt;
==Commandes==&lt;br /&gt;
'''changemap newmap [newgamemode]''' (changer le 'Gamemode' d'une map)&lt;br /&gt;
&lt;br /&gt;
'''changemode newgamemode [newmap]''' (lancer un mode de jeu 'Gamemode' et démarrez une map)&lt;br /&gt;
&lt;br /&gt;
'''gamemode newgamemode [newmap]''' (idem que la précédente)&lt;br /&gt;
&lt;br /&gt;
'''stopmode''' (Arrête le mode de jeu et la map en cours)&lt;br /&gt;
&lt;br /&gt;
'''stopmap''' (Arrête la map en cours)&lt;br /&gt;
&lt;br /&gt;
'''maps [gamemode]''' (liste toutes les maps sur le serveurs, ajoutez en option le mode pour lequel vous voulez connaître les maps)&lt;br /&gt;
&lt;br /&gt;
'''gamemodes''' (Liste tout les mode de jeu)&lt;br /&gt;
&lt;br /&gt;
==Paramètres==&lt;br /&gt;
'''*mapmanager.color''' [hex color string] (change la couleur de sortie des message du mapmanager) (Par défaut : #E1AA5A)&lt;br /&gt;
&lt;br /&gt;
'''*mapmanager.messages''' [boolean] (si les changements de map/gm sont activés) (Par défaut : true)&lt;br /&gt;
&lt;br /&gt;
'''*mapmanager.ASE''' [boolean] (si le manager doit charger en mode ASE) (Par défaut : true)&lt;br /&gt;
&lt;br /&gt;
==Autres fonctions==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool changeGamemode ( resource newGamemode, [ resource mapToLoadWith ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Changement de mode de jeu, on peut aussi lui donner une map initial à charger.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool changeGamemodeMap ( resource newMap, [ resource gamemodeToChangeTo ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Change le mode de jeu d'une map pour un nouveau, on peut choisir un mode de jeu à charger une fois cette map rechargée.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;table getGamemodes ( )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Renvoie une table des tout les modes de jeu et leur pointeurs.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;table getGamemodesCompatibleWithMap ( resource theMap )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Retourne une table de tout les modes de jeu compatibles.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;table getMaps ( )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Reourne une table de toutes les ressources en rapport avec la map.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;table getMapsCompatibleWithGamemode ( [ resource theGamemode ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Retourne une table de tout les modes de jeu compatibles. Si l'argument &amp;quot;theGamemode&amp;quot; est inexistant, ça retourne toutes les maps qui n'ont aucun mode de jeu compatible..&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;resource getRunningGamemode ( )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Renvoie le mode de jeu actif.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;resource getRunningGamemodeMap ( )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Renvoie le mode de jeu de la map en cours.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool isGamemode ( resource theGamemode )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Déterminie si une ressources est un mode de jeu ou pas.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool isGamemodeCompatibleWithMap ( resource theGamemode, resource theMap )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Déterminie si une map est compatible avec un mode de jeu ou pas.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool isMap ( resource theMap )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Détermine si ressources est une map ou pas.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool isMapCompatibleWithGamemode ( resource theMap, resource theGamemode )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Déterminie si une map est compatible avec un gamemode ou pas.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool stopGamemode ( )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Arrêter le mode de jeux actif ainsi que la map chargée.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool stopGamemodeMap ( )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Arrêter la map active.&lt;br /&gt;
&lt;br /&gt;
==Evênement Appelés==&lt;br /&gt;
''(Pour tous ces évênements, &amp;quot;source&amp;quot; est la ressource racine des élément.)''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;onGamemodeStart ( resource startedGamemode )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Appelé lors du démarrage d'un mode de jeu.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;onGamemodeStop ( resource stoppedGamemode )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Appelé quand on arrête un mode de jeu.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;onGamemodeMapStart ( resource startedMap )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Appelé quand la map d'un mode de jeu démarre.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;onGamemodeMapStop ( resource stoppedMap )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Appelé quand la map de mode de jeu est stoppée.&lt;br /&gt;
&lt;br /&gt;
==Paramètres d'une Map==&lt;br /&gt;
Les paramètres suivants [[settings system|registry]] sont appliqué par le &amp;quot;Map Manager&amp;quot; quand une map est démarée :&lt;br /&gt;
&amp;lt;br&amp;gt;'''gamespeed''' [number]: la vitesse du jeu sur la map.&lt;br /&gt;
&amp;lt;br&amp;gt;'''gravity''' [number]: la gravité de la map.&lt;br /&gt;
&amp;lt;br&amp;gt;'''time''' [string of the form '''hh:mm''']: l'heure du jeu avec cette map.&lt;br /&gt;
&amp;lt;br&amp;gt;'''weather''' [number]: la météo de la map.&lt;br /&gt;
&amp;lt;br&amp;gt;'''waveheight''' [number]: la hauteur de l'eau pour cette map.&lt;br /&gt;
&amp;lt;br&amp;gt;'''locked_time''' [boolean]: décide si le temps est verouillé ou non.&lt;br /&gt;
&amp;lt;br&amp;gt;'''minplayers''' [number]: décide du nombre minimum de joueurs pour démarrer la map.&lt;br /&gt;
&amp;lt;br&amp;gt;'''maxplayers''' [number]: décide du nombre maximum de joueurs que peut accepter la map.&lt;br /&gt;
&lt;br /&gt;
[[it:Map manager]]&lt;br /&gt;
[[ru:Resource:Mapmanager]]&lt;/div&gt;</summary>
		<author><name>Gaetan Piette</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=FR/A_propos_des_Map&amp;diff=39223</id>
		<title>FR/A propos des Map</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=FR/A_propos_des_Map&amp;diff=39223"/>
		<updated>2014-04-03T14:24:31Z</updated>

		<summary type="html">&lt;p&gt;Gaetan Piette: /* Fired events */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Needs Checking|Either complete the translation or remove it.}}&lt;br /&gt;
Le &amp;quot;Map manager&amp;quot; est une ressource inclue dans la suite serveur de MTA DM. Elle offre des commandes, fonctions et événements pour les modes de jeu afin de dynamiser vos maps. Par exemple, quand un serveur doit charger plusieurs routes pour plusieurs maps, au lieu d'avoir le tout dans un seul script principal, ces routes peuvent êtres stockée dans plusieurs ressources et chargée simplement grâce à la fonction &amp;quot;changeGamemodeMap&amp;quot; quand une map démarre.&lt;br /&gt;
&lt;br /&gt;
Plus spécifiquement, le &amp;quot;Map manager&amp;quot; liste les modes de jeux et maps chargés sur le serveur. Il inclut un listing sur l'interface web, il rafraîchit cette liste fréquemment et met en gras les ressources et/ou maps actuellement entrain d'être utilisées. &lt;br /&gt;
&lt;br /&gt;
== Un Simple Tutoriel ==&lt;br /&gt;
Dans cette section nous allons poursuivre le travail commencé dans [[FR/Introduction_Programmation|Introduction to Scripting]]. Nous allons ajouter une ressource qui enregistre l'endroit de spawn des joueurs sur la map, le chargement de ce script se fera depuis le script principal.&lt;br /&gt;
&lt;br /&gt;
Premièrement, créez un dossier dans /Your MTA Server/mods/deathmatch/resources/, nommez-le &amp;quot;mymap&amp;quot;. Ensuite dans ce dossier, créez un fichier texte et nommez-le &amp;quot;meta.xml&amp;quot;, ce fichier est présent dans chaque scripts.&lt;br /&gt;
&lt;br /&gt;
Ecrivez les lignes suivantes dans le fichier ''meta.xml'' :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
   &amp;lt;info type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;myserver&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;map src=&amp;quot;mymap.map&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Prenez garde car ce fichier est &amp;quot;lié&amp;quot; avec le ''gamemodes=&amp;quot;&amp;quot;'' choisit, qui contient le nom de la ressource principale qu'utilise ce mode. le paramètre ''map'', indique le nom de la map qui sera afficher sur le serveur.&lt;br /&gt;
&lt;br /&gt;
Maintenant créez un nouveau fichier texte dans /mymap/ et nommez le &amp;quot;mymap.map&amp;quot;, écrivez y les lignes suivantes:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;map&amp;gt;&lt;br /&gt;
   &amp;lt;spawnpoint id=&amp;quot;spawnpoint1&amp;quot; posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;18&amp;quot; rot=&amp;quot;63.350006103516&amp;quot; model=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Notez que &amp;quot;spawnpoint&amp;quot; est le type de l'élément utilisé dans la fonction [[getElementsByType]], &amp;quot;id&amp;quot; est utilisée dans la fonction [[getElementByID]]&lt;br /&gt;
&lt;br /&gt;
Pour charger la map, le script principal doit pouvoir accéder aux maps par lui même. Quelques modifications sont à apportées dans script.lua situé dans &amp;quot;myserver&amp;quot;. Entrez les lignes suivantes :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function loadMap(startedMap)&lt;br /&gt;
	mapRoot = getResourceRootElement(startedMap)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEventHandler(&amp;quot;onGamemodeMapStart&amp;quot;, getRootElement(), loadMap)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Par défaut, l'evênement &amp;quot;onGamemodeMapStart&amp;quot; nous donne le &amp;quot;handle&amp;quot;(?) de la map (&amp;quot;startedMap&amp;quot;), lequel nous avons utilisé pour le &amp;quot;handle&amp;quot;(?) de la ressource contenant la map (&amp;quot;mapRoot&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
Avec la ressource &amp;quot;handle&amp;quot;(?), nous pouvons extraire les informations relatives au spawnpoint. Jetez un œil à la fonction joinHandler() dans script.lua, à la place de x, y and z, nous pouvons utiliser les informations de la map comme suit :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function joinHandler()&lt;br /&gt;
	local spawn = getElementsByType(&amp;quot;spawnpoint&amp;quot;, mapRoot)&lt;br /&gt;
	local x,y,z,r&lt;br /&gt;
	for key, value in pairs(spawn) do&lt;br /&gt;
		x = getElementData(value, &amp;quot;posX&amp;quot;)&lt;br /&gt;
		y = getElementData(value, &amp;quot;posY&amp;quot;)&lt;br /&gt;
		z = getElementData(value, &amp;quot;posZ&amp;quot;)&lt;br /&gt;
		r = getElementData(value, &amp;quot;rot&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
	spawnPlayer(source, x, y, z)&lt;br /&gt;
	fadeCamera(source, true)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancez maintenant votre gamemode avec la commande suivante via la console:&lt;br /&gt;
&lt;br /&gt;
'''gamemode myserver mymap'''&lt;br /&gt;
&lt;br /&gt;
==Usage==&lt;br /&gt;
Pour utiliser le map manager, vos ressources doivent d'abord être reconnues en tant que gamemodes ou maps.&lt;br /&gt;
&lt;br /&gt;
Vous devez remplir quelques informations pour votre fichier de configuration du '''gamemode resource''' :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;info description=&amp;quot;Votre Gamemode&amp;quot; type=&amp;quot;gamemode&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Map resources''' Les maps ont aussi besoin d'information dans le meta.xml, ''type=&amp;quot;map&amp;quot;'' et un ou plusieurs ''gamemodes''. Une map peut en effet être compatible avec plusieurs mode de jeu pour se faire il faudra séparer les modes par une virgule ''sans espaces''.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;info description=&amp;quot;A gamemode map&amp;quot; type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;ctv,koth&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Il ne peut y avoir qu’un mode de jeu 'Gamemode' Actif ou une map chargée à la fois.&lt;br /&gt;
&lt;br /&gt;
==Paramètres Supplémentaires==&lt;br /&gt;
Ces paramètres sont aussi à ajouter dans meta.xml.&lt;br /&gt;
&lt;br /&gt;
'''name:''' Entrez ici un message sympa qui sera afficher lors du démarrage de la ressource. C'est en quelques sorte un alias au cas ou le nom de votre ressource ne vous correspond pas.&lt;br /&gt;
&lt;br /&gt;
==Commandes==&lt;br /&gt;
'''changemap newmap [newgamemode]''' (changer le 'Gamemode' d'une map)&lt;br /&gt;
&lt;br /&gt;
'''changemode newgamemode [newmap]''' (lancer un mode de jeu 'Gamemode' et démarrez une map)&lt;br /&gt;
&lt;br /&gt;
'''gamemode newgamemode [newmap]''' (idem que la précédente)&lt;br /&gt;
&lt;br /&gt;
'''stopmode''' (Arrête le mode de jeu et la map en cours)&lt;br /&gt;
&lt;br /&gt;
'''stopmap''' (Arrête la map en cours)&lt;br /&gt;
&lt;br /&gt;
'''maps [gamemode]''' (liste toutes les maps sur le serveurs, ajoutez en option le mode pour lequel vous voulez connaître les maps)&lt;br /&gt;
&lt;br /&gt;
'''gamemodes''' (Liste tout les mode de jeu)&lt;br /&gt;
&lt;br /&gt;
==Paramètres==&lt;br /&gt;
'''*mapmanager.color''' [hex color string] (change la couleur de sortie des message du mapmanager) (Par défaut : #E1AA5A)&lt;br /&gt;
&lt;br /&gt;
'''*mapmanager.messages''' [boolean] (si les changements de map/gm sont activés) (Par défaut : true)&lt;br /&gt;
&lt;br /&gt;
'''*mapmanager.ASE''' [boolean] (si le manager doit charger en mode ASE) (Par défaut : true)&lt;br /&gt;
&lt;br /&gt;
==Autres fonctions==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool changeGamemode ( resource newGamemode, [ resource mapToLoadWith ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Changement de mode de jeu, on peut aussi lui donner une map initial à charger.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool changeGamemodeMap ( resource newMap, [ resource gamemodeToChangeTo ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Change le mode de jeu d'une map pour un nouveau, on peut choisir un mode de jeu à charger une fois cette map rechargée.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;table getGamemodes ( )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Renvoie une table des tout les modes de jeu et leur pointeurs.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;table getGamemodesCompatibleWithMap ( resource theMap )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Retourne une table de tout les modes de jeu compatibles.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;table getMaps ( )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Reourne une table de toutes les ressources en rapport avec la map.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;table getMapsCompatibleWithGamemode ( [ resource theGamemode ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Retourne une table de tout les modes de jeu compatibles. Si l'argument &amp;quot;theGamemode&amp;quot; est inexistant, ça retourne toutes les maps qui n'ont aucun mode de jeu compatible..&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;resource getRunningGamemode ( )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Renvoie le mode de jeu actif.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;resource getRunningGamemodeMap ( )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Renvoie le mode de jeu de la map en cours.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool isGamemode ( resource theGamemode )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Déterminie si une ressources est un mode de jeu ou pas.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool isGamemodeCompatibleWithMap ( resource theGamemode, resource theMap )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Déterminie si une map est compatible avec un mode de jeu ou pas.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool isMap ( resource theMap )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Détermine si ressources est une map ou pas.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool isMapCompatibleWithGamemode ( resource theMap, resource theGamemode )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Déterminie si une map est compatible avec un gamemode ou pas.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool stopGamemode ( )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Arrêter le mode de jeux actif ainsi que la map chargée.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool stopGamemodeMap ( )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Arrêter la map active.&lt;br /&gt;
&lt;br /&gt;
==Evênement Appelés==&lt;br /&gt;
''(Pour tous ces évênements, &amp;quot;source&amp;quot; est la ressource racine des élément.)''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;onGamemodeStart ( resource startedGamemode )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Appelé lors du démarrage d'un mode de jeu.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;onGamemodeStop ( resource stoppedGamemode )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Appelé quand on arrête un mode de jeu.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;onGamemodeMapStart ( resource startedMap )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Appelé quand la map d'un mode de jeu démarre.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;onGamemodeMapStop ( resource stoppedMap )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Appelé quand la map de mode de jeu est stoppée.&lt;br /&gt;
&lt;br /&gt;
==Supported map settings==&lt;br /&gt;
The following settings from the [[settings system|registry]] are applied by the map manager when a map is started:&lt;br /&gt;
&amp;lt;br&amp;gt;'''gamespeed''' [number]: The map's game speed.&lt;br /&gt;
&amp;lt;br&amp;gt;'''gravity''' [number]: The map's gravity.&lt;br /&gt;
&amp;lt;br&amp;gt;'''time''' [string of the form '''hh:mm''']: The map's time.&lt;br /&gt;
&amp;lt;br&amp;gt;'''weather''' [number]: The map's weather ID.&lt;br /&gt;
&amp;lt;br&amp;gt;'''waveheight''' [number]: The map's wave height.&lt;br /&gt;
&amp;lt;br&amp;gt;'''locked_time''' [boolean]: Whether the set time will be frozen by the manager or not.&lt;br /&gt;
&amp;lt;br&amp;gt;'''minplayers''' [number]: The required minimum number of players to start the map.&lt;br /&gt;
&amp;lt;br&amp;gt;'''maxplayers''' [number]: The allowed maximum number of players to start the map.&lt;br /&gt;
&lt;br /&gt;
[[it:Map manager]]&lt;br /&gt;
[[ru:Resource:Mapmanager]]&lt;/div&gt;</summary>
		<author><name>Gaetan Piette</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=FR/A_propos_des_Map&amp;diff=39222</id>
		<title>FR/A propos des Map</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=FR/A_propos_des_Map&amp;diff=39222"/>
		<updated>2014-04-03T14:20:01Z</updated>

		<summary type="html">&lt;p&gt;Gaetan Piette: /* Autres fonctions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Needs Checking|Either complete the translation or remove it.}}&lt;br /&gt;
Le &amp;quot;Map manager&amp;quot; est une ressource inclue dans la suite serveur de MTA DM. Elle offre des commandes, fonctions et événements pour les modes de jeu afin de dynamiser vos maps. Par exemple, quand un serveur doit charger plusieurs routes pour plusieurs maps, au lieu d'avoir le tout dans un seul script principal, ces routes peuvent êtres stockée dans plusieurs ressources et chargée simplement grâce à la fonction &amp;quot;changeGamemodeMap&amp;quot; quand une map démarre.&lt;br /&gt;
&lt;br /&gt;
Plus spécifiquement, le &amp;quot;Map manager&amp;quot; liste les modes de jeux et maps chargés sur le serveur. Il inclut un listing sur l'interface web, il rafraîchit cette liste fréquemment et met en gras les ressources et/ou maps actuellement entrain d'être utilisées. &lt;br /&gt;
&lt;br /&gt;
== Un Simple Tutoriel ==&lt;br /&gt;
Dans cette section nous allons poursuivre le travail commencé dans [[FR/Introduction_Programmation|Introduction to Scripting]]. Nous allons ajouter une ressource qui enregistre l'endroit de spawn des joueurs sur la map, le chargement de ce script se fera depuis le script principal.&lt;br /&gt;
&lt;br /&gt;
Premièrement, créez un dossier dans /Your MTA Server/mods/deathmatch/resources/, nommez-le &amp;quot;mymap&amp;quot;. Ensuite dans ce dossier, créez un fichier texte et nommez-le &amp;quot;meta.xml&amp;quot;, ce fichier est présent dans chaque scripts.&lt;br /&gt;
&lt;br /&gt;
Ecrivez les lignes suivantes dans le fichier ''meta.xml'' :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
   &amp;lt;info type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;myserver&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;map src=&amp;quot;mymap.map&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Prenez garde car ce fichier est &amp;quot;lié&amp;quot; avec le ''gamemodes=&amp;quot;&amp;quot;'' choisit, qui contient le nom de la ressource principale qu'utilise ce mode. le paramètre ''map'', indique le nom de la map qui sera afficher sur le serveur.&lt;br /&gt;
&lt;br /&gt;
Maintenant créez un nouveau fichier texte dans /mymap/ et nommez le &amp;quot;mymap.map&amp;quot;, écrivez y les lignes suivantes:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;map&amp;gt;&lt;br /&gt;
   &amp;lt;spawnpoint id=&amp;quot;spawnpoint1&amp;quot; posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;18&amp;quot; rot=&amp;quot;63.350006103516&amp;quot; model=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Notez que &amp;quot;spawnpoint&amp;quot; est le type de l'élément utilisé dans la fonction [[getElementsByType]], &amp;quot;id&amp;quot; est utilisée dans la fonction [[getElementByID]]&lt;br /&gt;
&lt;br /&gt;
Pour charger la map, le script principal doit pouvoir accéder aux maps par lui même. Quelques modifications sont à apportées dans script.lua situé dans &amp;quot;myserver&amp;quot;. Entrez les lignes suivantes :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function loadMap(startedMap)&lt;br /&gt;
	mapRoot = getResourceRootElement(startedMap)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEventHandler(&amp;quot;onGamemodeMapStart&amp;quot;, getRootElement(), loadMap)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Par défaut, l'evênement &amp;quot;onGamemodeMapStart&amp;quot; nous donne le &amp;quot;handle&amp;quot;(?) de la map (&amp;quot;startedMap&amp;quot;), lequel nous avons utilisé pour le &amp;quot;handle&amp;quot;(?) de la ressource contenant la map (&amp;quot;mapRoot&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
Avec la ressource &amp;quot;handle&amp;quot;(?), nous pouvons extraire les informations relatives au spawnpoint. Jetez un œil à la fonction joinHandler() dans script.lua, à la place de x, y and z, nous pouvons utiliser les informations de la map comme suit :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function joinHandler()&lt;br /&gt;
	local spawn = getElementsByType(&amp;quot;spawnpoint&amp;quot;, mapRoot)&lt;br /&gt;
	local x,y,z,r&lt;br /&gt;
	for key, value in pairs(spawn) do&lt;br /&gt;
		x = getElementData(value, &amp;quot;posX&amp;quot;)&lt;br /&gt;
		y = getElementData(value, &amp;quot;posY&amp;quot;)&lt;br /&gt;
		z = getElementData(value, &amp;quot;posZ&amp;quot;)&lt;br /&gt;
		r = getElementData(value, &amp;quot;rot&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
	spawnPlayer(source, x, y, z)&lt;br /&gt;
	fadeCamera(source, true)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancez maintenant votre gamemode avec la commande suivante via la console:&lt;br /&gt;
&lt;br /&gt;
'''gamemode myserver mymap'''&lt;br /&gt;
&lt;br /&gt;
==Usage==&lt;br /&gt;
Pour utiliser le map manager, vos ressources doivent d'abord être reconnues en tant que gamemodes ou maps.&lt;br /&gt;
&lt;br /&gt;
Vous devez remplir quelques informations pour votre fichier de configuration du '''gamemode resource''' :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;info description=&amp;quot;Votre Gamemode&amp;quot; type=&amp;quot;gamemode&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Map resources''' Les maps ont aussi besoin d'information dans le meta.xml, ''type=&amp;quot;map&amp;quot;'' et un ou plusieurs ''gamemodes''. Une map peut en effet être compatible avec plusieurs mode de jeu pour se faire il faudra séparer les modes par une virgule ''sans espaces''.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;info description=&amp;quot;A gamemode map&amp;quot; type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;ctv,koth&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Il ne peut y avoir qu’un mode de jeu 'Gamemode' Actif ou une map chargée à la fois.&lt;br /&gt;
&lt;br /&gt;
==Paramètres Supplémentaires==&lt;br /&gt;
Ces paramètres sont aussi à ajouter dans meta.xml.&lt;br /&gt;
&lt;br /&gt;
'''name:''' Entrez ici un message sympa qui sera afficher lors du démarrage de la ressource. C'est en quelques sorte un alias au cas ou le nom de votre ressource ne vous correspond pas.&lt;br /&gt;
&lt;br /&gt;
==Commandes==&lt;br /&gt;
'''changemap newmap [newgamemode]''' (changer le 'Gamemode' d'une map)&lt;br /&gt;
&lt;br /&gt;
'''changemode newgamemode [newmap]''' (lancer un mode de jeu 'Gamemode' et démarrez une map)&lt;br /&gt;
&lt;br /&gt;
'''gamemode newgamemode [newmap]''' (idem que la précédente)&lt;br /&gt;
&lt;br /&gt;
'''stopmode''' (Arrête le mode de jeu et la map en cours)&lt;br /&gt;
&lt;br /&gt;
'''stopmap''' (Arrête la map en cours)&lt;br /&gt;
&lt;br /&gt;
'''maps [gamemode]''' (liste toutes les maps sur le serveurs, ajoutez en option le mode pour lequel vous voulez connaître les maps)&lt;br /&gt;
&lt;br /&gt;
'''gamemodes''' (Liste tout les mode de jeu)&lt;br /&gt;
&lt;br /&gt;
==Paramètres==&lt;br /&gt;
'''*mapmanager.color''' [hex color string] (change la couleur de sortie des message du mapmanager) (Par défaut : #E1AA5A)&lt;br /&gt;
&lt;br /&gt;
'''*mapmanager.messages''' [boolean] (si les changements de map/gm sont activés) (Par défaut : true)&lt;br /&gt;
&lt;br /&gt;
'''*mapmanager.ASE''' [boolean] (si le manager doit charger en mode ASE) (Par défaut : true)&lt;br /&gt;
&lt;br /&gt;
==Autres fonctions==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool changeGamemode ( resource newGamemode, [ resource mapToLoadWith ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Changement de mode de jeu, on peut aussi lui donner une map initial à charger.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool changeGamemodeMap ( resource newMap, [ resource gamemodeToChangeTo ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Change le mode de jeu d'une map pour un nouveau, on peut choisir un mode de jeu à charger une fois cette map rechargée.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;table getGamemodes ( )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Renvoie une table des tout les modes de jeu et leur pointeurs.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;table getGamemodesCompatibleWithMap ( resource theMap )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Retourne une table de tout les modes de jeu compatibles.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;table getMaps ( )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Reourne une table de toutes les ressources en rapport avec la map.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;table getMapsCompatibleWithGamemode ( [ resource theGamemode ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Retourne une table de tout les modes de jeu compatibles. Si l'argument &amp;quot;theGamemode&amp;quot; est inexistant, ça retourne toutes les maps qui n'ont aucun mode de jeu compatible..&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;resource getRunningGamemode ( )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Renvoie le mode de jeu actif.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;resource getRunningGamemodeMap ( )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Renvoie le mode de jeu de la map en cours.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool isGamemode ( resource theGamemode )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Déterminie si une ressources est un mode de jeu ou pas.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool isGamemodeCompatibleWithMap ( resource theGamemode, resource theMap )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Déterminie si une map est compatible avec un mode de jeu ou pas.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool isMap ( resource theMap )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Détermine si ressources est une map ou pas.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool isMapCompatibleWithGamemode ( resource theMap, resource theGamemode )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Déterminie si une map est compatible avec un gamemode ou pas.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool stopGamemode ( )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Arrêter le mode de jeux actif ainsi que la map chargée.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool stopGamemodeMap ( )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Arrêter la map active.&lt;br /&gt;
&lt;br /&gt;
==Fired events==&lt;br /&gt;
''(For all these events, &amp;quot;source&amp;quot; is the resource's root element.)''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;onGamemodeStart ( resource startedGamemode )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Fired before a gamemode starts.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;onGamemodeStop ( resource stoppedGamemode )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Fired before a gamemode is stopped.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;onGamemodeMapStart ( resource startedMap )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Fired before a GM map starts.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;onGamemodeMapStop ( resource stoppedMap )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Fired before a GM map is stopped.&lt;br /&gt;
&lt;br /&gt;
==Supported map settings==&lt;br /&gt;
The following settings from the [[settings system|registry]] are applied by the map manager when a map is started:&lt;br /&gt;
&amp;lt;br&amp;gt;'''gamespeed''' [number]: The map's game speed.&lt;br /&gt;
&amp;lt;br&amp;gt;'''gravity''' [number]: The map's gravity.&lt;br /&gt;
&amp;lt;br&amp;gt;'''time''' [string of the form '''hh:mm''']: The map's time.&lt;br /&gt;
&amp;lt;br&amp;gt;'''weather''' [number]: The map's weather ID.&lt;br /&gt;
&amp;lt;br&amp;gt;'''waveheight''' [number]: The map's wave height.&lt;br /&gt;
&amp;lt;br&amp;gt;'''locked_time''' [boolean]: Whether the set time will be frozen by the manager or not.&lt;br /&gt;
&amp;lt;br&amp;gt;'''minplayers''' [number]: The required minimum number of players to start the map.&lt;br /&gt;
&amp;lt;br&amp;gt;'''maxplayers''' [number]: The allowed maximum number of players to start the map.&lt;br /&gt;
&lt;br /&gt;
[[it:Map manager]]&lt;br /&gt;
[[ru:Resource:Mapmanager]]&lt;/div&gt;</summary>
		<author><name>Gaetan Piette</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=User:Rouche&amp;diff=38824</id>
		<title>User:Rouche</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=User:Rouche&amp;diff=38824"/>
		<updated>2014-02-09T19:40:38Z</updated>

		<summary type="html">&lt;p&gt;Gaetan Piette: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Name : Gaëtan&amp;lt;br&amp;gt;&lt;br /&gt;
Age : 29 July 1991&amp;lt;br&amp;gt;&lt;br /&gt;
Live in Belgium&amp;lt;br&amp;gt;&lt;br /&gt;
Langages : French and English&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
MTA:SA&amp;lt;br&amp;gt;&lt;br /&gt;
- Owner of =KoG=Team (2 Servers)&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Website : [http://www.teamkog.com Team =KoG=]&lt;br /&gt;
&lt;br /&gt;
Help Community :&amp;lt;br&amp;gt;&lt;br /&gt;
Translate : MTA:SA Wiki (French).&lt;/div&gt;</summary>
		<author><name>Gaetan Piette</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=FR/Introduction_GUI&amp;diff=36483</id>
		<title>FR/Introduction GUI</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=FR/Introduction_GUI&amp;diff=36483"/>
		<updated>2013-06-30T12:30:11Z</updated>

		<summary type="html">&lt;p&gt;Gaetan Piette: /* Adding the components */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- place holder --&amp;gt;&lt;br /&gt;
Une des grandes caractéristiques de MTA:SA c'est d'avoir la possibilité de personnaliser l'interface. Plus couramment appelé GUI(Graphic User Interface). L'interface graphique se compose de fenêtres, bouton, les boîtes d'édition, des cases à cocher ... Les GUI peuvent être affichés lorsque l'utilisateur est en jeu.&lt;br /&gt;
&lt;br /&gt;
[[Image:AdminGUI.png|thumb|Le panel admin(GUI)]]&lt;br /&gt;
&lt;br /&gt;
==Un tutoriel pour créer une fenêtre de connexion==&lt;br /&gt;
Dans ce tutoriel, nous allons faire une fenêtre de connexion simple avec deux boites de saisie et un bouton.&lt;br /&gt;
La fenêtre apparaîtra lorsque le joueur rejoindra le jeu et une fois que le joueur appuiera sur le bouton.&lt;br /&gt;
&lt;br /&gt;
===Créer la fenêtre de connexion===&lt;br /&gt;
Tous les GUI doivent être crée dans le coté client. Pour vous simplifier la vie, créez votre code dans des dossiers séparé.&lt;br /&gt;
Les fichiers client vous les mettez dans le dossier client que vous avez créer.&lt;br /&gt;
&lt;br /&gt;
Allez sur /Votre Server MTA/mods/deathmatch/resources/votreserver/, et créez un dossier du nom de &amp;quot;login&amp;quot;.&lt;br /&gt;
Puis dans ce répertoire créer le dosser &amp;quot;client&amp;quot;. (login/client)&lt;br /&gt;
Créez un fichier texte et nommez le &amp;quot;gui.lua&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Dans ce fichier nous allons écrire une fonction pour créer notre fenêtre. Pour créer une fenetre vous allez devoir utiliser [[guiCreateWindow]]: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createLoginWindow()&lt;br /&gt;
	-- on définie les positions de la fenêtre&lt;br /&gt;
	local X = 0.375&lt;br /&gt;
	local Y = 0.375&lt;br /&gt;
	-- on définie la taille de la fenêtre&lt;br /&gt;
	local Width = 0.25&lt;br /&gt;
	local Height = 0.25&lt;br /&gt;
	-- créez la fenêtre et sauvegardez cette élément sous la variable 'wdwLogin'&lt;br /&gt;
	-- cliquez sur le nom de la fonction pour regarder sa documentation&lt;br /&gt;
	wdwLogin = guiCreateWindow(X, Y, Width, Height, &amp;quot;Veuillez vous connecter&amp;quot;, true)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Relatif et Absolu ===&lt;br /&gt;
Notez que l'argument final passé à guiCreateWindow dans l'exemple ci-dessus est ''true''. Cela indique que l'ensemble et les dimensions de la fenêtre sont ''relative'', en signifiant qu'ils sont un ''percentage'' de la grandeur d'écran totale. Cela signifie que si le côté gauche lointain de l'écran est 0 et le droit lointain est 1, une position X de 0.5 représenterait le point de centre de l'écran. De même si le haut de l'écran est 0 et le fond est 1, une position Y de 0.2 serait 20 % de la voie en bas l'écran. Les mêmes principes s'appliquent tant à Largeur qu'à Hauteur aussi (avec une valeur de Largeur de 0.5 sens la fenêtre sera la moitié aussi large que l'écran). &lt;br /&gt;
&lt;br /&gt;
L'alternative à l'utilisation des valeurs relatives utilise absolu (en passant ''false'' au lieu de ''true'' pour guiCreateWindow). Les valeurs absolues sont calculées comme le nombre total de pixels du coin gauche-supérieur du parent (si aucun parent d'élément gui n'est spécifié, le parent est l'écran lui-même). Si nous supposons une résolution d'écran de 1920x1200, le côté gauche lointain de l'écran étant 0 pixels et le droit lointain étant 1920 pixels, une position X de 960 représentera le point de centre de l'écran. De même si le haut de l'écran est 0 pixels et le fond est 1200, une position Y de 20 serait 20 pixels en bas du haut de l'écran. La même pomme de principes tant à la Largeur qu'à la Hauteur aussi (avec une valeur de Largeur de 50 sens la fenêtre sera 50 pixels larges). Vous pouvez utiliser guiGetScreenSize et des petites mathématiques pour calculer certaines positions absolues. &lt;br /&gt;
&lt;br /&gt;
Les différences entre l'utilisation des valeurs relatives et absolues sont tout à fait simples; les valeurs absolues utilisatrices de données de gui resteront toujours exactement la même grandeur de pixel et la position, pendant que les valeurs relatives utilisatrices de données de gui seront toujours un pourcentage de sa grandeur parentale. &lt;br /&gt;
&lt;br /&gt;
L'absolu est généralement plus facile de maintenir en révisant le code à la main, pourtant votre choix de type dépend de la situation dont vous l'utilisez. &lt;br /&gt;
&lt;br /&gt;
Pour les buts de cette introduction nous utiliserons des valeurs relatives.&lt;br /&gt;
&lt;br /&gt;
===Ajouter les composants===&lt;br /&gt;
Next, we'll add the text labels (saying &amp;quot;username:&amp;quot; and &amp;quot;password:&amp;quot;), edit boxes (for entering your data) and a button to log in.&lt;br /&gt;
&lt;br /&gt;
To create buttons we use [[guiCreateButton]] and to create edit boxes use [[guiCreateEdit]]:&lt;br /&gt;
&lt;br /&gt;
'''Note that we are now writing more code for our existing 'createLoginWindow' function. This is not a new function and is meant to replace what you already have.''' &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createLoginWindow()&lt;br /&gt;
	local X = 0.375&lt;br /&gt;
	local Y = 0.375&lt;br /&gt;
	local Width = 0.25&lt;br /&gt;
	local Height = 0.25&lt;br /&gt;
	wdwLogin = guiCreateWindow(X, Y, Width, Height, &amp;quot;Please Log In&amp;quot;, true)&lt;br /&gt;
	&lt;br /&gt;
	-- define new X and Y positions for the first label&lt;br /&gt;
	X = 0.0825&lt;br /&gt;
	Y = 0.2&lt;br /&gt;
	-- define new Width and Height values for the first label&lt;br /&gt;
	Width = 0.25&lt;br /&gt;
	Height = 0.25&lt;br /&gt;
	-- create the first label, note the final argument passed is 'wdwLogin' meaning the window&lt;br /&gt;
	-- we created above is the parent of this label (so all the position and size values are now relative to the position of that window)&lt;br /&gt;
	guiCreateLabel(X, Y, Width, Height, &amp;quot;Username&amp;quot;, true, wdwLogin)&lt;br /&gt;
	-- alter the Y value, so the second label is slightly below the first&lt;br /&gt;
	Y = 0.5&lt;br /&gt;
	guiCreateLabel(X, Y, Width, Height, &amp;quot;Password&amp;quot;, true, wdwLogin)&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
	X = 0.415&lt;br /&gt;
	Y = 0.2&lt;br /&gt;
	Width = 0.5&lt;br /&gt;
	Height = 0.15&lt;br /&gt;
	edtUser = guiCreateEdit(X, Y, Width, Height, &amp;quot;&amp;quot;, true, wdwLogin)&lt;br /&gt;
	Y = 0.5&lt;br /&gt;
	edtPass = guiCreateEdit(X, Y, Width, Height, &amp;quot;&amp;quot;, true, wdwLogin)&lt;br /&gt;
	-- set the maximum character length for the username and password fields to 50&lt;br /&gt;
	guiEditSetMaxLength(edtUser, 50)&lt;br /&gt;
	guiEditSetMaxLength(edtPass, 50)&lt;br /&gt;
	&lt;br /&gt;
	X = 0.415&lt;br /&gt;
	Y = 0.7&lt;br /&gt;
	Width = 0.25&lt;br /&gt;
	Height = 0.2&lt;br /&gt;
	btnLogin = guiCreateButton(X, Y, Width, Height, &amp;quot;Log In&amp;quot;, true, wdwLogin)&lt;br /&gt;
	&lt;br /&gt;
	-- make the window invisible&lt;br /&gt;
	guiSetVisible(wdwLogin, false)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Note that every GUI component created is a child of the window, this is done by specifying the parent element (wdwLogin, in this case) when creating the component. &lt;br /&gt;
&lt;br /&gt;
This is very useful because not only does it mean that all the components are attached to the window and will move with it, but also that any changes done to the parent window will be applied down the tree to these child components. For example, we can now hide all of the GUI we just created by simply hiding the window:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
guiSetVisible(wdwLogin, false) --hides all the GUI we made so we can show them to the player at the appropriate moment. &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Using the function we wrote===&lt;br /&gt;
The createLoginWindow function is now complete, but it won't do anything until we call it. It is recommended to create all GUI when the client resource starts, hide them, and show them to the player later when needed. Therefore, we'll write an event handler for &amp;quot;[[onClientResourceStart]]&amp;quot; to create the window:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- attach the event handler to the root element of the resource&lt;br /&gt;
-- this means it will only trigger when its own resource is started&lt;br /&gt;
addEventHandler(&amp;quot;onClientResourceStart&amp;quot;, getResourceRootElement(getThisResource()), &lt;br /&gt;
	function ()&lt;br /&gt;
		createLoginWindow()&lt;br /&gt;
	end&lt;br /&gt;
)	&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As this is a log in window, we now need to show the window when the player joins the game. &lt;br /&gt;
This can be done using the same event, &amp;quot;[[onClientResourceStart]]&amp;quot;, so we can modify the above code to include showing the window:&lt;br /&gt;
&lt;br /&gt;
'''Note that we are now writing more code for our existing 'onClientResourceStart' handler. This is not a new event handler and is meant to replace what you already have.''' &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onClientResourceStart&amp;quot;, getResourceRootElement(getThisResource()), &lt;br /&gt;
	function ()&lt;br /&gt;
		-- create the log in window and its components&lt;br /&gt;
		createLoginWindow()&lt;br /&gt;
&lt;br /&gt;
		-- output a brief welcome message to the player&lt;br /&gt;
                outputChatBox(&amp;quot;Welcome to My MTA:SA Server, please log in.&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
		-- if the GUI was successfully created, then show the GUI to the player&lt;br /&gt;
	        if (wdwLogin ~= nil) then&lt;br /&gt;
			guiSetVisible(wdwLogin, true)&lt;br /&gt;
		else&lt;br /&gt;
			-- if the GUI hasnt been properly created, tell the player&lt;br /&gt;
			outputChatBox(&amp;quot;An unexpected error has occurred and the log in GUI has not been created.&amp;quot;)&lt;br /&gt;
	        end &lt;br /&gt;
&lt;br /&gt;
		-- enable the players cursor (so they can select and click on the components)&lt;br /&gt;
	        showCursor(true)&lt;br /&gt;
		-- set the input focus onto the GUI, allowing players (for example) to press 'T' without the chatbox opening&lt;br /&gt;
	        guiSetInputEnabled(true)&lt;br /&gt;
	end&lt;br /&gt;
)	&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that we have a simple security check before making the window visible, so in the unlikely event that the window has not been created, meaning wdwLogin is not a valid element, we don't get an error and just inform the player what has happened. &lt;br /&gt;
In the next step, we will create the button functionality for the log in button.&lt;br /&gt;
&lt;br /&gt;
==Scripting the button==&lt;br /&gt;
Now that we have created our GUI and shown it to the player, we need to make it work. &lt;br /&gt;
&lt;br /&gt;
===Detecting the click===&lt;br /&gt;
When the player clicks on any part of the GUI, the event &amp;quot;[[onClientGUIClick]]&amp;quot; will be triggered for the GUI component you clicked on. This allows us to easily detect any clicks on the GUI elements we want to use.&lt;br /&gt;
For example, we can attach the event to the btnLogin button to catch any clicks on it:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- attach the event onClientGUIClick to btnLogin and set it to trigger the 'clientSubmitLogin' function&lt;br /&gt;
addEventHandler(&amp;quot;onClientGUIClick&amp;quot;, btnLogin, clientSubmitLogin, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
'''Note the final argument passed is &amp;quot;false&amp;quot;. This indicates that the event will only trigger directly on btnLogin, not if the event has propagated up or down the tree. Setting this to &amp;quot;true&amp;quot; while attaching to gui elements will mean that clicking on any element in the same branch will trigger this event.'''&lt;br /&gt;
&lt;br /&gt;
This line of code can now be added inside the createLoginWindow function. It is a common mistake to try and attach events to non-existant GUI elements, so make sure you always attach your events '''after''' the gui element (in this case, the button) has been created:&lt;br /&gt;
&lt;br /&gt;
'''Note that we are now writing more code for our existing 'createLoginWindow' function.''' &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createLoginWindow()&lt;br /&gt;
	-- create all our GUI elements&lt;br /&gt;
	...&lt;br /&gt;
&lt;br /&gt;
	-- now add our onClientGUIClick event to the button we just created&lt;br /&gt;
	addEventHandler(&amp;quot;onClientGUIClick&amp;quot;, btnLogin, clientSubmitLogin, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Managing the click===&lt;br /&gt;
Now that we can detect when the player clicks on the button, we need to write code to manage what happens when they do.&lt;br /&gt;
In our [[onClientGUIClick]] event handle, we told it to call the function clientSubmitLogin whenever btnLogin is clicked.&lt;br /&gt;
Therefore, we can now use the function clientSubmitLogin to control what happens when the button is clicked:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- create the function and define the 'button' and 'state' parameters&lt;br /&gt;
-- (these are passed automatically by onClientGUIClick)&lt;br /&gt;
function clientSubmitLogin(button,state)&lt;br /&gt;
	-- if our login button was clicked with the left mouse button, and the state of the mouse button is up&lt;br /&gt;
	if button == &amp;quot;left&amp;quot; and state == &amp;quot;up&amp;quot; then&lt;br /&gt;
		-- move the input focus back onto the game (allowing players to move around, open the chatbox, etc)&lt;br /&gt;
		guiSetInputEnabled(false)&lt;br /&gt;
		-- hide the window and all the components&lt;br /&gt;
		guiSetVisible(wdwLogin, false)&lt;br /&gt;
		-- hide the mouse cursor&lt;br /&gt;
		showCursor(false)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Now, when the button is clicked, the window will be hidden and all controls will be returned to the player. Next, we will tell the server to allow the player to spawn.&lt;br /&gt;
&lt;br /&gt;
===Triggering the server===&lt;br /&gt;
Triggering the server can be done using [[triggerServerEvent]]. This allows you to trigger a specified event on the server from the client. The same can be done in reverse using [[triggerClientEvent]].&lt;br /&gt;
Here, we use the [[triggerServerEvent]] function to call our own custom event on the server, named &amp;quot;submitLogin&amp;quot;, which will then control the spawning of the player serverside.&lt;br /&gt;
&lt;br /&gt;
'''Note that we are now writing more code for our existing 'clientSubmitLogin' function. This is not a new function and is meant to replace what you already have.''' &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function clientSubmitLogin(button,state)&lt;br /&gt;
	if button == &amp;quot;left&amp;quot; and state == &amp;quot;up&amp;quot; then&lt;br /&gt;
		-- get the text entered in the 'username' field&lt;br /&gt;
		local username = guiGetText(edtUser)&lt;br /&gt;
		-- get the text entered in the 'password' field&lt;br /&gt;
		local password = guiGetText(edtPass)&lt;br /&gt;
&lt;br /&gt;
		-- if the username and password both exist&lt;br /&gt;
		if username and password then&lt;br /&gt;
			-- trigger the server event 'submitLogin' and pass the username and password to it&lt;br /&gt;
			triggerServerEvent(&amp;quot;submitLogin&amp;quot;, getRootElement(), username, password)&lt;br /&gt;
&lt;br /&gt;
			-- hide the gui, hide the cursor and return control to the player&lt;br /&gt;
			guiSetInputEnabled(false)&lt;br /&gt;
			guiSetVisible(wdwLogin, false)&lt;br /&gt;
			showCursor(false)&lt;br /&gt;
		else&lt;br /&gt;
			-- otherwise, output a message to the player, do not trigger the server&lt;br /&gt;
			-- and do not hide the gui&lt;br /&gt;
			outputChatBox(&amp;quot;Please enter a username and password.&amp;quot;)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Creating the serverside event===&lt;br /&gt;
At this point we now have all the code needed on the client side, so open up your serverside 'script.lua' file (from the [[Scripting Introduction|Introduction to Scripting]]) or another suitable serverside file to work with.&lt;br /&gt;
&lt;br /&gt;
On the server side, recall that we are spawning the player as soon as they login.&lt;br /&gt;
So, first of all, we will need to define the custom event that we used before on the client. This can be done using [[addEvent]] and [[addEventHandler]].&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- create our loginHandler function, with username and password parameters (passed from the client gui)&lt;br /&gt;
function loginHandler(username,password)&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- define our custom event, and allow it to be triggered from the client ('true')&lt;br /&gt;
addEvent(&amp;quot;submitLogin&amp;quot;,true)&lt;br /&gt;
-- add an event handler so that when submitLogin is triggered, the function loginHandler is called&lt;br /&gt;
addEventHandler(&amp;quot;submitLogin&amp;quot;,root,loginHandler)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Logging in===&lt;br /&gt;
Now we have a function that is called through the custom event 'submitLogin', we can start to work on logging in and spawning the player, using our 'loginHandler' function:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function loginHandler(username,password)&lt;br /&gt;
	-- check that the username and password are correct&lt;br /&gt;
	if username == &amp;quot;user&amp;quot; and password == &amp;quot;apple&amp;quot; then&lt;br /&gt;
		-- the player has successfully logged in, so spawn them&lt;br /&gt;
		if (client) then&lt;br /&gt;
			spawnPlayer(client, 1959.55, -1714.46, 10)&lt;br /&gt;
			fadeCamera(client, true)&lt;br /&gt;
                        setCameraTarget(client, client)&lt;br /&gt;
			outputChatBox(&amp;quot;Welcome to My Server.&amp;quot;, client)&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		-- if the username or password are not correct, output a message to the player&lt;br /&gt;
		outputChatBox(&amp;quot;Invalid username and password. Please re-connect and try again.&amp;quot;,client)&lt;br /&gt;
        end			&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEvent(&amp;quot;submitLogin&amp;quot;,true)&lt;br /&gt;
addEventHandler(&amp;quot;submitLogin&amp;quot;,root,loginHandler)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
'''For the purposes of this tutorial, a very basic username and password system is shown. For a more comprehensive alternative, you can use the Account System or a MySQL database.'''&lt;br /&gt;
&lt;br /&gt;
Also note the use of the variable &amp;quot;client&amp;quot;, it's an internal variable used by MTA to identify the player who triggered the event. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, do not forget to include the new gui.lua file in the meta.xml of the main resource, and label it as a client script:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;client/gui.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At this point, we now have a basic login window that checks the player's username and password when the login button is clicked. If they are correct, the player is automatically spawned.&lt;br /&gt;
&lt;br /&gt;
For further help with GUI, see the [[:Category:GUI_Tutorials|GUI tutorials]].&lt;br /&gt;
&lt;br /&gt;
[[Category:GUI_Tutorials]]&lt;br /&gt;
[[it:Introduzione_allo_scripting_della_GUI]]&lt;br /&gt;
[[ru:Introduction to Scripting the GUI]]&lt;/div&gt;</summary>
		<author><name>Gaetan Piette</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=User:Rouche&amp;diff=26914</id>
		<title>User:Rouche</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=User:Rouche&amp;diff=26914"/>
		<updated>2011-08-27T16:20:59Z</updated>

		<summary type="html">&lt;p&gt;Gaetan Piette: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Name : Gaëtan&amp;lt;br&amp;gt;&lt;br /&gt;
Age : 20 Ans&amp;lt;br&amp;gt;&lt;br /&gt;
Live in Belgium&amp;lt;br&amp;gt;&lt;br /&gt;
Langages : French and English&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
MTA:SA&amp;lt;br&amp;gt;&lt;br /&gt;
- Owner of =KoG=Team (2 Servers)&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Website : [http://www.teamkog.tk Team =KoG=]&lt;br /&gt;
&lt;br /&gt;
Help Community :&amp;lt;br&amp;gt;&lt;br /&gt;
Translate : MTA:SA Wiki (French).&lt;/div&gt;</summary>
		<author><name>Gaetan Piette</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=User:Rouche&amp;diff=26912</id>
		<title>User:Rouche</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=User:Rouche&amp;diff=26912"/>
		<updated>2011-08-27T16:14:57Z</updated>

		<summary type="html">&lt;p&gt;Gaetan Piette: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Name : Gaëtan&amp;lt;br&amp;gt;&lt;br /&gt;
Age : 20 Ans&amp;lt;br&amp;gt;&lt;br /&gt;
Live in Belgium&amp;lt;br&amp;gt;&lt;br /&gt;
Langages : French and English&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
MTA:SA&amp;lt;br&amp;gt;&lt;br /&gt;
- Owner of =KoG=Team (2 Servers)&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Help Community :&amp;lt;br&amp;gt;&lt;br /&gt;
Translate : MTA:SA Wiki (French).&lt;/div&gt;</summary>
		<author><name>Gaetan Piette</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=User:Rouche&amp;diff=26911</id>
		<title>User:Rouche</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=User:Rouche&amp;diff=26911"/>
		<updated>2011-08-27T16:14:35Z</updated>

		<summary type="html">&lt;p&gt;Gaetan Piette: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Name : Gaëtan&amp;lt;br&amp;gt;&lt;br /&gt;
Age : 20 Ans&lt;br /&gt;
Live in Belgium&lt;br /&gt;
Langages : French and English&lt;br /&gt;
&lt;br /&gt;
MTA:SA&lt;br /&gt;
- Owner of =KoG=Team (2 Servers)&lt;br /&gt;
&lt;br /&gt;
Help Community :&lt;br /&gt;
Translate : MTA:SA Wiki (French).&lt;/div&gt;</summary>
		<author><name>Gaetan Piette</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=User:Rouche&amp;diff=26910</id>
		<title>User:Rouche</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=User:Rouche&amp;diff=26910"/>
		<updated>2011-08-27T16:14:19Z</updated>

		<summary type="html">&lt;p&gt;Gaetan Piette: Created page with &amp;quot;Name : Gaëtan Age : 20 Ans Live in Belgium Langages : French and English  MTA:SA - Owner of =KoG=Team (2 Servers)  Help Community : Translate : MTA:SA Wiki (French).&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Name : Gaëtan&lt;br /&gt;
Age : 20 Ans&lt;br /&gt;
Live in Belgium&lt;br /&gt;
Langages : French and English&lt;br /&gt;
&lt;br /&gt;
MTA:SA&lt;br /&gt;
- Owner of =KoG=Team (2 Servers)&lt;br /&gt;
&lt;br /&gt;
Help Community :&lt;br /&gt;
Translate : MTA:SA Wiki (French).&lt;/div&gt;</summary>
		<author><name>Gaetan Piette</name></author>
	</entry>
</feed>