Full Version : HealSelf - command
xmlspawner >>Scripting Support >>HealSelf - command


<< Prev | Next >>

semolo- 01-18-2007
QUOTE
using System;
using System.Collections;
using System.IO;
using Server;
using Server.Items;
using Server.Mobiles;
using Server.Commands;

namespace Server.Scripts.Commands
{
public class HealSelf
{
  public static void Initialize()
  {
  CommandSystem.Register( "Healself", AccessLevel.Player, new CommandEventHandler( HealSelf_OnCommand ) );
  }

  [Usage( "HealSelf" )]
  public static void HealSelf_OnCommand( CommandEventArgs e )
  {
  Mobile from = e.Mobile;
  if (from==null) return;
  Container bp = from.Backpack;
  if (bp==null) return;
  GreaterHealPotion ha = (GreaterHealPotion)bp.FindItemByType( typeof( GreaterHealPotion ));
  LesserHealPotion hb = (LesserHealPotion)bp.FindItemByType( typeof( LesserHealPotion ));
  HealPotion hc = (HealPotion)bp.FindItemByType( typeof( HealPotion ));
  if ( ha != null )
    {
    ha.DoHeal( from );
    ha.Delete();
    from.AddToBackpack( new Bottle() );
    return;
    }
  if ( hb != null )
    {
    hb.DoHeal( from );
    hb.Delete();
    from.AddToBackpack( new Bottle() );
    return;
    }
  if ( hc != null )
    {
    hc.DoHeal( from );
    hc.Delete();
    from.AddToBackpack( new Bottle() );
    return;
    }
  from.SendMessage("You must have heal potions in your backpack to heal!");
  return;
  }
}
}

Greetings, help!:) how to make a delay? What to drink Bottle it would be possible time in 10 seconds? Help