Jeżeli zależy ci na skrypcie, proszę. Dodałem do skryptu dwa przykładowe enchanty, powinieneś się w tym połapać. W wywoływaniu funkcji enchantItemGUI() (ona odpowiada na sprawdzanie kasy gracza i nakładanie enchantu, jest w 3 od końca i ostatniej linijce) pierwsza wartość to gracz, zawsze podajesz player, druga to typ enchantu czyli podajesz nazwę enchantu wraz z poziomem, a trzecia wartość to wymagana kasa.
Do działania skryptu wymagany Skript 2.2+, plugin wprowadzający ekonomię na serwerze oraz Vault.
function enchantItemGUI(p: player, e: enchantment type, m: integer) :: boolean:
if {_p}'s tool is enchanted with {_e}:
send "&cTwój przedmiot w ręce już posiada ten enchant!" to {_p}
return false
if {_p}'s balance is less than {_m}:
send "&cNie posiadasz wystarczająco pieniędzy!" to {_p}
return false
remove {_m} from {_p}'s balance
enchant {_p}'s tool with {_e}
send "&aPomyślnie zaczarowano twój przedmiot w ręce!" to {_p}
command /enchanty:
trigger:
set {_gui} to chest inventory with 4 rows named "&5&lEnchanty"
set slot ((integers between 0 and 8) and (integers between 27 and 35)) of {_gui} to white stained glass pane named " "
set slot 9 of {_gui} to enchanted book of sharpness 5 named "&bSharpness V" with lore "&7Koszt: &61000$"
set slot 10 of {_gui} to enchanted book of protection 4 named "&bProtection IV" with lore "&7Koszt: &61000$"
open {_gui} to player
on inventory click:
name of player's current inventory is "&5&lEnchanty"
clicked inventory is not player's inventory
cancel event
if clicked slot is 9:
enchantItemGUI(player, sharpness 5, 1000)
else if clicked slot is 10:
enchantItemGUI(player, protection 4, 1000)