Cratekey Shop

#1
Incase y'all wanna make players buy their own keys or they can't get keys from mining then here's this command to get it started! Created with the help of GreenBoy657

Code:
cmd create keyshop §b|§e Buy keys!
cmd add keyshop §b|§e Buy keys!
cmd add keyshop %player% = %p%
cmd add keyshop if varset(%args%[1]) then %player% = %args%[1]
cmd add keyshop %gui%[\"type\"] = \"form\"
cmd add keyshop %gui%[\"title\"] = \"§aKeys\"
cmd add keyshop %gui%[\"content\"] = \"§bSelect amount\"
cmd add keyshop %button0%[\"text\"] = \"§e1 Key\"
cmd add keyshop %button1%[\"text\"] = \"§e5 Keys\"
cmd add keyshop %button2%[\"text\"] = \"§e10 Keys\"
cmd add keyshop %buttons%[] = %button0%
cmd add keyshop %buttons%[] = %button1%
cmd add keyshop %buttons%[] = %button2%
cmd add keyshop %gui%[\"buttons\"] = %buttons%
cmd add keyshop %response% = dialog(%p%, %gui%) keyshop %player% = %p%
cmd add keyshop if varset(%args%[1]) then %player% = %args%[1]
cmd add keyshop %gui%[\"type\"] = \"form\"
cmd add keyshop %gui%[\"title\"] = \"§aKeys\"
cmd add keyshop %gui%[\"content\"] = \"§bSelect amount\"
cmd add keyshop %button0%[\"text\"] = \"§e1 Key\"
cmd add keyshop %button1%[\"text\"] = \"§e5 Keys\"
cmd add keyshop %button2%[\"text\"] = \"§e10 Keys\"
cmd add keyshop %buttons%[] = %button0%
cmd add keyshop %buttons%[] = %button1%
cmd add keyshop %buttons%[] = %button2%
cmd add keyshop %gui%[\"buttons\"] = %buttons%
cmd add keyshop %response% = dialog(%p%, %gui%)
cmd add keyshop if %response% = 0 then goto 18
cmd add keyshop if %response% = 1 then goto 25
cmd add keyshop if %response% = 2 then goto 36
cmd add keyshop exit
cmd add keyshop let %bal% = playerbalance(%p%)
cmd add keyshop if %bal% < 10000 then message %p% §f[§4§f]§c You do not have enough money! ($10,000)
cmd add keyshop if %bal% < 10000 then exit
cmd add keyshop ascon /takemoney %p% 10000
cmd add keyshop ascon /givecratekey %p%
cmd add keyshop message %p% §f[§e•§f]§b You have successfully bought §e1 CrateKey§b!
cmd add keyshop exit
cmd add keyshop let %bal% = playerbalance(%p%)
cmd add keyshop if %bal% < 50000 then message %p% §f[§4§f]§c You do not have enough money! ($50,000)
cmd add keyshop if %bal% < 50000 then exit
cmd add keyshop ascon /takemoney %p% 50000
cmd add keyshop ascon /givecratekey %p%
cmd add keyshop ascon /givecratekey %p%
cmd add keyshop ascon /givecratekey %p%
cmd add keyshop ascon /givecratekey %p%
cmd add keyshop ascon /givecratekey %p%
cmd add keyshop message %p% §f[§e•§f]§b You have successfully bought §e5 CrateKeys§b!
cmd add keyshop exit
cmd add keyshop let %bal% = playerbalance(%p%)
cmd add keyshop if %bal% < 100000 then message %p% §f[§4§f]§c You do not have enough money! ($100,000)
cmd add keyshop if %bal% < 100000 then exit
cmd add keyshop ascon /takemoney %p% 100000
cmd add keyshop ascon /givecratekey %p%
cmd add keyshop ascon /givecratekey %p%
cmd add keyshop ascon /givecratekey %p%
cmd add keyshop ascon /givecratekey %p%
cmd add keyshop ascon /givecratekey %p%
cmd add keyshop ascon /givecratekey %p%
cmd add keyshop ascon /givecratekey %p%
cmd add keyshop ascon /givecratekey %p%
cmd add keyshop ascon /givecratekey %p%
cmd add keyshop ascon /givecratekey %p%
cmd add keyshop message %p% §f[§e•§f]§b You have successfully bought §e10 CrateKeys§b!
 
#7
Here's how the code should look like
Code:
cmd create keyshop §b|§e Buy Keys!
1 %player% = %p%
2 if varset(%args%[1]) then %player% = %args%[1]
3 %gui%["type"] = "form"
4 %gui%["title"] = "Keys"
5 %gui%["content"] = "Select amount"
6 %button0%["text"] = "1 Key"
7 %button1%["text"] = "5 Keys"
8 %button2%["text"] = "10 Keys"
9 %buttons%[] = %button0%
10 %buttons%[] = %button1%
11 %buttons%[] = %button2%
12 %gui%["buttons"] = %buttons%
13 %response% = dialog(%p%, %gui%)
14 if %response% = 0 then goto 18
15 if %response% = 1 then goto 25
16 if %response% = 2 then goto 36
17 exit
18 let %bal% = playerbalance(%p%)
19 if %bal% < 10000 then message %p% [] You do not have enough money! ($10,000)
20 if %bal% < 10000 then exit
21 ascon /takemoney %p% 10000
22 ascon /givecratekey %p%
23 message %p% [•] You have successfully bought 1 CrateKey!
24 exit
25 let %bal% = playerbalance(%p%)
26 if %bal% < 50000 then message %p% [] You do not have enough money! ($50,000)
27 if %bal% < 50000 then exit
28 ascon /takemoney %p% 50000
29 ascon /givecratekey %p%
30 ascon /givecratekey %p%
31 ascon /givecratekey %p%
32 ascon /givecratekey %p%
33 ascon /givecratekey %p%
34 message %p% [•] You have successfully bought 5 CrateKeys!
35 exit
36 let %bal% = playerbalance(%p%)
37 if %bal% < 100000 then message %p% [] You do not have enough money! ($100,000)
38 if %bal% < 100000 then exit
39 ascon /takemoney %p% 100000
40 ascon /givecratekey %p%
41 ascon /givecratekey %p%
42 ascon /givecratekey %p%
43 ascon /givecratekey %p%
44 ascon /givecratekey %p%
45 ascon /givecratekey %p%
46 ascon /givecratekey %p%
47 ascon /givecratekey %p%
48 ascon /givecratekey %p%
49 ascon /givecratekey %p%
50 message %p% [•] You have successfully bought 10 CrateKeys!
51 exit