-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathskriptspawn.sk
102 lines (90 loc) · 3.46 KB
/
skriptspawn.sk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
options: #Remember that messages have to be placed between double quotes.
delay: 3 #Spawn delay, in seconds
cooldown: 15 #Cooldown to process /spawn command, in seconds
safety: true #Safety mode - script finds the highest block and teleports there if it's set to true.
move: true #If it's true teleportation will be canceled if player moves.
spawnjoin: false #If it's set to true player will be teleported to spawn each every join.
spawndeath: true #If it's set to true player will be teleported to spawn each every death.
firstspawn: true #New player will be teleported to spawn if it's set (/setspawn) and if this option is set to true
perm: essentials.setspawn #Permission to use /setspawn
spawnperm: essentials.spawn #Permission to use /spawn
permsg: &cError: &7Insufficient permissions. #Message if you don't have permission to use /setspawn
spawnsetmsg: "&7Spawn has been set to &c%player's location%" #Message if an admin set a spawn
tpmsg: "&7Successfully teleported you to spawn!" #Message if player teleports to spawn
movemsg: "&cError: &7Teleportation canceled due to a move!" #Message if player moves, if 'move' is set to true
nospawnmsg: "&cError: &7Spawn has been not set yet!" #Message if no spawn is set
delspawnmsg: "&7Spawn has been &cdeleted!" #Message if /delspawn command was executed
welcoming: true #Server will broadcast a welcome message for new players if it's set to true
welcomemsg: "&7Welcome, &a%player% &7to the server!" #Message on first join to everyone
on first join:
if {@welcoming} is true:
set join message to {@welcomemsg}
if {@firstspawn} is true:
spawn(player)
on join:
if {@spawnjoin} is true:
spawn(player)
on respawn:
wait 1 tick
if {@spawndeath} is true:
spawn(player)
function spawn(p: player):
if {spawn.location} is set:
if {@safety} is true:
set {_y} to highest block at {spawn.location}
teleport {_p} to block above {_y}
else:
teleport {_p} to {spawn.location}
set {spawn.%{_p}%.lastused} to now
send {@tpmsg} to {_p}
command /delspawn:
permission: {@perm}
permission message: {@permsg}
trigger:
if {spawn.location} is set:
delete {spawn.location}
send {@delspawnmsg}
else:
send {@nospawnmsg}
command /setspawn:
permission: {@perm}
permission message: {@permsg}
trigger:
set {spawn.location} to player's location
send {@spawnsetmsg}
command /spawn:
permission: {@spawnperm}
permission message: {@permsg}
trigger:
if {spawn.location} isn't set:
send {@nospawnmsg}
stop
set {_waited} to difference between {spawn.%player%.lastused} and now
if {_waited} is less than {@cooldown} seconds:
send "&cError: &7You have to wait %difference between {@cooldown} seconds and {_waited}% &7to teleport to spawn."
stop
if {@delay} > 0:
if {@move} is true:
send "&7Wait &a{@delay} &aseconds &7to teleport and &cdon't move!" # You can edit message there
else:
send "&7Wait &a{@delay} &aseconds &7to teleport!" # You can edit message there
set {_pX} to round(player's x-coords)
set {_pY} to round(player's y-coords)
set {_pZ} to round(player's z-coords)
wait {@delay} seconds
if {@move} is true:
if round(player's x-coords) is {_pX}: # Rounding it allows to move a little only, like in EssentialsSpawn
if round(player's y-coords) is {_pY}:
if round(player's z-coords) is {_pZ}:
spawn(player)
else:
send {@movemsg}
stop
else:
send {@movemsg}
stop
else:
send {@movemsg}
stop
else:
spawn(player)