Date: 2018/10/25 16:19:02 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
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
CoinFlip_Action:
type: task
definitions: challenger|amount
script:
- if <def[challenger]> == <player> {
- narrate format:CoinFlip_FF "<&c>Du kan ikke coinflip med dig selv"
- queue clear
}
- if <player.money||0> < <def[amount]> {
- narrate FORMAT:CoinFlip_FF "<&c>Du har ikke nok penge."
- queue clear
}
- if <def[challenger].money||0> < <def[amount]> {
- narrate FORMAT:CoinFlip_FF "<&c><def[challenger].name> har ikke nok penge."
- queue clear
}
- if <def[challenger].is_online.not||true> {
- narrate FORMAT:CoinFlip_FF "<&c><def[challenger].name> er ikke længere online."
- queue clear
}
- if <def[challenger].has_flag[CoinFlip_Running]> {
- narrate FORMAT:CoinFlip_FF "<&c><def[challenger].name> er allerede i gang med et coin flip"
- queue clear
}
- if <player.has_flag[CoinFlip_Running]> {
- narrate FORMAT:CoinFlip_FF "<&c>Du er allerede i gang med et coin flip"
- queue clear
}
- flag player CoinFlip_Running duration:1m
- flag <def[challenger]> CoinFlip_Running duration:1m
- money take quantity:<def[amount]> from:<def[challenger]>
- money take quantity:<def[amount]> from:<player>
- define win_amount <def[amount].mul[2]>
- define winner <util.random.int[1].to[2]>
# - define tax <def[amount].div_int[20]>
# - if <def[winner]> == 1 {
# - announce "<&7>CF<&co> <def[winner]> <def[challenger].name> vinder" to_flagged:cf_spy
# }
# else {
# - announce "<&7>CF<&co> <def[winner]> <player.name> vinder" to_flagged:cf_spy
# }
- flag player CoinFlip_Menu_Items:!
- flag <def[challenger]> CoinFlip_Menu_Items:!
- define lore "<&3>Bet<&co> <&6><&l>$<def[amount]>"
- define text "human_skull[skull_skin=<player.uuid>;display_name=<&a><player.name>;lore=<def[lore]>]"
- define text2 "human_skull[skull_skin=<def[challenger].uuid>;display_name=<&a><def[challenger].name>;lore=<def[lore]>]"
- repeat 6 {
- flag player CoinFlip_Menu_Items:->:<def[text]>
- flag player CoinFlip_Menu_Items:->:<def[text2]>
- flag <def[challenger]> CoinFlip_Menu_Items:->:<def[text]>
- flag <def[challenger]> CoinFlip_Menu_Items:->:<def[text2]>
}
# - if <player.location.in_region[spawn]> {
# - define show_gui true
# }
# else {
# - define show_gui false
# }
- define show_gui true
# - if <def[challenger].location.in_region[spawn]> {
# - define show_gui_challenger true
# }
# else {
# - define show_gui_challenger false
# }
- define show_gui_challenger true
- if <def[show_gui]> {
- playsound <player> sound:note_pling pitch:2.0
- inventory open d:in@CoinFlip_Menu_Action_B
}
- if <def[show_gui_challenger]> {
- run CoinFlip_Action_Show_Challenger_B_Force instantly player:<def[challenger]>
}
- repeat 12 {
- run CoinFlip_Action_Show_Challenger_A instantly player:<player> context:<def[show_gui]>
- run CoinFlip_Action_Show_Challenger_A instantly player:<def[challenger]> context:<def[show_gui_challenger]>
- wait 1t
- run CoinFlip_Action_Show_Challenger_B instantly player:<player> context:<def[show_gui]>
- run CoinFlip_Action_Show_Challenger_B instantly player:<def[challenger]> context:<def[show_gui_challenger]>
- wait 1t
}
- repeat 5 {
- run CoinFlip_Action_Show_Challenger_A instantly player:<player> context:<def[show_gui]>
- run CoinFlip_Action_Show_Challenger_A instantly player:<def[challenger]> context:<def[show_gui_challenger]>
- wait 5t
- run CoinFlip_Action_Show_Challenger_B instantly player:<player> context:<def[show_gui]>
- run CoinFlip_Action_Show_Challenger_B instantly player:<def[challenger]> context:<def[show_gui_challenger]>
- wait 5t
}
- repeat 1 {
- run CoinFlip_Action_Show_Challenger_A instantly player:<player> context:<def[show_gui]>
- run CoinFlip_Action_Show_Challenger_A instantly player:<def[challenger]> context:<def[show_gui_challenger]>
- wait 10t
}
# - if <player.is_online.not||true> {
# - money give quantity:<def[win_amount].sub[10]> to:<def[challenger]>
# - narrate FORMAT:CoinFlip_FF "<&a>Du vandt <&6><def[win_amount]> <&a>mod <&b><player.name>" targets:<def[challenger]>
# - playsound <def[challenger]> sound:LEVEL_UP pitch:1.0
# }
# - if <def[challenger].is_online.not||true> {
# - money give quantity:<def[win_amount].mul[2].sub[10]> to:<player>
# - narrate FORMAT:CoinFlip_FF "<&a>Du vandt <&6><def[win_amount]> <&a>mod <&b><def[challenger].name>"
# - playsound <player> sound:LEVEL_UP pitch:1.0
# }
- if <def[winner]> == 1 {
- run CoinFlip_Action_Show_Challenger_B instantly player:<player> context:<def[show_gui]>
- run CoinFlip_Action_Show_Challenger_B instantly player:<def[challenger]> context:<def[show_gui_challenger]>
- wait 1s
- narrate FORMAT:CoinFlip_FF "<&7>Du tabte <&a><&l>$<&b><&l><def[amount]> <&7>mod <&c><&l><def[challenger].name>"
# - money give quantity:<def[win_amount].sub[<def[tax]>]> to:<def[challenger]>
- money give quantity:<def[win_amount]> to:<def[challenger]>
# &7Du vandt &a&l$&b&l12 &7mod &a&lMwthorn
- narrate FORMAT:CoinFlip_FF "<&7>Du vandt <&a><&l>$<&b><&l><def[amount]> <&7>mod <&a><&l><player.name>" targets:<def[challenger]>
- playsound <def[challenger]> sound:LEVEL_UP pitch:1.0
- inventory close d:in@CoinFlip_Menu_Action_B
- run CoinFlip_Action_Close_Challenger_B instantly player:<def[challenger]>
# - run CoinFlip_Add_Stats instantly context:false player:<player>
# - run CoinFlip_Add_Stats instantly context:true player:<def[challenger]>
}
else {
- run CoinFlip_Action_Show_Challenger_B instantly player:<player> context:<def[show_gui]>
- run CoinFlip_Action_Show_Challenger_B instantly player:<def[challenger]> context:<def[show_gui_challenger]>
- wait 10t
- run CoinFlip_Action_Show_Challenger_A instantly player:<player> context:<def[show_gui]>
- run CoinFlip_Action_Show_Challenger_A instantly player:<def[challenger]> context:<def[show_gui_challenger]>
- wait 1s
- narrate FORMAT:CoinFlip_FF "<&7>Du tabte <&a><&l>$<&b><&l><def[amount]> <&7>mod <&c><&l><player.name>" targets:<def[challenger]>
# - money give quantity:<def[win_amount].sub[<def[tax]>]> to:<player>
- money give quantity:<def[win_amount]> to:<player>
- narrate FORMAT:CoinFlip_FF "<&7>Du vandt <&a><&l>$<&b><&l><def[amount]> <&7>mod <&a><&l><def[challenger].name>"
- playsound <player> sound:LEVEL_UP pitch:1.0
- inventory close d:in@CoinFlip_Menu_Action_A
- run CoinFlip_Action_Close_Challenger_A instantly player:<def[challenger]>
# - run CoinFlip_Add_Stats instantly context:true player:<player>
# - run CoinFlip_Add_Stats instantly context:false player:<def[challenger]>
}
- flag player CoinFlip_Running:!
- flag <def[challenger]> CoinFlip_Running:!
- flag <def[challenger]> CoinFlip_Menu_Items:!
# - flag server CoinFlip_Taxes:+:<def[tax]>
- inventory close d:in@CoinFlip_Menu_Action_A
- flag player CoinFlip_Menu_Items:!
- if <player.is_online.not> {
- debug error "<player.name> went offline during CoinFlip"
}
else {
- if <def[show_gui]> {
- inventory open d:in@CoinFlip_Action_Menu_Challengers
}
}
- if <def[challenger].is_online.not> {
- debug error "<def[challenger].name> went offline during CoinFlip"
}
else {
- if <def[show_gui_challenger]> {
- run CoinFlip_Refresh_Menu instantly player:<def[challenger]>
}
}