Jump to content

retrieving element data + blip visible distance?[UPDATED]


The_Ex

Recommended Posts

I'm pretty new to Lua code and all the MTA functions so i have one question about element data.

For example i have declared team in .map file. How can i retrieve just one team data(by name) but not looping through all of them.

Here's part of my code:

  
function loadMap(startedMap) 
mapRoot = getResourceRootElement(startedMap) 
end 
  
local teamName = getTeamName(playerTeam) 
local team = getElementsByType("team", mapRoot) 
        for key, value in pairs(team) do 
            if(getElementData(value,"name")==teamName) then 
                        x = getElementData(value, "posX") 
                        ... 
                        end 
                end 
  

Edited by Guest
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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