local Z1 = createColRectangle(1577, 1723, 60, 140 ) -- LV hospital
function spawnRoadblock(id, x, y, z, rx, ry, rz, dim, int)
if (not id) then return end
if (id == 1225 and dim == 0) then
outputChatBox("Explosive barrels can not be placed in main dimension", client, 255, 0, 0)
return
end
if (id == 978) then
z = z-1
end
local accName = getAccountName(getPlayerAccount(client))
local object = createObject(tonumber(id), x, y, z, rx, ry, rz)
setElementDoubleSided(object, true)
setElementFrozen(object, true)
setElementData(object, "creator", accName, false)
roadblocks[object] = {object, getAccountName(getPlayerAccount(client))}
if (tonumber(dim) ~= 0) then
setElementDimension(object, dim)
end
if (tonumber(int) ~= 0) then
setElementInterior(object, int)
end
if (id ~= 1225) then
triggerClientEvent(client, "nobreak", client, object)
end
if not isElementWithinColShape (object, Z1) then
destroyElement(object)
end
end
addEvent("Zone.ZRB.AddRoadblock", true)
addEventHandler("Zone.ZRB.AddRoadblock", root, spawnRoadblock)
Hello, in this script as you see it's about adding a Road Block.. but i got one problem and it's i need to make that if the Object was outside a specific area so it will get auto removed, any help? I appreciate who fix this coding... Thanks.