Jump to content

ghost zone


Kelly003

Recommended Posts


When you get into these cuboids, nothing works

code: 

local zones= {
    {-2411.49, -608.29131.6218.3312.491.92},
    {-2430.09, -607.45131.565.557.241.90},
}
 
for i,v in ipairs(zones) do
    createColCuboid(v[1], v[2], v[3], v[4], v[5], v[6])
end
 
addEventHandler("onColShapeHit", zones, function(element)
    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)
 
addEventHandler("onColShapeHit", zones, function(element)
    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)
Link to comment
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

Edited by Burak5312
  • Like 2
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...