erisP Posted July 22, 2020 Share Posted July 22, 2020 client.lua setTimer ( function () local theCol = getElementData(root, "BlockExportCol") function isInColExport () if isElement(theCol) and isElementWithinColShape(localPlayer,theCol) then return true else return false end end function ClientExplosionCFunction() if isInColExport () then cancelEvent () end end addEventHandler("onClientExplosion", root, ClientExplosionCFunction) end , 1000, 1 ) shared.lua BlockVehicle = createColCuboid ( 1573.84900,-1637.5,12, 10,6,6 ) setElementData(root, "BlockExportCol", BlockVehicle) I want to block vehicles in more areas how can I do it? Link to comment
Moderators IIYAMA Posted July 22, 2020 Moderators Share Posted July 22, 2020 @erisP Use the (dynamic) element tree. -- server local colshapeParent = createElement("colshapeParent", "blockColshapeParent") local BlockVehicle = createColCuboid ( 1573.84900,-1637.5,12, 10,6,6 ) setElementParent(BlockVehicle, colshapeParent) local BlockVehicle2 = createColCuboid ( 1573.84900,-1637.5,12, 20,6,6 ) setElementParent(BlockVehicle2, colshapeParent) -- client --[[ -- clientside colshapes do local colshapeParent = getElementByID("blockColshapeParent") if colshapeParent then local BlockVehicle2 = createColCuboid ( 1573.84900,-1637.5,12, 20,6,6 ) setElementParent(BlockVehicle2, colshapeParent) end end ]] function isInColExport () local colshapeParent = getElementByID("blockColshapeParent") if colshapeParent then local colshapes = getElementChildren(colshapeParent) for i=1, #colshapes do local colshape = colshapes[i] if isElementWithinColShape(localPlayer, colshape) then return true end end end return false end Untested. Colshapes must be created in the same resource as the parent, clientside/serverside doesn't matter. Link to comment
Moderators IIYAMA Posted July 24, 2020 Moderators Share Posted July 24, 2020 @erisP You might want to reply at least (, even if you are not going to do anything with it). 1 Link to comment
erisP Posted July 25, 2020 Author Share Posted July 25, 2020 (edited) @ IIYAMA successful thanks Edited July 25, 2020 by erisP 1 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