Necesitas una reestructuración, ya que COLS es un elemento no una tabla que almacene varios elementos, lo que lleva a su cambio continuo en el loop de esa manera provocando que la función solo se ejecute cuando el elemento cumpla el evento definido en el addEventHandler. Una manera "sucia" de hacerlo sería así.
COLSHAPES =
{
{ -2882.6452636719, 1897.1723632813, 0, 1000, 1000, 1000 },
{ -363.17227172852, -416.40063476563, 0, 1000, 700, 500 },
{ -3034.3217773438, -2238.9357910156, 1, 1150, 1300, 900 }
}
function AREAS( player, matchingDimension )
local DIMENSION = getElementDimension( player )
if getElementType( player ) and DIMENSION == 1 then
killPed( player )
outputChatBox( "**FUISTE ASESINADO POR ABANDONAR LA ZONA INFECTADA**", player, 255, 0, 0 )
end
end
for k, data in ipairs( COLSHAPES ) do
COLS = createColCuboid( data[1], data[2], data[3], data[4], data[5], data[6] )
addEventHandler( "onColShapeLeave", COLS, AREAS )
end
Pero si quieres algo más optimizado puedes usar lo siguiente.
C =
{
COL1 = { -2882.6452636719, 1897.1723632813, 0, 1000, 1000, 1000 },
COL2 = { -363.17227172852, -416.40063476563, 0, 1000, 700, 500 },
COL3 = { -3034.3217773438, -2238.9357910156, 1, 1150, 1300, 900 }
}
CS = { }
for I = 1, #C do
CS[I] = createColCuboid( unpack( C[I] ) )
addEventHandler( "onColShapeLeave", CS[I], AREAS )
end
function AREAS( player, matchingDimension )
local DIMENSION = getElementDimension( player )
if getElementType( player ) and DIMENSION == 1 then
killPed( player )
outputChatBox( "**FUISTE ASESINADO POR ABANDONAR LA ZONA INFECTADA**", player, 255, 0, 0 )
end
end