BieHDC Posted August 22, 2013 Share Posted August 22, 2013 Hello, i wanted to know how to get the spawnpoint id from a map file the id is given from a string... ...but how to get this string Because if the string is in this example "THEID" i wanna do some sets for this. i have already found !getElementsByType("spawnpoint")! , but i think this wont be neccersary edit: or tell me how to use the full string like... vehicle, x, y, z, rx, ry, rz = ineedsomeinfo ( THEID ) Please help me, thankes Link to comment
Castillo Posted August 22, 2013 Share Posted August 22, 2013 Try this: local element = getElementByID ( "THEID" ) if isElement ( element ) then local allData = getAllElementData ( element ) for data, value in pairs ( allData ) do outputChatBox ( data ..": ".. value ) end end Link to comment
BieHDC Posted August 23, 2013 Author Share Posted August 23, 2013 And with this i can get the Data out of a map file? Link to comment
./BlackBird# Posted August 23, 2013 Share Posted August 23, 2013 function getMapData(data,valueData) if ( data and valueData ) then for i,v in ipairs(getElementsByType(data)) do if ( v ) then local value = getElementData(v,valueData) if ( value ) then return value else return outputDebugString("Bad Argument value data .",1) end else return outputDebugString("Bad Argument data .",1) end end else return outputDebugString("Please Add data / value data .",1) end end id = getMapData("spawnpoint","id") vehicle = getMapData("spawnpoint","vehicle") posX = getMapData("spawnpoint","posX") posY = getMapData("spawnpoint","posY") posZ= getMapData("spawnpoint","posZ") rotX = getMapData("spawnpoint","rotX") rotY = getMapData("spawnpoint","rotY") rotZ = getMapData("spawnpoint","rotZ") outputChatBox("Id = "..id.." vehicle = "..vehicle.." posX = "..posX.." posY = "..posY.." posZ = "..posZ.." rotX = "..rotX.." rotY = "..rotY.." rotZ = "..rotZ Link to comment
BieHDC Posted August 23, 2013 Author Share Posted August 23, 2013 ok thx i will try this edit: but i wanna get the vehicle, posx ... from spawnpoint id but what you wrote is only to get all spawnpoints and all data from them Link to comment
Castillo Posted August 23, 2013 Share Posted August 23, 2013 My script didn't work? it should get all the data of the specified element. Link to comment
BieHDC Posted August 23, 2013 Author Share Posted August 23, 2013 havent had time to try out sry :c will do tomorror 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