Files
SpawnSystem.sk
Code
1 142
SpawnSystem.sk
# ==========================================
# SpawnSystem - Spawn Management Script
# Place in: plugins/Skript/scripts/
# Reload with: /sk reload SpawnSystem
# ==========================================
options:
prefix: &8[&6Spawn&8]&r
cooldown: 10
warmup: 3
teleport-on-join: true
welcome-message: &aWitaj na serwerze, &e%player%&a! Napisz &e/spawn &aaby wrócić na spawn.
first-join-message: &6Witamy po raz pierwszy na serwerze, &e%player%&6! Cieszymy się, że jesteś z nami!
# ==========================================
# SET SPAWN
# ==========================================
command /setspawn:
permission: spawn.admin
permission message: {@prefix} &cNie masz uprawnień do tej komendy!
trigger:
set {spawn::location} to location of player
send "{@prefix} &aSpawn został ustawiony na &e%location of player%&a!" to player
# ==========================================
# SPAWN TELEPORT COMMAND
# ==========================================
command /spawn:
permission: spawn.use
permission message: {@prefix} &cNie masz uprawnień do tej komendy!
trigger:
if {spawn::location} is not set:
send "{@prefix} &cSpawn nie został jeszcze ustawiony! Użyj &e/setspawn&c." to player
stop
if player has permission "spawn.bypass":
teleport player to {spawn::location}
send "{@prefix} &aTeleportowano na spawn!" to player
stop
if {spawn::cooldown::%player's uuid%} is set:
set {_remaining} to difference between now and {spawn::cooldown::%player's uuid%}
set {_remaining} to ({@cooldown} seconds) - {_remaining}
if {_remaining} > 0 seconds:
send "{@prefix} &cMusisz poczekać &e%{_remaining}% &csekund przed ponownym użyciem!" to player
stop
if {spawn::warmup::%player's uuid%} is set:
send "{@prefix} &eTeleportacja już trwa, nie ruszaj się!" to player
stop
send "{@prefix} &eTeleportacja za &6{@warmup} &esekund. &cNie ruszaj się!" to player
set {spawn::warmup::%player's uuid%} to true
set {_start-loc} to location of player
wait {@warmup} seconds
if {spawn::warmup::%player's uuid%} is not set:
stop
delete {spawn::warmup::%player's uuid%}
if location of player is not {_start-loc}:
send "{@prefix} &cTeleportacja anulowana! Poruszyłeś się!" to player
stop
teleport player to {spawn::location}
send "{@prefix} &aTeleportowano na spawn!" to player
set {spawn::cooldown::%player's uuid%} to now
# ==========================================
# CANCEL WARMUP ON MOVE
# ==========================================
on player move:
if {spawn::warmup::%player's uuid%} is set:
if distance between player's location and (location of player) > 0.2:
delete {spawn::warmup::%player's uuid%}
# ==========================================
# JOIN EVENTS
# ==========================================
on first join:
send "{@first-join-message}" to player
if {@teleport-on-join} is true:
if {spawn::location} is set:
wait 1 tick
teleport player to {spawn::location}
on join:
if player has joined before:
send "{@welcome-message}" to player
if {@teleport-on-join} is true:
if {spawn::location} is set:
wait 1 tick
teleport player to {spawn::location}
# ==========================================
# ADMIN COMMANDS
# ==========================================
command /spawnadmin [<text>]:
permission: spawn.admin
permission message: {@prefix} &cNie masz uprawnień do tej komendy!
trigger:
if arg-1 is not set:
send "{@prefix} &eKomendy administracyjne:" to player
send "&7/spawnadmin info &8- &fPokaż informacje o spawnie" to player
send "&7/spawnadmin clearcd <gracz> &8- &fWyczyść cooldown gracza" to player
send "&7/spawnadmin reload &8- &fPrzeładuj ustawienia" to player
stop
if arg-1 is "info":
if {spawn::location} is not set:
send "{@prefix} &cSpawn nie jest ustawiony!" to player
stop
send "{@prefix} &eInformacje o spawnie:" to player
send "&7Lokalizacja: &f%{spawn::location}%" to player
send "&7Cooldown: &f{@cooldown}s" to player
send "&7Warmup: &f{@warmup}s" to player
send "&7Teleport na join: &f{@teleport-on-join}" to player
stop
if arg-1 starts with "clearcd":
send "{@prefix} &cUżycie: &e/spawnadmin clearcd <gracz>" to player
stop
send "{@prefix} &cNieznana komenda. Użyj &e/spawnadmin &caby zobaczyć pomoc." to player
command /spawnclearcd <player>:
permission: spawn.admin
permission message: {@prefix} &cNie masz uprawnień do tej komendy!
trigger:
if arg-1 is not set:
send "{@prefix} &cUżycie: &e/spawnclearcd <gracz>" to player
stop
delete {spawn::cooldown::%uuid of arg-1%}
send "{@prefix} &aWyczyszczono cooldown gracza &e%arg-1%&a!" to player
send "{@prefix} &aTwój cooldown spawnu został wyczyszczony przez &e%player%&a!" to arg-1