-
Notifications
You must be signed in to change notification settings - Fork 2
/
pvp.sk
126 lines (105 loc) · 5.14 KB
/
pvp.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
# ### PVP system by Roy Curtis
# ### Licensed under MIT, 2015
# ### Global variables
# pvp.%uuid%.enabled - boolean; if unset, assume PVP command never used before
# laser.%uuid%.enabled - boolean; if unset, assume lasertag command never used before
# ### Commands
command /clearpvp <player>:
description: Clear PVP & lasertag data for player
permission: gamealition.admin
trigger:
delete {pvp.%uuid of arg 1%.enabled}
delete {laser.%uuid of arg 1%.enabled}
message "&7*** Cleared PVP & laser tag state for %arg 1%"
command /pvp:
description: Toggles whether you are in PVP mode or not
permission: gamealition.group.player
executable by: players
trigger:
# First time message
if {pvp.%uuid of player%.enabled} is not set:
message "*** This command will &lenable player-versus-player&r for"
message " you, allowing other players to hurt and kill you."
message "If you are sure you want to enable this, type &3/pvp&r again."
message "&7You will only get this message once."
set {pvp.%uuid of player%.enabled} to false
exit trigger
if {laser.%uuid of player%.enabled} is true:
message "&7*** Disabled laser tag mode for PVP"
set {laser.%uuid of player%.enabled} to false
if {pvp.%uuid of player%.enabled} is false:
message "*** PVP mode is &cenabled&r. Use &3/pvp&r again to disable."
set {pvp.%uuid of player%.enabled} to true
else:
message "*** PVP mode is &adisabled&r. Use &3/pvp&r again to enable."
set {pvp.%uuid of player%.enabled} to false
command /lasertag:
description: Toggles whether you are in laser tag mode or not
permission: gamealition.group.player
executable by: players
trigger:
# First time message
if {laser.%uuid of player%.enabled} is not set:
message "*** This command will &lenable laser tag&r for you, allowing"
message " other players to distance hit you (without damage)."
message "If you are sure you want to enable this, type &3/lasertag&r again."
message "&7You will only get this message once."
set {laser.%uuid of player%.enabled} to false
exit trigger
if {pvp.%uuid of player%.enabled} is true:
message "&7*** Disabled PVP mode for laser tag"
set {pvp.%uuid of player%.enabled} to false
if {laser.%uuid of player%.enabled} is false:
message "*** Laser tag mode is &cenabled&r. Use &3/lasertag&r again to disable."
set {laser.%uuid of player%.enabled} to true
else:
message "*** Laser tag mode is &adisabled&r. Use &3/lasertag&r again to enable."
set {laser.%uuid of player%.enabled} to false
on damage of player:
attacker is player
# Bugfix for enderpearls
if attacker is victim:
exit trigger
# If either player are quarried, let DERPI handle
if {derpi.%attacker's uuid%.quarried} is set:
exit trigger
if {derpi.%victim's uuid%.quarried} is set:
exit trigger
# Handle laser tag first
if {laser.%uuid of attacker%.enabled} is true:
if {laser.%uuid of victim%.enabled} is false:
message "&c*** That player is not in lasertag mode" to attacker
else if projectile exists:
delete the projectile
play ender signal on the victim
message "*** You hit &a%victim%&f!" to attacker
message "*** &c%attacker%&f hit you with &c%type of attacker's weapon%&f!" to victim
execute console command "/playsound entity.villager.hurt neutral %victim% ~ ~ ~ 1 1 1"
execute console command "/playsound entity.player.levelup neutral %attacker% ~ ~ ~ 1 1 1"
# Bugfix for fire arrows
if projectile is on fire:
extinguish the victim
cancel the event
exit trigger
# Allow PVP if both have PvP flags are set
if {pvp.%uuid of attacker%.enabled} is true:
{pvp.%uuid of victim%.enabled} is true
exit trigger
if {pvp.%uuid of victim%.enabled} is false:
message "&c*** That player is not in PvP mode" to attacker
else if {pvp.%uuid of victim%.enabled} is not set:
message "&c*** That player is not in PvP mode" to attacker
else if {pvp.%uuid of attacker%.enabled} is false:
message "&c*** You are not in PvP mode. Use &f/pvp&c to enable." to attacker
else if {pvp.%uuid of attacker%.enabled} is not set:
message "&c*** You are not in PvP mode. Use &f/pvp&c to enable." to attacker
# Bugfix for fire arrows
if projectile is on fire:
extinguish the victim
cancel the event
on player join:
wait 1 second
if {pvp.%uuid of player%.enabled} is true:
message "&c*** You are still in PvP mode. Use &3/pvp&c to disable."
else if {laser.%uuid of player%.enabled} is true:
message "&c*** You are still in laser tag mode. Use &3/lasertag&c to disable."