@Omniraptor
I sent you the wrong /throweff
Here's the real thing..
Code:
internal class ThrowEffCommand : Command
{
public ThrowEffCommand()
: base("throweff", 1)
{
}
protected override bool Process(Player player, RealmTime time, string[] args)
{
if (args.Length < 2)
{
player.SendInfo("Usage: /throweff <player> <effect>");
player.SendInfo("Or");
player.SendInfo("Usage: /throweff <player> <effect> <duration>");
return false;
}
foreach (Client i in player.Manager.Clients.Values)
{
if (i.Account.Name.EqualsIgnoreCase(args[0]))
{
if (args.Length == 2)
{
i.Player.ApplyConditionEffect(new ConditionEffect
{
Effect = (ConditionEffectIndex)Enum.Parse(typeof(ConditionEffectIndex), args[1].Trim(), true),
DurationMS = -1
});
player.SendInfo("You threw " + args[1] + " at " + args[0] + "!");
i.Player.SendInfo(player.Name + " threw " + args[1] + " at you!");
return true;
}
else
{
i.Player.ApplyConditionEffect(new ConditionEffect
{
Effect = (ConditionEffectIndex)Enum.Parse(typeof(ConditionEffectIndex), args[1].Trim(), true),
DurationMS = int.Parse(args[2]) * 1000
});
player.SendInfo("You threw " + args[1] + " at " + args[0] + " for " + args[2] + " seconds!");
i.Player.SendInfo(player.Name + " threw " + args[1] + " at you for " + args[2] + " seconds!");
return true;
}
}
}
player.SendError(string.Format("Player '{0}' could not be found!", args));
return false;
}
}