Jump to content

tabela


Recommended Posts

Posted

ola,

eu queria saber como posso criar pickups com tabela (não sei quase nada sobre tabela).

local pistola = 
    { 
       [1] = {214.42886352539, 1866.5386962891, 13.140625 }, 
       [2] = {234.71018981934, 1935.3835449219, 33.8984375 }, 
       [3] = {311.80181884766, 1809.5435791016, 17.640625 }, 
       [4] = {280.9345703125, 1954.8565673828, 17.640625 }, 
       [5] = {246.69946289063, 1385.6153564453, 23.37028503418 }, 
       [6] = {-176.94442749023, 1149.9345703125, 19.598318099976 }, 
       [7] = {816.51824951172, 856.54290771484, 12.7890625 }, 
       [8] = {1207.6088867188, 2125.2395019531, 6.734375 }, 
       [9] = {2323.6633300781, 1283.0540771484, 97.438095092773 }, 
       [10] = {-1931.8199462891, 656.82000732422, 46.5625 }, 
       [11] = {2615.3359375, 1816.1739501953, 10.8203125 }, 
       [12] = {1764.2044677734, 2085.2583007813, 20.972038269043 }, 
       [13] = {-1381.1610107422, 493.40637207031, 27.694522857666 }, 
       [14] = {2383.6462402344, 2757.1452636719, 13.105983734131 }, 
       [15] = {1587.9537353516, 752.60015869141, 10.8203125 }, 
       [16] = {2820.8581542969, 2271.759765625, 14.661463737488 }, 
       [17] = {2314.1103515625, -4.8270263671875, 32.53125 }, 
       [18] = {1272.0865478516, 294.79476928711, 20.656307220459 }, 
       [19] = {187.23028564453, -90.492126464844, 8.8986940383911 }, 
       [20] = {-1123.1042480469, -924.32379150391, 129.21875 }, 
       [21] = {-2337.7961425781, -1617.6987304688, 483.71405029297 }, 
       [22] = {-2228.8112792969, -1744.6583251953, 480.88488769531 }, 
       [23] = {-2328.6296386719, 1537.9274902344, 17.328125 },  
       [24] = {-1633.8870849609, -2237.8508300781, 31.4765625 }, 
       [25] = {2494.7124023438, -1689.0024414063, 21.675098419189 }, 
       [26] = {2244.6433105469, -1324.0946044922, 41.259601593018 }, 
       [27] = {894.87707519531, -1453.7999267578, 21.178594589233 }, 
       [28] = {1623.6677246094, -1041.9099121094, 27.201309204102 }, 
       [29] = {387.02029418945, -2029.3041992188, 22.108934402466 }, 
       [30] = {-65.270530700684, -1587.7954101563, 2.6171875 }, 
       [31] = {-656.64978027344, -2184.2194824219, 16.19390296936 }, 
       [32] = {-429.22280883789, 1405.0031738281, 17.471927642822 }, 
       [33] = {-2413.8935546875, 802.74127197266, 35.1796875 }, 
       [34] = {-1357.7237548828, -26.7275390625, 14.1484375 } 
    } 

como posso fazer essas 34 pickups usando esta tabela?

560x95_FFFFFF_09FF00_050505_000000.png

"Querer não é poder, mas tentar é avançar"!

Posted
  
local pistola = 
    { 
       {214.42886352539, 1866.5386962891, 13.140625}, 
       {234.71018981934, 1935.3835449219, 33.8984375}, 
       {311.80181884766, 1809.5435791016, 17.640625}, 
       {280.9345703125, 1954.8565673828, 17.640625}, 
       {246.69946289063, 1385.6153564453, 23.37028503418}, 
       {-176.94442749023, 1149.9345703125, 19.598318099976}, 
       {816.51824951172, 856.54290771484, 12.7890625}, 
       {1207.6088867188, 2125.2395019531, 6.734375}, 
       {2323.6633300781, 1283.0540771484, 97.438095092773}, 
       {-1931.8199462891, 656.82000732422, 46.5625}, 
       {2615.3359375, 1816.1739501953, 10.8203125}, 
       {1764.2044677734, 2085.2583007813, 20.972038269043}, 
       {-1381.1610107422, 493.40637207031, 27.694522857666}, 
       {2383.6462402344, 2757.1452636719, 13.105983734131}, 
       {1587.9537353516, 752.60015869141, 10.8203125}, 
       {2820.8581542969, 2271.759765625, 14.661463737488}, 
       {2314.1103515625, -4.8270263671875, 32.53125}, 
       {1272.0865478516, 294.79476928711, 20.656307220459}, 
       {187.23028564453, -90.492126464844, 8.8986940383911}, 
       {-1123.1042480469, -924.32379150391, 129.21875}, 
       {-2337.7961425781, -1617.6987304688, 483.71405029297}, 
       {-2228.8112792969, -1744.6583251953, 480.88488769531}, 
       {-2328.6296386719, 1537.9274902344, 17.328125}, 
       {-1633.8870849609, -2237.8508300781, 31.4765625}, 
       {2494.7124023438, -1689.0024414063, 21.675098419189}, 
       {2244.6433105469, -1324.0946044922, 41.259601593018}, 
       {894.87707519531, -1453.7999267578, 21.178594589233}, 
       {1623.6677246094, -1041.9099121094, 27.201309204102}, 
       {387.02029418945, -2029.3041992188, 22.108934402466}, 
       {-65.270530700684, -1587.7954101563, 2.6171875}, 
       {-656.64978027344, -2184.2194824219, 16.19390296936}, 
       {-429.22280883789, 1405.0031738281, 17.471927642822}, 
       {-2413.8935546875, 802.74127197266, 35.1796875}, 
       {-1357.7237548828, -26.7275390625, 14.1484375}, 
    } 
  
do 
    for i=1, #pistola do 
        createPickup(unpack(pistola[i]), theType, amount/weapon/model) 
    end 
end 
  

Tire do se você usar o loop em uma função.

Please do not PM me with scripting related question nor support, use the forums instead.

Posted
  
function pickupsByManawydan() 
local pistola = 
    { 
       {2470.7863769531, -1698.5581054688, 13.516083717346}, 
       {2475.51953125, -1698.0883789063, 13.522142410278}, 
       {311.80181884766, 1809.5435791016, 17.640625}, 
       {280.9345703125, 1954.8565673828, 17.640625}, 
       {246.69946289063, 1385.6153564453, 23.37028503418}, 
       {-176.94442749023, 1149.9345703125, 19.598318099976}, 
       {816.51824951172, 856.54290771484, 12.7890625}, 
       {1207.6088867188, 2125.2395019531, 6.734375}, 
       {2323.6633300781, 1283.0540771484, 97.438095092773}, 
       {-1931.8199462891, 656.82000732422, 46.5625}, 
       {2615.3359375, 1816.1739501953, 10.8203125}, 
       {1764.2044677734, 2085.2583007813, 20.972038269043}, 
       {-1381.1610107422, 493.40637207031, 27.694522857666}, 
       {2383.6462402344, 2757.1452636719, 13.105983734131}, 
       {1587.9537353516, 752.60015869141, 10.8203125}, 
       {2820.8581542969, 2271.759765625, 14.661463737488}, 
       {2314.1103515625, -4.8270263671875, 32.53125}, 
       {1272.0865478516, 294.79476928711, 20.656307220459}, 
       {187.23028564453, -90.492126464844, 8.8986940383911}, 
       {-1123.1042480469, -924.32379150391, 129.21875}, 
       {-2337.7961425781, -1617.6987304688, 483.71405029297}, 
       {-2228.8112792969, -1744.6583251953, 480.88488769531}, 
       {-2328.6296386719, 1537.9274902344, 17.328125}, 
       {-1633.8870849609, -2237.8508300781, 31.4765625}, 
       {2494.7124023438, -1689.0024414063, 21.675098419189}, 
       {2244.6433105469, -1324.0946044922, 41.259601593018}, 
       {894.87707519531, -1453.7999267578, 21.178594589233}, 
       {1623.6677246094, -1041.9099121094, 27.201309204102}, 
       {387.02029418945, -2029.3041992188, 22.108934402466}, 
       {-65.270530700684, -1587.7954101563, 2.6171875}, 
       {-656.64978027344, -2184.2194824219, 16.19390296936}, 
       {-429.22280883789, 1405.0031738281, 17.471927642822}, 
       {-2413.8935546875, 802.74127197266, 35.1796875}, 
       {-1357.7237548828, -26.7275390625, 14.1484375}, 
    } 
  
  
    for i=1, #pistola do 
        createPickup(unpack(pistola[i]), 2, 22, 80000, 17) 
    end 
end 
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), pickupsByManawydan) 
  

eu tentei com o "do" e sem ele e mesmo assim as pickups não foram criadas.

560x95_FFFFFF_09FF00_050505_000000.png

"Querer não é poder, mas tentar é avançar"!

Posted
  
local pistola = 
    { 
       {2470.7863769531, -1698.5581054688, 13.516083717346}, 
       {2475.51953125, -1698.0883789063, 13.522142410278}, 
       {311.80181884766, 1809.5435791016, 17.640625}, 
       {280.9345703125, 1954.8565673828, 17.640625}, 
       {246.69946289063, 1385.6153564453, 23.37028503418}, 
       {-176.94442749023, 1149.9345703125, 19.598318099976}, 
       {816.51824951172, 856.54290771484, 12.7890625}, 
       {1207.6088867188, 2125.2395019531, 6.734375}, 
       {2323.6633300781, 1283.0540771484, 97.438095092773}, 
       {-1931.8199462891, 656.82000732422, 46.5625}, 
       {2615.3359375, 1816.1739501953, 10.8203125}, 
       {1764.2044677734, 2085.2583007813, 20.972038269043}, 
       {-1381.1610107422, 493.40637207031, 27.694522857666}, 
       {2383.6462402344, 2757.1452636719, 13.105983734131}, 
       {1587.9537353516, 752.60015869141, 10.8203125}, 
       {2820.8581542969, 2271.759765625, 14.661463737488}, 
       {2314.1103515625, -4.8270263671875, 32.53125}, 
       {1272.0865478516, 294.79476928711, 20.656307220459}, 
       {187.23028564453, -90.492126464844, 8.8986940383911}, 
       {-1123.1042480469, -924.32379150391, 129.21875}, 
       {-2337.7961425781, -1617.6987304688, 483.71405029297}, 
       {-2228.8112792969, -1744.6583251953, 480.88488769531}, 
       {-2328.6296386719, 1537.9274902344, 17.328125}, 
       {-1633.8870849609, -2237.8508300781, 31.4765625}, 
       {2494.7124023438, -1689.0024414063, 21.675098419189}, 
       {2244.6433105469, -1324.0946044922, 41.259601593018}, 
       {894.87707519531, -1453.7999267578, 21.178594589233}, 
       {1623.6677246094, -1041.9099121094, 27.201309204102}, 
       {387.02029418945, -2029.3041992188, 22.108934402466}, 
       {-65.270530700684, -1587.7954101563, 2.6171875}, 
       {-656.64978027344, -2184.2194824219, 16.19390296936}, 
       {-429.22280883789, 1405.0031738281, 17.471927642822}, 
       {-2413.8935546875, 802.74127197266, 35.1796875}, 
       {-1357.7237548828, -26.7275390625, 14.1484375}, 
    } 
  
function pickupsByManawydan() 
    for i=1, #pistola do 
        createPickup(unpack(pistola[i]), 2, 22, 80000, 17) 
    end 
end 
addEventHandler("onResourceStart", resourceRoot, pickupsByManawydan) 
  

O evento "onResourceStart" só será chamado quando este recurso for iniciado, ao contrário de "onClientResourceStart" que é chamado quando o jogador faz o download do client (e quando um recurso é iniciado).

Please do not PM me with scripting related question nor support, use the forums instead.

Posted

obrigado. eu fiz de outro modo porem o cubo e o objeto nao sao destruidos.

local pistola = 
    { 
       {2478.615234375, -1676.2136230469, 13.336660385132}, 
       {2475.51953125, -1698.0883789063, 13.522142410278}, 
       {311.80181884766, 1809.5435791016, 17.640625}, 
       {280.9345703125, 1954.8565673828, 17.640625}, 
       {246.69946289063, 1385.6153564453, 23.37028503418}, 
       {-176.94442749023, 1149.9345703125, 19.598318099976}, 
       {816.51824951172, 856.54290771484, 12.7890625}, 
       {1207.6088867188, 2125.2395019531, 6.734375}, 
       {2323.6633300781, 1283.0540771484, 97.438095092773}, 
       {-1931.8199462891, 656.82000732422, 46.5625}, 
       {2615.3359375, 1816.1739501953, 10.8203125}, 
       {1764.2044677734, 2085.2583007813, 20.972038269043}, 
       {-1381.1610107422, 493.40637207031, 27.694522857666}, 
       {2383.6462402344, 2757.1452636719, 13.105983734131}, 
       {1587.9537353516, 752.60015869141, 10.8203125}, 
       {2820.8581542969, 2271.759765625, 14.661463737488}, 
       {2314.1103515625, -4.8270263671875, 32.53125}, 
       {1272.0865478516, 294.79476928711, 20.656307220459}, 
       {187.23028564453, -90.492126464844, 8.8986940383911}, 
       {-1123.1042480469, -924.32379150391, 129.21875}, 
       {-2337.7961425781, -1617.6987304688, 483.71405029297}, 
       {-2228.8112792969, -1744.6583251953, 480.88488769531}, 
       {-2328.6296386719, 1537.9274902344, 17.328125}, 
       {-1633.8870849609, -2237.8508300781, 31.4765625}, 
       {2494.7124023438, -1689.0024414063, 21.675098419189}, 
       {2244.6433105469, -1324.0946044922, 41.259601593018}, 
       {894.87707519531, -1453.7999267578, 21.178594589233}, 
       {1623.6677246094, -1041.9099121094, 27.201309204102}, 
       {387.02029418945, -2029.3041992188, 22.108934402466}, 
       {-65.270530700684, -1587.7954101563, 2.6171875}, 
       {-656.64978027344, -2184.2194824219, 16.19390296936}, 
       {-429.22280883789, 1405.0031738281, 17.471927642822}, 
       {-2413.8935546875, 802.74127197266, 35.1796875}, 
       {-1357.7237548828, -26.7275390625, 14.1484375} 
    } 
  
    for k,v in ipairs( pistola ) do 
       local objetosItens = createObject(1463, v[1], v[2], v[3]-0.93) 
setObjectScale(objetosItens, 3) 
setElementCollisionsEnabled(objetosItens, false) 
setElementFrozen(objetosItens, true) 
 col = createColCuboid ( v[1], v[2], v[3], 0.19775390625, 0.4053955078125, 1.0003938436508 ) 
attachElements ( col, objetosItens, 0, 0, 0 ) 
setElementParent ( col, objetosItens ) 
    end 
  
function zzzz() 
destroyElement(source) 
end 
addEventHandler ( "onColShapeHit", col, zzzz ) 
  
  
  
  
  
  

560x95_FFFFFF_09FF00_050505_000000.png

"Querer não é poder, mas tentar é avançar"!

Posted

Certamente porque você usou a função setElementParent. Tente destruindo o elemento pai, o objeto.

Please do not PM me with scripting related question nor support, use the forums instead.

Posted

Tente isso:

  
local objetosItens = {} 
local pistolaCol = {} 
  
local pistola = 
    { 
       {2478.615234375, -1676.2136230469, 13.336660385132}, 
       {2475.51953125, -1698.0883789063, 13.522142410278}, 
       {311.80181884766, 1809.5435791016, 17.640625}, 
       {280.9345703125, 1954.8565673828, 17.640625}, 
       {246.69946289063, 1385.6153564453, 23.37028503418}, 
       {-176.94442749023, 1149.9345703125, 19.598318099976}, 
       {816.51824951172, 856.54290771484, 12.7890625}, 
       {1207.6088867188, 2125.2395019531, 6.734375}, 
       {2323.6633300781, 1283.0540771484, 97.438095092773}, 
       {-1931.8199462891, 656.82000732422, 46.5625}, 
       {2615.3359375, 1816.1739501953, 10.8203125}, 
       {1764.2044677734, 2085.2583007813, 20.972038269043}, 
       {-1381.1610107422, 493.40637207031, 27.694522857666}, 
       {2383.6462402344, 2757.1452636719, 13.105983734131}, 
       {1587.9537353516, 752.60015869141, 10.8203125}, 
       {2820.8581542969, 2271.759765625, 14.661463737488}, 
       {2314.1103515625, -4.8270263671875, 32.53125}, 
       {1272.0865478516, 294.79476928711, 20.656307220459}, 
       {187.23028564453, -90.492126464844, 8.8986940383911}, 
       {-1123.1042480469, -924.32379150391, 129.21875}, 
       {-2337.7961425781, -1617.6987304688, 483.71405029297}, 
       {-2228.8112792969, -1744.6583251953, 480.88488769531}, 
       {-2328.6296386719, 1537.9274902344, 17.328125}, 
       {-1633.8870849609, -2237.8508300781, 31.4765625}, 
       {2494.7124023438, -1689.0024414063, 21.675098419189}, 
       {2244.6433105469, -1324.0946044922, 41.259601593018}, 
       {894.87707519531, -1453.7999267578, 21.178594589233}, 
       {1623.6677246094, -1041.9099121094, 27.201309204102}, 
       {387.02029418945, -2029.3041992188, 22.108934402466}, 
       {-65.270530700684, -1587.7954101563, 2.6171875}, 
       {-656.64978027344, -2184.2194824219, 16.19390296936}, 
       {-429.22280883789, 1405.0031738281, 17.471927642822}, 
       {-2413.8935546875, 802.74127197266, 35.1796875}, 
       {-1357.7237548828, -26.7275390625, 14.1484375} 
    } 
  
do 
    for i=1, #pistola do 
        objetosItens[i] = createObject(1463, pistola[i][1], pistola[i][2], pistola[i][3]-0.93) 
        setObjectScale(objetosItens[i], 3) 
        setElementCollisionsEnabled(objetosItens[i], false) 
        setElementFrozen(objetosItens[i], true) 
        pistolaCol[i] = createColCuboid(pistola[i][1], pistola[i][2], pistola[i][3], 0.1977, 0.4053, 1.0003) 
        attachElements(pistolaCol[i], objetosItens[i], 0, 0, 0) 
        setElementParent(pistolaCol[i], objetosItens[i]) 
         
        addEventHandler("onColShapeHit", pistolaCol[i], zzzz) 
    end 
end 
  
function zzzz(hitElement) 
    if (getElementType(hitElement) == "player") then 
        for i=1, #pistola do 
            if (getElementParent(source) == objetosItens[i]) then 
                destroyElement(objetosItens[i]) 
                if not i == #pistola  then break end 
            end 
        end 
    end 
end 
  

Please do not PM me with scripting related question nor support, use the forums instead.

Posted

testei esse script que voce passou. tinha dado erro no argumento 3 (acredito que seja por a função zzzz não tinha carregado. então eu fiz assim:

local objetosItens = {} 
local pistolaCol = {} 
  
local pistola = 
    { 
       {2478.615234375, -1676.2136230469, 13.336660385132}, 
       {2475.51953125, -1698.0883789063, 13.522142410278}, 
       {311.80181884766, 1809.5435791016, 17.640625}, 
       {280.9345703125, 1954.8565673828, 17.640625}, 
       {246.69946289063, 1385.6153564453, 23.37028503418}, 
       {-176.94442749023, 1149.9345703125, 19.598318099976}, 
       {816.51824951172, 856.54290771484, 12.7890625}, 
       {1207.6088867188, 2125.2395019531, 6.734375}, 
       {2323.6633300781, 1283.0540771484, 97.438095092773}, 
       {-1931.8199462891, 656.82000732422, 46.5625}, 
       {2615.3359375, 1816.1739501953, 10.8203125}, 
       {1764.2044677734, 2085.2583007813, 20.972038269043}, 
       {-1381.1610107422, 493.40637207031, 27.694522857666}, 
       {2383.6462402344, 2757.1452636719, 13.105983734131}, 
       {1587.9537353516, 752.60015869141, 10.8203125}, 
       {2820.8581542969, 2271.759765625, 14.661463737488}, 
       {2314.1103515625, -4.8270263671875, 32.53125}, 
       {1272.0865478516, 294.79476928711, 20.656307220459}, 
       {187.23028564453, -90.492126464844, 8.8986940383911}, 
       {-1123.1042480469, -924.32379150391, 129.21875}, 
       {-2337.7961425781, -1617.6987304688, 483.71405029297}, 
       {-2228.8112792969, -1744.6583251953, 480.88488769531}, 
       {-2328.6296386719, 1537.9274902344, 17.328125}, 
       {-1633.8870849609, -2237.8508300781, 31.4765625}, 
       {2494.7124023438, -1689.0024414063, 21.675098419189}, 
       {2244.6433105469, -1324.0946044922, 41.259601593018}, 
       {894.87707519531, -1453.7999267578, 21.178594589233}, 
       {1623.6677246094, -1041.9099121094, 27.201309204102}, 
       {387.02029418945, -2029.3041992188, 22.108934402466}, 
       {-65.270530700684, -1587.7954101563, 2.6171875}, 
       {-656.64978027344, -2184.2194824219, 16.19390296936}, 
       {-429.22280883789, 1405.0031738281, 17.471927642822}, 
       {-2413.8935546875, 802.74127197266, 35.1796875}, 
       {-1357.7237548828, -26.7275390625, 14.1484375} 
    } 
function zzzz(hitElement) 
    if (getElementType(hitElement) == "player") then 
        for i=1, #pistola do 
            if (getElementParent(source) == objetosItens[i]) then 
                destroyElement(objetosItens[i]) 
                if not i == #pistola  then break end 
            end 
        end 
    end 
end 
  
do 
    for i=1, #pistola do 
        objetosItens[i] = createObject(1463, pistola[i][1], pistola[i][2], pistola[i][3]-0.93) 
        setObjectScale(objetosItens[i], 3) 
        setElementCollisionsEnabled(objetosItens[i], false) 
        setElementFrozen(objetosItens[i], true) 
        pistolaCol[i] = createColCuboid(pistola[i][1], pistola[i][2], pistola[i][3], 0.1977, 0.4053, 1.0003) 
        attachElements(pistolaCol[i], objetosItens[i], 0, 0, 0) 
        setElementParent(pistolaCol[i], objetosItens[i]) 
       addEventHandler("onColShapeHit", pistolaCol[i], zzzz) 
         
    end 
end 

funciona, porem aparece um erro: bad argument getElementParent [expected element at argument 1]

560x95_FFFFFF_09FF00_050505_000000.png

"Querer não é poder, mas tentar é avançar"!

Posted

Tente isso:

  
local objetosItens = {} 
local pistolaCol = {} 
  
local pistola = 
    { 
       {2478.615234375, -1676.2136230469, 13.336660385132}, 
       {2475.51953125, -1698.0883789063, 13.522142410278}, 
       {311.80181884766, 1809.5435791016, 17.640625}, 
       {280.9345703125, 1954.8565673828, 17.640625}, 
       {246.69946289063, 1385.6153564453, 23.37028503418}, 
       {-176.94442749023, 1149.9345703125, 19.598318099976}, 
       {816.51824951172, 856.54290771484, 12.7890625}, 
       {1207.6088867188, 2125.2395019531, 6.734375}, 
       {2323.6633300781, 1283.0540771484, 97.438095092773}, 
       {-1931.8199462891, 656.82000732422, 46.5625}, 
       {2615.3359375, 1816.1739501953, 10.8203125}, 
       {1764.2044677734, 2085.2583007813, 20.972038269043}, 
       {-1381.1610107422, 493.40637207031, 27.694522857666}, 
       {2383.6462402344, 2757.1452636719, 13.105983734131}, 
       {1587.9537353516, 752.60015869141, 10.8203125}, 
       {2820.8581542969, 2271.759765625, 14.661463737488}, 
       {2314.1103515625, -4.8270263671875, 32.53125}, 
       {1272.0865478516, 294.79476928711, 20.656307220459}, 
       {187.23028564453, -90.492126464844, 8.8986940383911}, 
       {-1123.1042480469, -924.32379150391, 129.21875}, 
       {-2337.7961425781, -1617.6987304688, 483.71405029297}, 
       {-2228.8112792969, -1744.6583251953, 480.88488769531}, 
       {-2328.6296386719, 1537.9274902344, 17.328125}, 
       {-1633.8870849609, -2237.8508300781, 31.4765625}, 
       {2494.7124023438, -1689.0024414063, 21.675098419189}, 
       {2244.6433105469, -1324.0946044922, 41.259601593018}, 
       {894.87707519531, -1453.7999267578, 21.178594589233}, 
       {1623.6677246094, -1041.9099121094, 27.201309204102}, 
       {387.02029418945, -2029.3041992188, 22.108934402466}, 
       {-65.270530700684, -1587.7954101563, 2.6171875}, 
       {-656.64978027344, -2184.2194824219, 16.19390296936}, 
       {-429.22280883789, 1405.0031738281, 17.471927642822}, 
       {-2413.8935546875, 802.74127197266, 35.1796875}, 
       {-1357.7237548828, -26.7275390625, 14.1484375} 
    } 
  
function zzzz(hitElement) 
    if (getElementType(hitElement) == "player") then 
        if not getElementData(source, "colshapeID") then 
            return 
        end 
        local colID = tonumber(getElementData(source, "colshapeID")) 
        destroyElement(objetosItens[colID]) 
        destroyElement(source) 
    end 
end 
  
do 
    for i=1, #pistola do 
        objetosItens[i] = createObject(1463, pistola[i][1], pistola[i][2], pistola[i][3]-0.93) 
        setObjectScale(objetosItens[i], 3) 
        setElementCollisionsEnabled(objetosItens[i], false) 
        setElementFrozen(objetosItens[i], true) 
        pistolaCol[i] = createColCuboid(pistola[i][1], pistola[i][2], pistola[i][3], 0.1977, 0.4053, 1.0003) 
        attachElements(pistolaCol[i], objetosItens[i], 0, 0, 0) 
        setElementData(pistolaCol[i], "colshapeID", i, false) 
    end 
    addEventHandler("onColShapeHit", root, zzzz) 
end 

Please do not PM me with scripting related question nor support, use the forums instead.

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