Hey there!
I have spotted a race condition when a player disconnects while a "gametip" is shown in:
- SendToastToActivePlayers
Timer of 20s has failed in 'Guess The Number v2.2.3 by Mabel' [callback] (Object reference not set to an instance of an object) at void BasePlayer.SendConsoleCommand(string command, params object[] obj) at void Oxide.Plugins.GuessTheNumber.SendToastToActivePlayers(string messageKey)+() => { } in /home/container/carbon/plugins/GuessTheNumber.cs:line 1080 at Timer Oxide.Plugins.Timers.In(float time, Action action)+() => { } in /__w/Carbon/Carbon/Carbon.Core/Carbon.Components/Carbon.Common/src/Oxide/Libraries/Timer.cs:line 50Hint: Your line numbers will differ - I have added a few lines to your plugin source to have hooks for my Discord logging.
The timer should be called like this to prevent this race condition:
// Capture the player's ID to safely check later
string playerId = player.UserIDString;
timer.Once(gameTipDuration, () =>
{
BasePlayer target = BasePlayer.FindByID(playerId);
if (target != null && target.IsConnected)
{
target.SendConsoleCommand("gametip.hidegametip");
}
});