Kelly003 Posted August 26, 2021 Share Posted August 26, 2021 When you get into these cuboids, nothing works code: local zones= { {-2411.49, -608.29, 131.62, 18.33, 12.49, 1.92}, {-2430.09, -607.45, 131.56, 5.55, 7.24, 1.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
βurak Posted August 26, 2021 Share Posted August 26, 2021 (edited) 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 August 26, 2021 by Burak5312 2 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now