Date: 2018/06/06 06:18:20 UTC-07:00
Type: Denizen Script
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
VoteMute:
type: command
name: VoteMute
description: "Start a poll to mute a player if a Staff Member isn't online!"
usage: "/votemute <player> <reason>"
script:
- if <server.list_online_players.filter[has_permission[essentials.mute]].size> !== 0 {
- inject locally path:Deny
}
else {
- inject locally path:Allow
}
Deny:
- narrate "<&6>[<&e>SC<&6>] <&c>You cannot use that command if a staff member is online!"
Allow:
- flag server ongoing:1
- define mp <server.match_player[<c.args.get[1]||null>]||false>
- if <context.args.get[1]||null> == null {
- narrate "<&c>You must specify a player."
- queue clear
}
- if <def[mp].is[==].to[false]> {
- narrate "<&e><context.args.get[1]> <&c>is not a valid player."
- queue clear
}
- if <context.args.get[2]||null> == null {
- narrate "<&c>You must specify a reason."
- queue clear
}
- announce "<&a>A Vote Poll has been opened!"
- ^announce "<&a>For player: <&d><context.args.get[1]>"
- ^announce "<&a>Reason: <&d><context.args.exclude[<context.args.get[1]>]"
- ^announce ""
- ^announce "<&a>Vote yes with <&d>/voteyes"
- ^announce "<&a>Vote no with <&d>/voteno"
- ^announce "<&7>The poll will end in ten minutes if enough players don't vote!"
- wait 10m
- if <player.flag[mute].round> >= 3 {
- announce "<&a>The Vote Pull has ended!"
- announce "<&d><c.args.get[1]> <&a>has been muted!"
- flag server ongoing:!
}
else if !<player.has_flag[muted> || <player.flag[muted].round> < 3 {
- announce "<&a>The vote poll has ended!"
- announce "<&d><c.args.get[1]> <&a>has not been muted!"
- flag server ongoing:!
}
votes_handler:
type: world
debug: false
events:
on voteyes command:
- if !<server.has_flag[ongoing]> {
- narrate "<&6>[<&e>SC<&6>] <&c>No pool is ongoing now! Use /votemute to start a poll if a staff member is not online!"
- queue clear
}
- if <<def[mp]>.flag[mute].round> < 3 {
- flag <def[mp]> mute:+:1
- narrate "<&6>[<&e>SC<&6>] <&c>You've successfilly voted!"
- announce "<&a><player.name> has voted!"
- announce "<&a><<def[mp]>.flag[mute].round><&f>/<&a>3 votes!"
}
on voteno command:
- flag <def[mp]> mute:-:1
on system time minutely:
- if <server.has_flag[ongoing]> {
- if <<def[mp]>.flag[mute].round> == 3 {
- flag server ongoing:!
- flag <def[mp]> mute:!
- flag <def[mp]> muted:1 d:30m
- announce "<&6>[<&e>SC<&6>] <&a>The poll has ended!"
- announce "<&6>[<&e>SC<&6>] <&d><def[mp]> <&a>has been muted!"
}
}
- if <server.has_flag[ongoing] {
- if <<def[mp]>.flag[mute].round> == -3 {
- flag server ongoing:!
- flag <def[mp]> mute:!
- announce "<&6>[<&e>SC<&6>] <&a>The poll has ended!"
- announce "<&6>[<&e>SC<&6>] <&d><def[mp]> <&a>is will not be muted!"
}
}
on player chats:
- if <player.has_flag[muted]> {
- narrate "<&6>[<&e>SC<&6>] <&c>You cannot talk because you are currently muted!"
- determine cancelled
}