-
Notifications
You must be signed in to change notification settings - Fork 2
/
carry.sk
172 lines (135 loc) · 5.75 KB
/
carry.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# ### Player carry by Roy Curtis
# ### Licensed under MIT, 2017
# Allows players to pick others up and carry them, with a request system
# ### Global variables
# carry.%target% - string; name of person who asked to carry this player
# ### Configuration
options:
# Max distance between players to allow carrying
max distance : 5
# ### Global functions
function carryNotify(passenger: player, carrier: player):
message "*** You are now carrying &a%{_passenger}%&f!" to {_carrier}
message "* Don't take them through low ceilings, as they'll get hurt" to {_carrier}
message "* Don't go into deep water, else they will be ejected" to {_carrier}
message "* You won't be able to click anything whilst they're riding" to {_carrier}
message "* To see better, press &3F5" to {_carrier}
message "* To eject them: &3/eject" to {_carrier}
message "*** You are now being carried by &a%{_carrier}%&f!" to {_passenger}
message "* Don't press SHIFT or sneak until you want to get off them" to {_passenger}
# ### Global events
on quit:
# Conditions
{carry.%player%} is set
# Logic
set {_carrier} to {carry.%player%} parsed as offline player
delete {carry.%player%}
if {_carrier} is online:
message "&7*** Carry request for %player% cancelled" to {_carrier}
# Bugfix if passenger disconnects on carrier
on quit:
# Conditions
player's vehicle is a player
# Logic
set {_carrier} to player's vehicle
console command "/kick %{_carrier}% Sorry! This is a bug-fix kick; please rejoin"
# ### Global commands
command /ride <player> <player>:
description: Forcefully teleports and attaches a player onto another
usage: /ride <passenger> <carrier>
permission: gamealition.mod-high
executable by: players and console
trigger:
if arg 1 is the player:
arg 2 is the player
message "&c*** You cannot ride yourself!"
exit trigger
teleport arg 1 to arg 2
make arg 1 ride arg 2
carryNotify(arg 1, arg 2)
command /carry <player>:
description: Request to carry a player onto your head
usage: /carry <who>
permission: gamealition.approved
executable by: players
trigger:
# Conditions
if arg 1 is the player:
message "&c*** You cannot carry yourself!"
exit trigger
if {carry.%arg 1%} is set:
message "&c*** %arg 1% already has a pending carry request"
exit trigger
if command sender's world != arg 1's world:
message "&c*** %arg 1% needs to be in the same world as you"
exit trigger
if distance between command sender and arg 1 > {@max distance}:
message "&c*** %arg 1% needs to be within {@max distance} blocks away from you"
exit trigger
# Logic
set {carry.%arg 1%} to command sender's name
message "*** A carry request has been sent to &a%arg 1%&f!"
message "*** &a%command sender%&f would like to carry you!" to arg 1
message "* To accept: &3/carry-accept" to arg 1
message "* To reject: &3/carry-reject" to arg 1
command /eject:
description: Ejects any passengers on you
usage: /eject
executable by: players
trigger:
# Conditions
if player's passenger is not set:
message "&c*** You have no passengers to eject"
exit trigger
# Logic
set {_passenger} to player's passenger
force {_passenger} to dismount
message "*** You have ejected &a%{_passenger}%&f"
if {_passenger} is a player:
message "*** You have been ejected from &a%command sender%&f" to {_passenger}
command /carry-accept:
description: Accept a request to be carried by a player
usage: /carry-accept
executable by: players
aliases: /carryyes
trigger:
# State
set {_carrier} to {carry.%command sender%} parsed as offline player
# Conditions
if {_carrier} is not set:
message "&c*** You don't have a pending carry request"
exit trigger
if {_carrier} is not online:
message "&c*** %{_carrier}% is offline; carry request deleted"
delete {carry.%command sender%}
exit trigger
if command sender's world != {_carrier}'s world:
message "&c*** %{_carrier}% needs to be in the same world as you"
exit trigger
if distance between command sender and {_carrier} > {@max distance}:
message "&c*** %{_carrier}% needs to be within {@max distance} blocks away from you"
exit trigger
# Logic
make command sender ride {_carrier}
delete {carry.%command sender%}
carryNotify(command sender, {_carrier})
command /carry-reject:
description: Reject a request to be carried by a player
usage: /carry-reject
executable by: players
aliases: /carryno
trigger:
# State
set {_carrier} to {carry.%command sender%} parsed as offline player
# Conditions
if {_carrier} is not set:
message "&c*** You don't have a pending carry request"
exit trigger
if {_carrier} is not online:
message "&c*** %{_carrier}% is offline; carry request deleted"
delete {carry.%command sender%}
exit trigger
# Logic
delete {carry.%command sender%}
message "&c*** %command sender% rejected your carry request" to {_carrier}
message "*** You have rejected &a%{_carrier}%&f's carry request"