local zCoordinates = {
{-2411.49, -608.29, 131.62, 18.33, 12.49, 1.92},
{-2430.09, -607.45, 131.56, 5.55, 7.24, 1.90}
}
local zones = {}
for i,v in ipairs(zCoordinates) do
local theZone = createColCuboid(zCoordinates[i][1], zCoordinates[i][2], zCoordinates[i][3], zCoordinates[i][4], zCoordinates[i][5], zCoordinates[i][6])
table.insert(zones, theZone)
end
addEventHandler("onColShapeHit", root, function(element)
for i=1,#zones do
if(source == zones[i]) then
if getElementType(element) == "ped" or getElementType(element) == "player" or getElementType(element) == "vehicle" then
if getElementAlpha(element) == 255 then
setElementAlpha(element, 130)
setElementCollisionsEnabled(element, false)
end
end
end
end
end)
addEventHandler("onColShapeLeave", root, function(element)
for i=1,#zones do
if(source == zones[i]) then
if getElementType(element) == "ped" or getElementType(element) == "player" or getElementType(element) == "vehicle" then
if getElementAlpha(element) == 130 then
setElementAlpha(element, 255)
setElementCollisionsEnabled(element, true)
end
end
end
end
end)
try this