Alexs Posted July 22, 2012 Posted July 22, 2012 Estaba viendo en la wiki los gamemode y muestra este ejemplo function startCtfMap( startedMap ) -- startedMap contains a reference to the resource of the map local mapRoot = getResourceRootElement( startedMap ) -- get the root node of the started map local flagElements = getElementsByType ( "flag" , mapRoot ) -- get all flags in the map and store them in a table -- go on loading information like in the example above -- spawn players etc. end addEventHandler("onGamemodeMapStart", getRootElement(), startCtfMap) Pero en la wiki no hay datos sobre ese Evento, quien sabe sobre el y sus argumentos??
Castillo Posted July 22, 2012 Posted July 22, 2012 Eso es porque el recurso: "mapmanager" crea ese evento, no es nativo del MTA. El unico argumento que veo es el recurso iniciado.
Alexs Posted July 22, 2012 Author Posted July 22, 2012 Y si quiero que al comenzarse un mapa de un gamemode se detenga el anterior, q se hace?
Alexs Posted July 22, 2012 Author Posted July 22, 2012 En eso mismo estaba pensando, mas adelante vere, una ultima duda: function getDefinitions( startedMap ) local equipo = getPlayerTeam( local mapRoot = getResourceRootElement( startedMap ) local spawnred = getElementsByType ( "spawnred" , mapRoot ) local spawnblue = getElementsByType ( "spawnblue" , mapRoot ) for key, rojo in pairs( spawnred ) do posred = getElementData ( rojo, "position" ) rotred = getElementData ( rojo, "rotation" ) end for key, azul in pairs( spawnblue ) do posblue = getElementData ( azul, "position" ) rotblue = getElementData ( azul, "rotation" ) end end addEventHandler("onGamemodeMapStart", getRootElement(), getDefinitions) Que argumento uso para el jugador? pensaba en otro loop como este: local jugadores = getElementsByType ( "player") for key, jugador in pairs( jugadores ) do if ( getTeamName(getPlayerTeam(jugador))== "Red") then --Aca el spawn y el argumento de jugador seria "jugador" Estaria bien?
Recommended Posts