Create delay.cs
This commit is contained in:
parent
6162d2e678
commit
d5a394dd23
1 changed files with 29 additions and 0 deletions
29
Core/Commands/Helpers/delay.cs
Normal file
29
Core/Commands/Helpers/delay.cs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
using System.Text;
|
||||
using System.Threading;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace BSB.Commands.Helpers
|
||||
{
|
||||
public class Delay : CoreCommand_1arg
|
||||
{
|
||||
public override string[] ArgTypes { get { return new[] { "Number" }; } }
|
||||
public override string[] ArgHints { get { return new[] { "Delay in MS" }; } }
|
||||
public override string Helpfile { get { return "Delays a thead by X ms<br/>Mostly pointless but good if your doing custom commands"; } }
|
||||
public override bool CallFunction(string[] args)
|
||||
{
|
||||
if (base.CallFunction(args) == true)
|
||||
{
|
||||
if (int.TryParse(args[0], out int delayms) == true)
|
||||
{
|
||||
Thread.Sleep(delayms);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Failed("Delay is not vaild");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue