zocken212 Posted November 9, 2013 Share Posted November 9, 2013 Hello, I want to create a custom EDF. Until now it worked fine, it gets the X,Y,Z and rotation X,Y,Z but not the vehicle ID. First the EDF: (copied most from race) <def name ="Shooter"> <element name = "spawnpoint" friendlyname = "Shooter Spawnpoint"> <data name = "position" type = "coord3d" required = "true" default = "0,0,0"/> <data name = "rotation" type = "coord3d" required = "true" default = "0,0,0"/> <data name = "vehicle" type = "vehicleID" default = "522"/> <vehicle model="!vehicle!" rotation="!rotation!"/> </element> </def> Now the code where I get the data from the spawnpoint: function getRandomSpawnPoint() local random = nil for index, p in pairs(getElementsByType("spawnpoint")) do if p ~= nil then local toRandom = math.random(#getElementsByType("spawnpoint")) if index == toRandom then local x,y,z = getElementPosition(p) local model = getElementModel(p) random = { x = x, y = y, z = z, model = model} toRandom = nil break end end end return random end local test = getRandomSpawnPoint() outputChatBox(tostring(test.model)) Where is my problem? Edit: local model = getElementData(p,"vehicle") works somehow, but just tried it now lol.. If there is another way, you can tell it me 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