Jump to content

duda con OnGamemodeMapStart


Alexs

Recommended Posts

Posted

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??

Developer @ MYVAL

Posted

Eso es porque el recurso: "mapmanager" crea ese evento, no es nativo del MTA.

El unico argumento que veo es el recurso iniciado.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Yo pensaba que era automatico.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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?

Developer @ MYVAL

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...