ottery_command: type: command name: lottery description: Main command for Lottery plugin usage: "/lottery help" script: - define opt - if !contains : - define opt help - inject locally path: help: - narrate "<&e><&l>Lottery help" - narrate "<&e>/lottery help - <&7>Displays this page" - narrate "<&e>/lottery tickets - <&7>Displays the amount of tickets you currently have" - narrate "<&e>/lottery buy (amount) - <&7>Buy lottery tickets" - narrate "<&e> 1 ticket = 100$" - narrate "<&e>/lottery time - <&7>The time until the lottery starts" buy: - if !: - narrate "<&e><&l>Lottery > <&7>Please specify a number input." - stop - if > 100: - narrate "<&e><&l>Lottery > <&7>The max amount of tickets you can buy is 100." - stop - if > : - narrate "<&e><&l>Lottery > <&7>You don't have enough money to buy " - stop - if >= 100: - narrate "<&e><&l>Lottery > <&7>You already have the max amount of tickets. ()" - stop - flag player tickets:++: - money take quantity: from: - narrate "<&e><&l>Lottery > <&7>You bought tickets." tickets: - narrate "<&e><&l>Lottery > <&7>You have <&a> <&7>tickets." time: - narrate "to do yet" loterry_events: type: world debug: false events: on lst command: - define tickets - foreach : - define tickets /]> - define sorted - if : - announce "<&e><&l>Lottery > <&7>The Lottery had no winner." - stop - if ]].size> > 1: - define winner ]].random[1]> - else: - define winner - announce "<&e><&l>Lottery > <&a><&l> <&7>has won the lottery and won <&e>$" - money give quantity: to: - narrate "<&e><&l>Lottery > <&7>You have won the lottery and received <&a><&7>." targets: - narrate "<&e><&l>Lottery > <&7>New balance: <&a>" targets: - flag tickets:0