-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbank notes.sk
44 lines (41 loc) · 1.71 KB
/
bank notes.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
function withdraw(amount: number, p: player):
set {_u} to {_p}'s uuid
if {_amount} is less than or equal to 0:
send "&cError! you can not withdraw less than 0!" to {_p}
else if {balance::%{_u}%} >= {_amount}:
send "&aWithdrew %{_amount}% from your account!" to {_p}
remove {_amount} from {balance::%{_u}%}
give {_p} paper named "&6&lBank Note" with lore "&aIssued by: %{_p}%" and "&aAmount: $%{_amount}%"
else:
send "&cError! Insufficient Balance." to {_p}
function deposit(p: player):
set {_u} to {_p}'s uuid
set {_amount} to uncolored line 2 of lore of {_p}'s held item
replace all "Amount: $" in {_amount} with ""
set {_item} to {_p}'s held item
remove 1 of {_item} from {_p}
set {_amount} to {_amount} parsed as integer
add {_amount} to {balance::%{_u}%}
send "&a Sucessfully deposited $%{_amount}% &ainto your account!" to {_p}
command /banknote [<text>] [<integer>]:
usage: /note help
aliases: /note
trigger:
if arg 1 is "help":
send "&aUsage: /note (deposit/withdraw) (amount)"
else if arg 1 is "withdraw":
if arg 2 is set:
withdraw(arg-2, player)
else:
send "&cError! Please specify an amount."
else if arg 1 is "deposit":
if player's held item is paper:
if name of player's held item is "&6&lBank Note":
deposit(player)
else:
send "&cError! You are not holding a banknote."
else:
send "&cError! You are not holding a banknote."
on right click with paper:
if name of player's held item is "&6&lBank Note":
deposit(player)