Hey, so I'm trying to create some sort of skript to define protected areas. My problem is, how can I tell the game if a certain area is already protected from other players and cancel their breaking events? My code:
1. selecting area which I'll want to protect:
2. creating the area:
3. on break event
1. selecting area which I'll want to protect:
Code:
on rightclick:
set {_restool} to stick
set name of {_restool} to "&cRes įrankis"
if player's held item is {_restool}:
if clicked block is set:
set {res.%player%.pos1} to location of event-block
set {pos1.%player%.x} to x coord of {res.%player%.pos1}
set {pos1.%player%.y} to y coord of {res.%player%.pos1}
set {pos1.%player%.z} to z coord of {res.%player%.pos1}
send "{@prefix} Taškas nustatytas: &c%{pos1.%player%.x}%&a, &c%{pos1.%player%.y}%&a, &c%{pos1.%player%.z}%&a!"
on leftclick:
set {_restool} to stick
set name of {_restool} to "&cRes įrankis"
if player's held item is {_restool}:
if clicked block is set:
set {res.%player%.pos2} to location of event-block
set {pos2.%player%.x} to x coord of {res.%player%.pos2}
set {pos2.%player%.y} to y coord of {res.%player%.pos2}
set {pos2.%player%.z} to z coord of {res.%player%.pos2}
send "{@prefix} Taškas nustatytas: &c%{pos2.%player%.x}%&a, &c%{pos2.%player%.y}%&a, &c%{pos2.%player%.z}%&a!"
Code:
if arg 1 is "create":
if arg 2 is set:
if {res.allres::*} does not contain arg-2:
if {res.%player%.resai::*} does not contain arg-2:
if {res.%player%.pos1} is set:
if {res.%player%.pos2} is set:
add arg-2 to {res.allres::*}
add arg-2 to {res.%player%.resai::*}
send "{@prefix} Rezidencija &c%arg-2%&a sukurta!"
set {res.%player%.pos1} to {res.%arg-2%.createdpos1}
set {res.%player%.pos2} to {res.%arg-2%.createdpos2}
Code:
on break:
if event-location is within {res.%player%.pos1} and {res.%player%.pos2}:
cancel event