Resource:Mapmanager: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Undo revision 50256 by Toffykozak (talk))
No edit summary
Line 1: Line 1:
{{Resource page}}
=POGROMCA PSEUDOLI, KRUL BONZO POWRACA KURWY=
The map manager is a resource included in the MTA DM server suite. It offers commands, functions and events for the gamemodes to dynamically manage their maps. For example, when a race server needs to load different tracks for each race, instead of having all of them in the same resource as the main script, they can be stored in separate resources and then loaded simply with the "changeGamemodeMap" function when a new race starts.
==JEBANE KURWY==
 
===.WhiteBlue===
Specifically, the map manager lists gamemodes/maps and manages gamemode/map loading. It applies certain map settings affecting the game world and sets ASE game type and map name rule values as well. It includes a web listing which auto updates and highlights the current mode/map combination.
Autor tego zjebanego gamemode OGRPG przez który dzieci podpierdalają kase rodzicom i zabijają się wzajemnie o stworzenie lepszego pseudola.<br>
 
gtao.pl/whiteblue,u,80095.htm
==A simple tutorial==
===Ciastuuś===
In this section we are going to continue the basic gamemode we created in the [[Scripting Introduction|Introduction to Scripting]]. We will add a simple map resource that only contains the spawnpoint data for the players, and load the data in the main script when the player needs to spawn.
Z tym gościem od lua lepiej nie zadzierać. Zatrzymał się w rozwoju 10 lat temu i myśli, że moduł MySQL jest nadal zajebisty.<br>
 
gtao.pl/ciastuus,u,87450.htm
First of all, we make a folder under /Your MTA Server/mods/deathmatch/resources/, and name it "mymap". Then under /mymap/ directory, create a text file and name it "meta.xml", which is required for every resource.
===Emm===
 
Szkoda nawet kurwa gadać o tym typie.<br>
Enter the following codes in the ''meta.xml'' file:
gtao.pl/emm,u,76072.htm
<syntaxhighlight lang="xml">
===luki123luki123===
<meta>
Chyba każdy go zna ze swoich nieukończonych projektów. Mistrz od paneli logowania. Byłyby całkiem ładne, gdyby nie to że są chujowe.<br>
  <info type="map" gamemodes="myserver"/>
gtao.pl/luki123luki123,u,46179.htm
  <map src="mymap.map"/>
===NyAngel===
</meta>
Liczniki nówki sztuki za 10zł. Jeszcze żaden pseudol nie używał.<br>
</syntaxhighlight>
gtao.pl/nyangel,u,75320.htm
Note that this resource is "linked" to the main resource with the ''gamemodes=""'' tag, which contains the name of the main resource. In the ''map'' tag, it indicates the name of the .map file which contains the actual map data.
===_Haze===
 
Marzył o zostaniu hakerem jak słynny hustolier, ale mu nie wyszło.<br>
Now let's create another text file under /mymap/ and name it "mymap.map", and enter the following codes:
gtao.pl/_haze,u,71303.htm
<syntaxhighlight lang="xml">
===TRIN===
<map>
Wszyscy wiemy, że to nasz kochany TRIN. Zmiana nicku go nie ukryje.<br>
  <spawnpoint id="spawnpoint1" posX="1959.5487060547" posY="-1714.4613037109" posZ="18" rot="63.350006103516" model="0"/>
gtao.pl/papasmerf,u,81160.htm
</map>
===STOPseba===
</syntaxhighlight>
Naprawdę przykro mi że twój pseudol upadł.<br>
Note that "spawnpoint" is the type of the element, used in [[getElementsByType]] function; likewise, "id" is used in [[getElementByID]] function.  
gtao.pl/stopseba,u,77586.htm
 
==Wpisując swojego pseudola na tą listę możesz liczyć na moją wizytę.==
To load the map data, the main script needs access to the map resource itself. Now let's edit the script.lua file in "myserver" resource. Enter the following code:
gtao.pl/reklamy-serwerow-mta-vf100.htm
 
<syntaxhighlight lang="lua">
function loadMap(startedMap)
mapRoot = getResourceRootElement(startedMap)
end
 
addEventHandler("onGamemodeMapStart", getRootElement(), loadMap)
</syntaxhighlight>
Basically, the "onGamemodeMapStart" event gives us the handle of the map ("startedMap"), which we used to extract the handle of the resource containing the map ("mapRoot").
 
With the resource handle, we can extract the spawnpoint information from it. Look at the joinHandler() function in script.lua, instead of specifying x, y and z, we can use the map data as the following:
<syntaxhighlight lang="lua">
function joinHandler()
local spawn = getElementsByType("spawnpoint", mapRoot)
local x,y,z,r
for key, value in pairs(spawn) do
x = getElementData(value, "posX")
y = getElementData(value, "posY")
z = getElementData(value, "posZ")
r = getElementData(value, "rot")
end
spawnPlayer(source, x, y, z)
fadeCamera(source, true)
end
</syntaxhighlight>
Now you may start the gamemode in the server console with the following command:
 
'''gamemode myserver mymap'''
 
==Usage==
To use the map manager, your resources must first be marked as either gamemodes or maps.
 
You have to tag the '''gamemode resource''' with the correct type in its info tag:
<syntaxhighlight lang="xml"><info description="A gamemode" type="gamemode" /></syntaxhighlight>
 
'''Map resources''' also need the ''type="map"'' tag, plus a ''gamemodes'' tag listing the gamemode resources they're compatible with in a comma-separated list ''without spaces''.
<syntaxhighlight lang="xml"><info description="A gamemode map" type="map" gamemodes="ctv,koth" /></syntaxhighlight>
 
There can be only one gamemode and one gamemode map loaded at once.
 
==Optional resource attributes==
These attributes all go in the corresponding resource's info tag.
 
'''name:''' A friendly name for your gamemode or map, to be displayed in the start messages or map listings instead of the filename.
 
==Commands==
'''changemap newmap [newgamemode]''' (changes the gamemode map to a new one, optionally changing the gamemode as well)
 
'''changemode newgamemode [newmap]''' (changes to a new gamemode, optionally starting a map with it)
 
'''gamemode newgamemode [newmap]''' (same as previous one)
 
'''stopmode''' (stops the current mode and mode map)
 
'''stopmap''' (stops the current mode map)
 
'''maps [gamemode]''' (lists all maps in the server, optionally all maps compatible with a gamemode)
 
'''gamemodes''' (lists all gamemodes)
 
==Settings==
'''*mapmanager.color''' [hex color string] (changes the mapmanager's output messages' color) (default: #E1AA5A)
 
'''*mapmanager.messages''' [boolean] (whether map/gm changes are enabled) (default: true)
 
'''*mapmanager.ASE''' [boolean] (whether the manager will set ASE gametype / mapname) (default: true)
 
==Exported functions==
<syntaxhighlight lang="lua">bool changeGamemode ( resource newGamemode, [ resource mapToLoadWith ] )</syntaxhighlight>
Changes the gamemode to a new one, optionally specifying an initial map for it (will load without a map by default).
<syntaxhighlight lang="lua">bool changeGamemodeMap ( resource newMap, [ resource gamemodeToChangeTo ] )</syntaxhighlight>
Changes the GM map to a new one, optionally specifying a gamemode to change to before loading it (will load with the current gamemode by default).
<syntaxhighlight lang="lua">table getGamemodes ( )</syntaxhighlight>
Returns a table of all gamemode resource pointers.
<syntaxhighlight lang="lua">table getGamemodesCompatibleWithMap ( resource theMap )</syntaxhighlight>
Returns a table of compatible gamemode resource pointers.
<syntaxhighlight lang="lua">table getMaps ( )</syntaxhighlight>
Returns a table of all map resource pointers.
<syntaxhighlight lang="lua">table getMapsCompatibleWithGamemode ( [ resource theGamemode ] )</syntaxhighlight>
Returns a table of compatible map resource pointers. If the gamemode is left blank, it returns all maps which aren't compatible with any gamemode.
<syntaxhighlight lang="lua">resource getRunningGamemode ( )</syntaxhighlight>
Returns the currently running gamemode's resource pointer.
<syntaxhighlight lang="lua">resource getRunningGamemodeMap ( )</syntaxhighlight>
Returns the currently running GM map's resource pointer.
<syntaxhighlight lang="lua">bool isGamemode ( resource theGamemode )</syntaxhighlight>
Determines if a resource is a gamemode or not.
<syntaxhighlight lang="lua">bool isGamemodeCompatibleWithMap ( resource theGamemode, resource theMap )</syntaxhighlight>
Determines if a gamemode is compatible with a map or not.
<syntaxhighlight lang="lua">bool isMap ( resource theMap )</syntaxhighlight>
Determines if a resource is a map or not.
<syntaxhighlight lang="lua">bool isMapCompatibleWithGamemode ( resource theMap, resource theGamemode )</syntaxhighlight>
Determines if a map is compatible with a gamemode or not.
<syntaxhighlight lang="lua">bool stopGamemode ( )</syntaxhighlight>
Stops the current gamemode and its map.
<syntaxhighlight lang="lua">bool stopGamemodeMap ( )</syntaxhighlight>
Stop the current GM map.
Determines if a map is compatible with a gamemode or not.
 
==Fired events==
''(For all these events, "source" is the resource's root element.)''
<syntaxhighlight lang="lua">onGamemodeStart ( resource startedGamemode )</syntaxhighlight>
Fired before a gamemode starts.
<syntaxhighlight lang="lua">onGamemodeStop ( resource stoppedGamemode )</syntaxhighlight>
Fired before a gamemode is stopped.
<syntaxhighlight lang="lua">onGamemodeMapStart ( resource startedMap )</syntaxhighlight>
Fired before a GM map starts.
<syntaxhighlight lang="lua">onGamemodeMapStop ( resource stoppedMap )</syntaxhighlight>
Fired before a GM map is stopped.
 
==Supported map settings==
The following settings from the [[settings system|registry]] are applied by the map manager when a map is started:
<br>'''gamespeed''' [number]: The map's game speed.
<br>'''gravity''' [number]: The map's gravity.
<br>'''time''' [string of the form '''hh:mm''']: The map's time.
<br>'''weather''' [number]: The map's weather ID.
<br>'''waveheight''' [number]: The map's wave height.
<br>'''locked_time''' [boolean]: Whether the set time will be frozen by the manager or not.
<br>'''minplayers''' [number]: The required minimum number of players to start the map.
<br>'''maxplayers''' [number]: The allowed maximum number of players to start the map.
 
[[it:Map manager]]
[[ru:Resource:Mapmanager]]

Revision as of 16:06, 17 March 2018

POGROMCA PSEUDOLI, KRUL BONZO POWRACA KURWY

JEBANE KURWY

.WhiteBlue

Autor tego zjebanego gamemode OGRPG przez który dzieci podpierdalają kase rodzicom i zabijają się wzajemnie o stworzenie lepszego pseudola.
gtao.pl/whiteblue,u,80095.htm

Ciastuuś

Z tym gościem od lua lepiej nie zadzierać. Zatrzymał się w rozwoju 10 lat temu i myśli, że moduł MySQL jest nadal zajebisty.
gtao.pl/ciastuus,u,87450.htm

Emm

Szkoda nawet kurwa gadać o tym typie.
gtao.pl/emm,u,76072.htm

luki123luki123

Chyba każdy go zna ze swoich nieukończonych projektów. Mistrz od paneli logowania. Byłyby całkiem ładne, gdyby nie to że są chujowe.
gtao.pl/luki123luki123,u,46179.htm

NyAngel

Liczniki nówki sztuki za 10zł. Jeszcze żaden pseudol nie używał.
gtao.pl/nyangel,u,75320.htm

_Haze

Marzył o zostaniu hakerem jak słynny hustolier, ale mu nie wyszło.
gtao.pl/_haze,u,71303.htm

TRIN

Wszyscy wiemy, że to nasz kochany TRIN. Zmiana nicku go nie ukryje.
gtao.pl/papasmerf,u,81160.htm

STOPseba

Naprawdę przykro mi że twój pseudol upadł.
gtao.pl/stopseba,u,77586.htm

Wpisując swojego pseudola na tą listę możesz liczyć na moją wizytę.

gtao.pl/reklamy-serwerow-mta-vf100.htm