Jump to content

explain me please


Wei

Recommended Posts

local theTable = { 
[1]={1812.65198, -1889.86047, 13.41406}, 
[2]={1825.22791, -1635.03711, 13.38281}, 
[3]={1855.01685, -1430.47449, 13.39063}, 
[4]={1732.81580, -1296.87122, 13.44294}, 
[5]={1473.19226, -1295.77124, 13.48315}, 
} 

This is the table

how can I make when player hits a maker it destroys marker id 1 and show the marker ID 2?

Sory but I don't know anything about tables.

Link to comment
local theTable = 
    { 
        [ 1 ] = { 1812.65198, -1889.86047, 13.41406 }, 
        [ 2 ] = { 1825.22791, -1635.03711, 13.38281 }, 
        [ 3 ] = { 1855.01685, -1430.47449, 13.39063 }, 
        [ 4 ] = { 1732.81580, -1296.87122, 13.44294 }, 
        [ 5 ] = { 1473.19226, -1295.77124, 13.48315 } 
    } 
  
function getMarkerPositionFromIndex ( index ) 
    local index = ( tonumber ( index ) or 1 ) 
    if ( theTable [ index ] ) then 
        return unpack ( theTable [ index ] ) 
    end 
  
    return false 
end 

You must set element data on the player and increase it every time you hit the marker, and create the new marker with the position returned from: getMarkerPositionFromIndex.

Link to comment

P.S Define indexes is optional in table

  
local Array =  
{ 
    { '1' }; 
    [ 2 ] = { [ 1 ] = '2' }; 
} 
  
print( Array[ 1 ][ 1 ] ) -- 1 
print( Array[ 2 ][ 1 ] ) -- 2 
  

Index auto-defined from 1.

Link to comment

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