xTravax Posted January 3, 2015 Share Posted January 3, 2015 hello i tried using some similiar thing -- not whole script, just an idea in here spawnpoints = { [1] = -1344.4324,609.234,13, [2] = 0,0,2 } -- later on setElementPosition(playerElement,spawnpoints[math.random(1,#spawnpoints)]) this would use just one variable of coordinate in table(?) -- anyway the place where i'd need to spawn was completely wrong how can i move a player to x,y,z position depending on random spawnpoint in table? Link to comment
Gallardo9944 Posted January 3, 2015 Share Posted January 3, 2015 spawnpoints = { [1] = {-1344.4324,609.234,13}, -- it has to be a table to contain multiple values [2] = {0,0,2}, } -- later on local x,y,z = unpack(spawnpoints[math.random(1,#spawnpoints)]) -- gets all values from the inner table setElementPosition(playerElement,x,y,z) Link to comment
Jusonex Posted January 4, 2015 Share Posted January 4, 2015 In case you enabled 1.4 OOP, you can simplify it a bit using vectors: spawnpoints = { Vector3(-1344.4324,609.234,13), Vector3(0,0,2) } -- later on setElementPosition(playerElement,spawnpoints[math.random(1,#spawnpoints)]) 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