Jump to content

[Help]Table Problem


3B00DG4MER

Recommended Posts

Posted

Hello,Today I've made a Marker which Create Random,from table

Can u fix this plz ?!

mine_pos =
{
   {271.94140625, 1350.1923828125, 10.5859375},
   {275.94140625, 1350.1923828125, 10.5859375},
}
   mineplace = createMarker(mine_pos[1],mine_pos[2],mine_pos[3])

Posted
  
local mine_pos = { 
    {271.94140625, 1350.1923828125, 10.5859375}, 
    {275.94140625, 1350.1923828125, 10.5859375} 
} 
local n = math.random(1,#mine_pos) 
local mineplace = createMarker(mine_pos[n][1],mine_pos[n][2],mine_pos[n][3]) 
  

Posted
  
local mine_pos = { 
    {271.94140625, 1350.1923828125, 10.5859375}, 
    {275.94140625, 1350.1923828125, 10.5859375} 
} 
local n = math.random(1,#mine_pos) 
local mineplace = createMarker(mine_pos[n][1],mine_pos[n][2],mine_pos[n][3]) 
  

Thanks it's working

Posted

If you want a quicker version, you could use this(it's up to you though, maybe you prefer the easier to understand one)

mine_pos = 
{ 
{271.94140625, 1350.1923828125, 10.5859375}, 
{275.94140625, 1350.1923828125, 10.5859375}, 
} 
mineplace = createMarker(unpack(minepos[math.random(#mine_pos)])) 

This will only work if you keep the arrays x, y, z coordinates only though.

Posted
If you want a quicker version, you could use this(it's up to you though, maybe you prefer the easier to understand one)
mine_pos = 
{ 
{271.94140625, 1350.1923828125, 10.5859375}, 
{275.94140625, 1350.1923828125, 10.5859375}, 
} 
mineplace = createMarker(unpack(minepos[math.random(#mine_pos)])) 

This will only work if you keep the arrays x, y, z coordinates only though.

Thanks

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...