Lottery Skript

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

DereWah

New Member
Jul 19, 2019
0
0
0
LOTTERY SKRIPT

With this skript, players will be able to buy a ticket and join the lottery. After a specified amount of time (You can configure it in-game with a GUI) the lottery will draw a random winner between those who bought a ticket and will give them the prize (in-game money). The winning will be the sum of all the prices of the tickets sold. Every player can get 1 ticket per draw. You can easily setup the plugin with an ingame menu.

The plugin will automatically start lotteries one after the other, with a settable cooldown. During the cooldown players will be able to buy tickets.

Requirements
A economy plugin combatible with skript (EssentialsEco)
Skript
Sk-Perm
SkQuery
SkRayFall
Skript-JSON
TuSKe

Permissions
lottery.manage - Players with this permission will be able to access to setup GUI.

GUI
To access the gui use /lottery

agm6PvJ.png

- The first item (paper) will show the remaining time before the draw.
- Click the second item (golden ingot) to buy a ticket for the lottery.
- With the third item (redstone) you can see the winner of the last draw.
- The diamond will show the current amount of the prize. The winning is the sum of the price of every ticket sold.
-The nametag shows credits the author of the plugin (me). You can disable it in the setup GUI.
-The red wool block is shown only to players who have the permission "lottery.manage". Use it to access to the setup GUI.

Setup GUI

1Wx6nE9.png

- The compass allows you to setup the time between draws. Default is 30 seconds.
- The nametag allows you to set the prefix of every chat message from the skript. For example:
"[prefixyouwant] Notch has won the lottery!"
- With the golden ingot you can set the price for each ticket. Default is 50$.
- With the first wool you will be able to enable or disable lottery alerts! When this option is on, the lottery will send a reminder to every player!
The alert shows at mid time between two draws. (Sorry for my english lel, let me give you an example).
If you set the timer between draws to 20 seconds, the alert will be shown when the timer has got to its half. So if you set the timer to 1 hour, alert will show when it reaches 30 minutes. The half. Default: OFF
- With the second wool you can enable / disable the credit nametag in the lottery menu. Default: ON
With the third wool you can enable or disable the skript. Default: ON
If you disable the lottery, the timer will be paused and players will still be able to open the gui, but not to buy tickets (They would waste money).
- With the barrier you can get back to the lottery menu.

Version 1.1
- Now when a player buy a ticket, every player will be alerted. You can choose to disable this option in the Setup GUI Default: ON
- Now using rhe barrier in the setup GUI to get back to the /lottery GUI works properly.
- Current Skript version is shown in the credit section. Players with permission lottery.manage will always see the credit option, even if disabled for normal players.

Coming soon:
- Allow VIP players to buy more than one ticket! (Different number of tickets per different ranks, you will also be able to set the default amount of ticket per players in default group.)

Thank you for the attention, Dere :emoji_slight_smile:


If you have any problem ask in the discussion of this skript!



When, at the moment of drawing, no players are in the lottery, the draw will be cancelled and it will start the cooldown for the next one. (To avoid plugin flood / bad looking messages with <none>)

This is one of my firsts plugins, so if it has any problem don't bother asking me for support. :emoji_slight_smile:

Thanks yall for the attention, DereWah

Uh, and please leave a rating (stars) to let me know how you find the skript!



As said, for any issues use the discussion related to this resource