Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- To Ryan#USNS
- -- I Have this code
- -- X => X position of the cursor
- -- Y => Y position of the cursor
- -- zoneID => the zone ID
- function isWithinZone(x,y,zoneID)
- local cx,cy = zones[zoneID]["x"],zones[zoneID]["x"]
- local sx,sy = zones[zoneID]["sx"],zones[zoneID]["sx"]
- if cx == x and cy == y then return true end
- if x-cx <= sx and cy == y then return true end
- if cx == x and y-cy <= sy then return true end
- if x-cx <= sx and y-cy <= sy then return true end
- return false
- end
- -- Just will make something like this:
- local el = createObject(model, x, y, z, rx, ry, rz)
- local objectZone = getElementData(source, "zoneEditing")
- if not isWithinZone(x,y,objectZone) then
- destroyElement(el)
- exports.CSTtexts:output("Object must be in the zone!",source,255,0,0)
- return false
- end
- -- The problem that it always return false
- -- Means if the object inside , it will say Object must be in the zone!, and if the object outside, it will say the same..
- -- Wish you understand
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement