ServUO Version
Publish 57
Ultima Expansion
Time Of Legends
Hello,im trying to get delay for use the command,but cant find the way,can anyone guide me please?Here the command.

C#:
using Server;
using System;
using Server.Commands;
using Server.Targeting;
using System.Linq;
using Server.Mobiles;
using Server.Network;
using Server.Engines.Points;

namespace Custom.Commands
{
    public static class Doom
    {
        public static void Initialize()
        {
            CommandSystem.Register("Doom", AccessLevel.Player, new CommandEventHandler(OnCommand));
        }

        [Usage("Doom")]
        [Description("Display Doom points")]
        static void OnCommand(CommandEventArgs e)
        {
            PlayerMobile pm = e.Mobile as PlayerMobile;

            double gpoints = pm.PointSystems.GauntletPoints;

            const double A = 0.000863316841;
            const double B = 0.00000425531915;

            double chance = A * Math.Pow(10, B * gpoints);
            

            pm.PublicOverheadMessage(MessageType.Emote ,1153, true, "Got "+pm.PointSystems.GauntletPoints+" points!\nMy drop chance is "+(chance.ToString("p02"))+"!" );
        }
    }
}
 
Try to use default action lockers:

C#:
        [Usage("Doom")]
        [Description("Display Doom points")]
        static void OnCommand(CommandEventArgs e)
        {

            PlayerMobile pm = e.Mobile as PlayerMobile;

            if (pm.CanBeginAction(pm))
            {
                double gpoints = pm.PointSystems.GauntletPoints;

                const double A = 0.000863316841;
                const double B = 0.00000425531915;

                double chance = A * Math.Pow(10, B * gpoints);

                pm.PublicOverheadMessage(MessageType.Emote, 1153, true, "Got " + pm.PointSystems.GauntletPoints + " points!\nMy drop chance is " + (chance.ToString("p02")) + "!");
                pm.BeginAction(pm);

                Timer.DelayCall(TimeSpan.FromSeconds(5), () => pm.EndAction(pm));
            }
            else
                pm.SendMessage("You have to wait before use this command.");
        }
 
Back