Admin/N> Command.cs

Posts 1–2 of 2 · Page 1 of 1
Admin/N> Command.cs
I present to you /tosseff and /remtosseff

Usage_1 :: /tosseff <playername> <Effectname or Effectnumber>
Usage_2 :: /remtosseff <playername> <Effectname or Effectnumber>

Example_1 :: /tosseff TheFirstSin Bleed
This will make me bleed forever...
Example_2 :: /remtosseff TheFirstSin Bleed
This will stop the bleeding effect...

 
CODE
Code:

    internal class TossEffCommand : Command
    {
        public TossEffCommand()
            : base("tosseff", 1)
        {
        }

        protected override bool Process(Player player, RealmTime time, string[] args)
        {
            if (args.Length != 2)
            {
                player.SendHelp("Usage: /tosseff <PlayerName> <Effectname or Effectnumber>");
                return false;
            }
            try
            {
                foreach (KeyValuePair<string, Client> i in player.Manager.Clients.Where(i => i.Value.Player.Name.EqualsIgnoreCase(args[0])))
                {
                    i.Value.Player.ApplyConditionEffect(new ConditionEffect
                    {
                        Effect =
                            (ConditionEffectIndex) Enum.Parse(typeof (ConditionEffectIndex), args[1].Trim(), true),
                        DurationMS = -1
                    });
                    player.SendInfo("Success!");
                }
            }
            catch
            {
                player.SendError("Invalid effect or player name! ");
                return false;
            }
            return true;
        }
    }


 
CODE2
Code:

    internal class RemoveTossEffCommand : Command
    {
        public RemoveTossEffCommand()
            : base("remtosseff", 1)
        {
        }

        protected override bool Process(Player player, RealmTime time, string[] args)
        {
            if (args.Length != 2)
            {
                player.SendHelp("Usage: /tosseff <PlayerName> <Effectname or Effectnumber>");
                return false;
            }
            try
            {
                 foreach (KeyValuePair<string, Client> i in  player.Manager.Clients.Where(i =>  i.Value.Player.Name.EqualsIgnoreCase(args[0])))
                {
                    i.Value.Player.ApplyConditionEffect(new ConditionEffect
                    {
                        Effect =
                            (ConditionEffectIndex) Enum.Parse(typeof (ConditionEffectIndex), args[1].Trim(), true),
                        DurationMS = 0
                    });
                    player.SendInfo("Success!");
                }
            }
            catch
            {
                player.SendError("Invalid effect or player name! ");
                return false;
            }
            return true;
        }
    }


Any Questions or Concerns PM me @</The First Sin/>


- - - Updated - - -

@Danny @Luis close it, anyone wanting to speak with me just pm.
/closed as per
Posts 1–2 of 2 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us