So I have a method who starts a timer with a command and I wanna kill the same timer in another method. How would I do that?
I know I am suppose to use replyTimer.Destory(); But since replyTimer is a local varible inside CommandReply I can't do it.
My code looks like this:
using Oxide.Core.Libraries.Covalence;
namespace Oxide.Plugins
{
[Info("test", "warmerspy", "0.1")]
public class test : CovalencePlugin
{
[Command("reply")]
void CommandReply(IPlayer player, string cmd, string[] args)
{
Puts("started reply");
Timer replyTimer = timer.Every(3f, () =>
{
player.Reply("Hey there player!");
});
}
[Command("stopreply")]
void CommandStopReply(IPlayer player, string cmd, string[] args)
{
//I wanna kill the timer here
}
}
}
I know I am suppose to use replyTimer.Destory(); But since replyTimer is a local varible inside CommandReply I can't do it.
My code looks like this:
using Oxide.Core.Libraries.Covalence;
namespace Oxide.Plugins
{
[Info("test", "warmerspy", "0.1")]
public class test : CovalencePlugin
{
[Command("reply")]
void CommandReply(IPlayer player, string cmd, string[] args)
{
Puts("started reply");
Timer replyTimer = timer.Every(3f, () =>
{
player.Reply("Hey there player!");
});
}
[Command("stopreply")]
void CommandStopReply(IPlayer player, string cmd, string[] args)
{
//I wanna kill the timer here
}
}
}