Files
rtpzone.sk
Code
1 123
rtpzone.sk
# RTP Zone — Global Timer Version
# Color theme: #22FF00 (lime green)
# Placeholder: %rtp_timer% for FancyHolograms
# Teleports all players inside region "rtp" when timer reaches 0
#
# Setup:
# 1. Create a WorldGuard region named "rtp"
# 2. Adjust options below (rtp-world, rtp-radius, rtp-timer)
# 3. /sk reload rtpzone
# 4. In FancyHolograms use {%rtp_timer%}
options:
# ─── World to teleport players into ───
rtp-world: world
# ─── Max random radius from 0,0 (blocks) ───
rtp-radius: 1000
# ─── Timer duration in seconds ───
rtp-timer: 30
# ─── Display ───
prefix: &a&lRTPZONE &8» &7
# ─────────────────────────────────────────────
# GLOBAL TIMER LOOP — runs forever
# ─────────────────────────────────────────────
on script load:
set {_seconds} to {_rtp-timer} parsed as integer
if {_seconds} is not set:
set {_seconds} to {@rtp-timer}
set {rtp.seconds} to {_seconds}
set {rtp.timer-active} to true
broadcast "{@prefix}&fTimer started (&a{@rtp-timer}s&f). Teleporting to &a{@rtp-world}&f."
every 1 second:
if {rtp.timer-active} is false:
stop
# If the global timer hits 0 — teleport everyone in the region
if {rtp.seconds} is 0:
loop all players:
if loop-player is in region "rtp":
wait 1 tick
rtpPlayer(loop-player)
# Reset the timer
set {rtp.seconds} to {@rtp-timer}
stop
# Decrement
remove 1 from {rtp.seconds}
# ─────────────────────────────────────────────
# ACTION BAR — shows to anyone in the region
# ─────────────────────────────────────────────
every 1 second:
loop all players:
if loop-player is in region "rtp":
set {_color} to "&a"
if {rtp.seconds} <= 10:
set {_color} to "&e"
if {rtp.seconds} <= 5:
set {_color} to "&c"
send action bar "{@prefix}&fTeleporting in {_color}%{rtp.seconds}% &7seconds..." to loop-player
# ─────────────────────────────────────────────
# PLAYER ENTER — show welcome
# ─────────────────────────────────────────────
on region enter region named "rtp":
send action bar "{@prefix}&fYou are in the &aRTP Zone&f! Next teleport in &a%{rtp.seconds}% &7seconds..." to player
# ─────────────────────────────────────────────
# PLAYER LEAVE — notify
# ─────────────────────────────────────────────
on region leave region named "rtp":
send action bar "{@prefix}&cYou left the RTP Zone." to player
# ─────────────────────────────────────────────
# TELEPORT FUNCTION
# ─────────────────────────────────────────────
function rtpPlayer(p: player):
set {_world} to world({@rtp-world})
if {_world} is not set:
send "{@prefix}&cWorld '&f{@rtp-world}&c' not found!" to {_p}
stop
set {_radius} to {@rtp-radius} parsed as integer
set {_x} to random integer between -{_radius} and {_radius}
set {_z} to random integer between -{_radius} and {_radius}
set {_loc} to location({_x}, 0, {_z}, {_world})
# Find the surface
set {_loc} to spawn location of {_loc}'s world above {_loc}
set {_y} to y-coordinate of {_loc}
loop 10 times:
if block at {_loc} is air:
stop loop
add 1 to {_y}
set {_loc} to location({_x}, {_y}, {_z}, {_world})
loop 10 times:
if block at {_loc} is not air:
add 1 to {_y}
set {_loc} to location({_x}, {_y}, {_z}, {_world})
else:
stop loop
# Teleport
teleport {_p} to {_loc}
send "{@prefix}&aTeleported! &7(&f%{_x}%&7, &f%{_z}%&7)" to {_p}
# ─────────────────────────────────────────────
# PLACEHOLDER — %rtp_timer%
# ─────────────────────────────────────────────
placeholder rtp_timer:
if {rtp.seconds} is not set:
return "0"
return "%{rtp.seconds}%"