Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- internal class LotteryCommand : Command
- {
- public LotteryCommand()
- : base("lottery", "Lottery Command - Can be used every 24 hours, if you win, you get gold, if you lose, you get nothing.")
- {
- }
- protected override bool Process(Player player, RealmTime time, string[] args)
- {
- Random rand = new Random();
- string name = player.Name;
- string lottonum = rand.Next(0, 100).ToString();
- if (player.Client.Account.Lottery == false) //false means they are free to use the command
- {
- if (int.Parse(lottonum) > 49)
- {
- player.Manager.Database.DoActionAsync(db =>
- {
- player.Credits = db.UpdateCredit(player.Client.Account, +5000);
- player.UpdateCount++;
- });
- }
- foreach (Client i in player.Manager.Clients.Values)
- {
- i.SendPacket(new TextPacket
- {
- BubbleTime = 0,
- Stars = -1,
- Name = "Lottery - " + name,
- Text = "rolled a " + lottonum
- });
- }
- }
- if (player.Client.Account.Lottery == true) // true means they used the command within the past 24h, so return false
- {
- player.SendError("You've already used this within the past 24 hours");
- return false;
- }
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment