I the code below I am looking to stop the timer so that the player position no longer displays.
The timer stoping message displays but the message keeps displaying.
Please let me know what I missed!
Thanks!
using Oxide.Core.Libraries.Covalence;
using Oxide.Game.Rust.Libraries;
namespace Oxide.Plugins
{
[Info("New Where", "PEBKAC Error", "1.0")]
[Description("Same as whereami except that Covalence / IPlayer is used")]
public class newwhere : CovalencePlugin
{
bool dotimer = true;
private void Init()
{
Puts("NewWhere mod Initialized");
}
[Command("newwhere")]
private void WhereCommand(IPlayer player, string command, string[] args)
{
if (dotimer)
timer.Every(10f, () =>
{
player.Reply($"You are at {player.Position()}");
});
else
{
return;
}
}
[Command("stop")]
private void StopTimer(IPlayer player, string command, string[] args)
{
player.Reply("Timer would have been stopped!");
dotimer = false;
}
}