WiBox Posted April 25, 2018 Share Posted April 25, 2018 (edited) local Z1 = createColRectangle(1577, 1723, 60, 140 ) function spawnRoadblock(id, x, y, z, rx, ry, rz, dim, int) if (not id) then return end if ( id =="" and dim == 0) then return true 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 end addEvent("events.RB.AddRoadblock", true) addEventHandler("events.RB.AddRoadblock", root, spawnRoadblock) ____________________________________________________________________________________________________________________________ i want to add on it, if Client placed a Object outside Z1 it will not get placed, and if it placed inside the Z1 it will be placed, Please can someone help, and i appreciate that! thank you. Edited April 25, 2018 by NeXuS™ Added code tag. Link to comment
NeXuS™ Posted April 25, 2018 Share Posted April 25, 2018 Next time use the code tag please. I fixed it for you now. For the scripting part, you can use isElementWithinColShape, and if that returns false, you can use destroyElement and return. Link to comment
WiBox Posted April 25, 2018 Author Share Posted April 25, 2018 i did try it but i didn't know how to add object with it.. if you can give me a small exemple with an object not a element or player... isElementWithinColShape ( object, Z1) i tryed that didn't work 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