Jump to content

createBlip en tablas


BorderLine

Recommended Posts

Buenas noches, tengo una consulta, a ver si alguien puede ayudarme.

Tengo esta tabla y quisiera ponerle un createBlip para cada marker.

local shopMarkers = { 
createMarker (815.5,-1107.5,24.7,"cylinder",2,255,255,225,100), 
createMarker (2797.5,-1465.6,19.218,"cylinder",2,255,255,225,100), 
createMarker (-1116.8, -1625.9, 75.367,"cylinder",2,255,255,225,100), 
createMarker (-551.5, -197.5, 77.40,"cylinder",2,255,255,225,100), 
createMarker (2162.1, -103.7, 1.75,"cylinder",2,255,255,225,100), 
createMarker (2565, 785.6, 4.31,"cylinder",2,255,255,225,100), 
createMarker (2117.7, 2416.2, 14.11,"cylinder",2,255,255,225,100), 
createMarker (1092, 2108.3, 14.35,"cylinder",2,255,255,225,100), 
createMarker (-774.4, 2422.6, 156.09,"cylinder",2,255,255,225,100), 
createMarker (263.5, 2896.8, 9,"cylinder",2,255,255,225,100), 
createMarker (-733.5, 1545.6, 38.05,"cylinder",2,255,255,225,100), 
createMarker ( -2826.1, 2179.6, 176.67,"cylinder",2,255,255,225,100), 
createMarker ( -1466.2, 340.3, 6.18,"cylinder",2,255,255,225,100), 
createMarker ( -2815.9, -1528.1, 139.84,"cylinder",2,255,255,225,100), 
createMarker ( -2280.9, 2404.2, 3.94,"cylinder",2,255,255,225,100), 
createMarker ( -329.9, 1528.4, 74.3,"cylinder",2,255,255,225,100), 
createMarker ( -2344.8, -1645.9, 482.7,"cylinder",2,255,255,225,100), 
createMarker ( -1294, 2521, 86.3,"cylinder",2,150,150,150,200), 
createMarker ( 1045, -293, 76.3,"cylinder",2,150,150,150,200), 
createMarker ( 1152, -2061, 68,"cylinder",2,150,150,150,200), 
createMarker ( 1148, -2061, 68,"cylinder",2,150,150,150,200) 
} 
  

De antemano muchas gracias :)

Link to comment
local shopMarkers = { 
{815.5,-1107.5,24.7,"cylinder",2,255,255,225,100}, 
{2797.5,-1465.6,19.218,"cylinder",2,255,255,225,100}, 
{-1116.8, -1625.9, 75.367,"cylinder",2,255,255,225,100}, 
{-551.5, -197.5, 77.40,"cylinder",2,255,255,225,100}, 
{2162.1, -103.7, 1.75,"cylinder",2,255,255,225,100}, 
{2565, 785.6, 4.31,"cylinder",2,255,255,225,100}, 
{2117.7, 2416.2, 14.11,"cylinder",2,255,255,225,100}, 
{1092, 2108.3, 14.35,"cylinder",2,255,255,225,100}, 
{-774.4, 2422.6, 156.09,"cylinder",2,255,255,225,100}, 
{263.5, 2896.8, 9,"cylinder",2,255,255,225,100}, 
{-733.5, 1545.6, 38.05,"cylinder",2,255,255,225,100}, 
{ -2826.1, 2179.6, 176.67,"cylinder",2,255,255,225,100}, 
{ -1466.2, 340.3, 6.18,"cylinder",2,255,255,225,100}, 
{ -2815.9, -1528.1, 139.84,"cylinder",2,255,255,225,100}, 
{ -2280.9, 2404.2, 3.94,"cylinder",2,255,255,225,100}, 
{ -329.9, 1528.4, 74.3,"cylinder",2,255,255,225,100}, 
{ -2344.8, -1645.9, 482.7,"cylinder",2,255,255,225,100}, 
{ -1294, 2521, 86.3,"cylinder",2,150,150,150,200}, 
{ 1045, -293, 76.3,"cylinder",2,150,150,150,200}, 
{ 1152, -2061, 68,"cylinder",2,150,150,150,200}, 
{ 1148, -2061, 68,"cylinder",2,150,150,150,200}, 
} 
  
for k , data in pairs (shopMarkers) do 
local posx = data[1] 
local posy = data[2] 
local posz = data[3] 
local tipe = data[4] 
local size = data[5] 
local r, g, b, a = unpack{data[6], data[7], data[8],data[9]} 
createMarker (posx, posy, posz, tipe, size, r, g, b, a) 
createBlip( posx, posy, posz ) -- tu lo completas 
end 

Link to comment
local shopMarkers = { 
{815.5,-1107.5,24.7,"cylinder",2,255,255,225,100}, 
{2797.5,-1465.6,19.218,"cylinder",2,255,255,225,100}, 
{-1116.8, -1625.9, 75.367,"cylinder",2,255,255,225,100}, 
{-551.5, -197.5, 77.40,"cylinder",2,255,255,225,100}, 
{2162.1, -103.7, 1.75,"cylinder",2,255,255,225,100}, 
{2565, 785.6, 4.31,"cylinder",2,255,255,225,100}, 
{2117.7, 2416.2, 14.11,"cylinder",2,255,255,225,100}, 
{1092, 2108.3, 14.35,"cylinder",2,255,255,225,100}, 
{-774.4, 2422.6, 156.09,"cylinder",2,255,255,225,100}, 
{263.5, 2896.8, 9,"cylinder",2,255,255,225,100}, 
{-733.5, 1545.6, 38.05,"cylinder",2,255,255,225,100}, 
{ -2826.1, 2179.6, 176.67,"cylinder",2,255,255,225,100}, 
{ -1466.2, 340.3, 6.18,"cylinder",2,255,255,225,100}, 
{ -2815.9, -1528.1, 139.84,"cylinder",2,255,255,225,100}, 
{ -2280.9, 2404.2, 3.94,"cylinder",2,255,255,225,100}, 
{ -329.9, 1528.4, 74.3,"cylinder",2,255,255,225,100}, 
{ -2344.8, -1645.9, 482.7,"cylinder",2,255,255,225,100}, 
{ -1294, 2521, 86.3,"cylinder",2,150,150,150,200}, 
{ 1045, -293, 76.3,"cylinder",2,150,150,150,200}, 
{ 1152, -2061, 68,"cylinder",2,150,150,150,200}, 
{ 1148, -2061, 68,"cylinder",2,150,150,150,200}, 
} 
  
for k , data in pairs (shopMarkers) do 
local posx = data[1] 
local posy = data[2] 
local posz = data[3] 
local tipe = data[4] 
local size = data[5] 
local r, g, b, a = unpack{data[6], data[7], data[8],data[9]} 
createMarker (posx, posy, posz, tipe, size, r, g, b, a) 
createBlip( posx, posy, posz ) -- tu lo completas 
end 

Podrías ahorrar te lineas con esto:

Tabla = {}

Cantidad = 0

For i, v in ipairs do

cantidad = cantidad + 1

Tabla[cantidad]Print(v[1], v[2])

end

Así le aprendí un ejemplo que me dio Tomas , y se crean todas, solo pone las posiciones y mas valores a la tabla.

PD: Ando en teléfono perdón si puse el código así no mas suelto.

Link to comment
local shopMarkers = { 
{815.5,-1107.5,24.7,"cylinder",2,255,255,225,100}, 
{2797.5,-1465.6,19.218,"cylinder",2,255,255,225,100}, 
{-1116.8, -1625.9, 75.367,"cylinder",2,255,255,225,100}, 
{-551.5, -197.5, 77.40,"cylinder",2,255,255,225,100}, 
{2162.1, -103.7, 1.75,"cylinder",2,255,255,225,100}, 
{2565, 785.6, 4.31,"cylinder",2,255,255,225,100}, 
{2117.7, 2416.2, 14.11,"cylinder",2,255,255,225,100}, 
{1092, 2108.3, 14.35,"cylinder",2,255,255,225,100}, 
{-774.4, 2422.6, 156.09,"cylinder",2,255,255,225,100}, 
{263.5, 2896.8, 9,"cylinder",2,255,255,225,100}, 
{-733.5, 1545.6, 38.05,"cylinder",2,255,255,225,100}, 
{ -2826.1, 2179.6, 176.67,"cylinder",2,255,255,225,100}, 
{ -1466.2, 340.3, 6.18,"cylinder",2,255,255,225,100}, 
{ -2815.9, -1528.1, 139.84,"cylinder",2,255,255,225,100}, 
{ -2280.9, 2404.2, 3.94,"cylinder",2,255,255,225,100}, 
{ -329.9, 1528.4, 74.3,"cylinder",2,255,255,225,100}, 
{ -2344.8, -1645.9, 482.7,"cylinder",2,255,255,225,100}, 
{ -1294, 2521, 86.3,"cylinder",2,150,150,150,200}, 
{ 1045, -293, 76.3,"cylinder",2,150,150,150,200}, 
{ 1152, -2061, 68,"cylinder",2,150,150,150,200}, 
{ 1148, -2061, 68,"cylinder",2,150,150,150,200}, 
} 
  
for k , data in pairs (shopMarkers) do 
local posx = data[1] 
local posy = data[2] 
local posz = data[3] 
local tipe = data[4] 
local size = data[5] 
local r, g, b, a = unpack{data[6], data[7], data[8],data[9]} 
createMarker (posx, posy, posz, tipe, size, r, g, b, a) 
createBlip( posx, posy, posz ) -- tu lo completas 
end 

Podrías ahorrar te lineas con esto:

Tabla = {}

Cantidad = 0

For i, v in ipairs do

cantidad = cantidad + 1

Tabla[cantidad]Print(v[1], v[2])

end

Así le aprendí un ejemplo que me dio Tomas , y se crean todas, solo pone las posiciones y mas valores a la tabla.

PD: Ando en teléfono perdón si puse el código así no mas suelto.

En este caso ese ejemplo no serviría ya que son todos valores distintos.

Link to comment

No hace falta complicarse tanto.

local shopMarkers = { 
{815.5,-1107.5,24.7,"cylinder",2,255,255,225,100}, 
{2797.5,-1465.6,19.218,"cylinder",2,255,255,225,100}, 
{-1116.8, -1625.9, 75.367,"cylinder",2,255,255,225,100}, 
{-551.5, -197.5, 77.40,"cylinder",2,255,255,225,100}, 
{2162.1, -103.7, 1.75,"cylinder",2,255,255,225,100}, 
{2565, 785.6, 4.31,"cylinder",2,255,255,225,100}, 
{2117.7, 2416.2, 14.11,"cylinder",2,255,255,225,100}, 
{1092, 2108.3, 14.35,"cylinder",2,255,255,225,100}, 
{-774.4, 2422.6, 156.09,"cylinder",2,255,255,225,100}, 
{263.5, 2896.8, 9,"cylinder",2,255,255,225,100}, 
{-733.5, 1545.6, 38.05,"cylinder",2,255,255,225,100}, 
{ -2826.1, 2179.6, 176.67,"cylinder",2,255,255,225,100}, 
{ -1466.2, 340.3, 6.18,"cylinder",2,255,255,225,100}, 
{ -2815.9, -1528.1, 139.84,"cylinder",2,255,255,225,100}, 
{ -2280.9, 2404.2, 3.94,"cylinder",2,255,255,225,100}, 
{ -329.9, 1528.4, 74.3,"cylinder",2,255,255,225,100}, 
{ -2344.8, -1645.9, 482.7,"cylinder",2,255,255,225,100}, 
{ -1294, 2521, 86.3,"cylinder",2,150,150,150,200}, 
{ 1045, -293, 76.3,"cylinder",2,150,150,150,200}, 
{ 1152, -2061, 68,"cylinder",2,150,150,150,200}, 
{ 1148, -2061, 68,"cylinder",2,150,150,150,200}, 
} 
  
for i = 1, #shopMarkers do 
    local data = shopMarkers[i] 
    createMarker(data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8], data[9]) 
    createBlip(data[1], data[2], data[3], 51) 
end 

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...