Date: 2014/01/26 22:27:03 UTC-08: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
SignClickGetTitleEvents:
type: world
events:
on player changes sign:
- if <player.is_op> && <context.new.get[1]> == "[Title]" {
- if <context.new.get[2]> == "" narrate "Line 2 must be the title the player will be receive!"
else if <context.new.get[4]> != "" && <context.new.get[4].as_int> == null narrate "Line 4 must be a valid number!"
else {
- if !<global.flag[TitleSigns].contains[<context.location>]> flag global "TitleSigns:->:<context.location>"
- define type "<context.material.bukkit_enum>"
- define line1 "<&lb><&b>Title<&r><&rb>"
- define line2 "<context.new.get[2]>"
- define line4 "<context.new.get[4].as_int||200>"
- define location "<context.location>"
- inject s@DelayedSignClickGetTitleTask
}
}
on player right clicks wall_sign:
- if <global.flag[TitleSigns].contains[<context.location>]>
run s@SignClickGetTitleTask "def:li@<context.location.sign_contents.get[2]>|<context.location.sign_contents.get[4].substring[2]>"
on player right clicks sign_post:
- if <global.flag[TitleSigns].contains[<context.location>]>
run s@SignClickGetTitleTask "def:li@<context.location.sign_contents.get[2]>|<context.location.sign_contents.get[4].substring[2]>"
DelayedSignClickGetTitleTask:
type: task
script:
- sign type:%type% "li@%line1%|%line2%||$%line4%" %location%
SignClickGetTitleTask:
type: task
definitions: title|cost
script:
- if <player.money||0> < %cost% narrate "You don't have enough money for that title!"
else {
- execute as_server "manuaddv <player.name> suffix %title%"
- take money qty:%cost%
- narrate "Congratulations! You now have the title<&co> %title%"
}