The_Ex Posted June 24, 2009 Share Posted June 24, 2009 (edited) 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 June 26, 2009 by Guest Link to comment
The_Ex Posted June 24, 2009 Author Share Posted June 24, 2009 Ok, i added id="[teamname]" for teams to .map file and used getElementByID(teamName) for getting the right team. Looks like it works fine but i'm still looking for better/easier solution if one exists. Link to comment
50p Posted June 24, 2009 Share Posted June 24, 2009 There is no better solution than using IDs. Link to comment
darkdreamingdan Posted June 24, 2009 Share Posted June 24, 2009 The "name" parameter is hardcoded. You should be able to use getTeamFromName. Link to comment
The_Ex Posted June 26, 2009 Author Share Posted June 26, 2009 Didn't want to make new topic so i'll ask here. Does blip visibleDistance really work? I created some blips but visibleDistance doesn't work. Link to comment
Mr.Hankey Posted June 26, 2009 Share Posted June 26, 2009 as the wiki says that argument is only available from version 1.0 onwards so in dp2.3 it doesn't work Link to comment
The_Ex Posted June 26, 2009 Author Share Posted June 26, 2009 i'm using nightly builds, so it should work, huh? ordering(which is also 1.0 onwards) works fine for me. Link to comment
eAi Posted June 27, 2009 Share Posted June 27, 2009 Please report it on the bug tracker, along with some code that reproduces it. http://bugs.mtasa.com Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now