#Dodatek do kasyna stworzony przez Knugi dla MineRP options: guiName: &9Automat do gier on script load: import "org.bukkit.event.inventory.InventoryClickEvent" set {kasyno::automat.itemy::1} to (("336") parsed as item type) named "&7Mnoznik: &c0.5" set {kasyno::automat.itemy::2} to (("265") parsed as item type) named "&7Mnoznik: &c1.1" set {kasyno::automat.itemy::3} to (("266") parsed as item type) named "&7Mnoznik: &c2.0" set {kasyno::automat.itemy::4} to (("264") parsed as item type) named "&7Mnoznik: &c5.0" on sign change: if player has permission "kasyno.admin": if line 1 is "[kasyno]": set line 1 to "&9Dostepny" set line 2 to "" set line 3 to "&9Zagraj" set line 4 to "&9» &2Kliknij &9«" function AUTOMAT_getLatency(actual: integer, max: integer) :: timespan: set {_A} to ({_max}-1)/12 set {_B} to 1-{_A} set {_y} to floor({_actual}*{_A}+{_B}) if {_y} is larger than 13: set {_y} to 13 return "%{_y}% tick" parsed as timespan function AUTOMAT_getWin(t: text ="") :: item: chance of 20%: return {kasyno::automat.itemy::1} chance of 5%: return {kasyno::automat.itemy::2} chance of 3%: return {kasyno::automat.itemy::3} chance of 1%: return {kasyno::automat.itemy::4} return air function AUTOMAT_startGame(p: player): remove 50 from {kasyno::balance::%{_p}%} set {kasyno::automat::%{_p}%} to true set {_win} to AUTOMAT_getWin() set {_1} to random integer between 10 and 15 loop {_1} times: if name of {_p}'s current inventory is "{@guiName}": set slot 12 of {_p}'s current inventory to random item out of {kasyno::automat.itemy::*} wait AUTOMAT_getLatency(loop-number, {_1}) if name of {_p}'s current inventory is "{@guiName}": set slot 13 of {_p}'s current inventory to random item out of {kasyno::automat.itemy::*} wait AUTOMAT_getLatency(loop-number, {_1}) if name of {_p}'s current inventory is "{@guiName}": set slot 14 of {_p}'s current inventory to random item out of {kasyno::automat.itemy::*} wait AUTOMAT_getLatency(loop-number, {_1}) if {_win} is not air: set {_slots::*} to 12, 13 and 14 loop {_slots::*}: if name of {_p}'s current inventory is "{@guiName}": set slot loop-value of {_p}'s current inventory to {_win} wait 1 second else: set {_slots::*} to 12, 13 and 14 set {_it::*} to {kasyno::automat.itemy::*} loop {_slots::*}: set {_a} to random item out of {_it::*} if name of {_p}'s current inventory is "{@guiName}": set slot loop-value of {_p}'s current inventory to {_a} remove {_a} from {_it::*} wait 1 second set {_n} to uncoloured name of {_win} replace all "Mnoznik: " with "" in {_n} set {_n} to {_n} parsed as number if {_n} is number: add 50*{_n} to {kasyno::balance::%{_p}%} set {_n} to "&7Wygrales: &c%50*{_n}% zetonow&7." else: set {_n} to "&7Nic nie wygrywasz!" send "%{_n}%" to {_p} clear {kasyno::automat::%{_p}%} function AUTOMAT_getInventory(p: player) :: inventory: set {_x} to chest with 3 rows named "{@guiName}" loop 27 times: set slot ((loop-number)-1) of {_x} to gray glass named "&7" set slot 26 of {_x} to lever named "&7Zagraj ponownie" return {_x} on inventory close: if inventory name of player's current inventory is "{@guiName}": clear {kasyno::automat::%player%} on rightclick on sign: if line 1 is "&9Dostepny": if line 4 is "&9» &2Kliknij &9«": if {kasyno::automat::%player%} is not set: if {kasyno::balance::%player%} is larger than or equal to 50: open AUTOMAT_getInventory(player) to player wait 2 tick AUTOMAT_startGame(player) stop send "&7Nie posiadasz &c50 zetonow&7." stop send "&7Juz jestes w grze." on "org.bukkit.event.inventory.InventoryClickEvent": set {_top} to event.getWhoClicked().getOpenInventory().getTopInventory() if inventory name of {_top} is "{@guiName}": cancel event if event.getRawSlot() is 26: if {kasyno::automat::%{_p}%} is not set: if {kasyno::balance::%{_p}%} is larger than or equal to 50: AUTOMAT_startGame({_p}) stop send "&7Nie posiadasz &c50 zetonow&7." to {_p} stop send "&7Juz jestes w grze." to {_p}