Failed to run a 20.00 timer in 'WelcomeMessages v1.0.5' (NullReferenceException: Object reference not set to an instance of an object)
at BasePlayer.SendConsoleCommand (System.String command, System.Object[] obj) [0x00000] in :0
at Oxide.Game.Rust.Libraries.Player.Message (BasePlayer player, System.String message, System.String prefix, System.UInt64 userId, System.Object[] args) [0x00038] in <372a3029b0de4d7395d7690b1fed47b9>:0
at Oxide.Game.Rust.Libraries.Covalence.RustPlayer.Message (System.String message, System.String prefix, System.Object[] args) [0x00000] in <372a3029b0de4d7395d7690b1fed47b9>:0
at Oxide.Game.Rust.Libraries.Covalence.RustPlayer.Reply (System.String message, System.String prefix, System.Object[] args) [0x0000f] in <372a3029b0de4d7395d7690b1fed47b9>:0
at Oxide.Game.Rust.Libraries.Covalence.RustPlayer.Reply (System.String message) [0x00008] in <372a3029b0de4d7395d7690b1fed47b9>:0
at Oxide.Plugins.WelcomeMessages+c__AnonStorey0.<>m__0 () [0x00051] in :0
at Oxide.Core.Libraries.Timer+TimerInstance.FireCallback () [0x00018] in :0 NullReferenceException if player disconnects before timerError
This is typically a configuration error, please post yours here.
i mean, my config is very short.
{
"WaitIntervalInSeconds": 20
}Merged post
Or are you looking for the Lang file?
Merged post
Just put it in jsonlint but im not sure what the problem is with it
{
"Welcome": "[#f99900] Welcome To FireRust. We Hope You Enjoy Your Stay {0}![/#]
\n[#ffffff]You'll Find The Main Command List In The Top Right Corner. Join Our Discord To See The Complete List Of Commands[/#]
\nIf You Need Any Help Or Have Questions, Hop On Our Discord: [#f99900]discordFireRust[/#]
\nWe Do Not Have A Shop, But You Can Use The Ingame Money By Typing [#f99900]/case[/#]
\n[#ffffff]Have Fun![/#]"
}Merged post
But funny enought it will still display the message :D
I don't think this lang file is valid because it contains a new line - should be one line IIRC. Most likely the player has disconnected by the way which causes the message to appear - yet you can change wait interval to something smaller like 5 seconds instead.
Ohh, so the error comes if a player leaves before the message appears?
HardStyle
Ohh, so the error comes if a player leaves before the message appears?
Mine is still working without any console errors, only difference is my config
{
"WaitIntervalInSeconds": 1.0
}{
"Welcome": "[#00ffffff]Welcome to Pal-Ul-Don CAN YOU Survive {0} ?[/#]
\n[#ffff00ff] For KIT MENU type / kit do NOT use with a full inventory[/#]
\n[#00ff00ff] WARNING SERVER DECAY is ON : TWIGS , WOOD AND STONE DECAY [/#]
\n[#ffff00ff] THIS IS NOT A CREATIVE SERVER[/#]
\n[#ffff00ff] Rules and hints will scroll Top Right of screen[/#]
\n[#ffff00ff] WATCH OUT FOR NPC Patrols in Monument areas and Map[/#]
\n[#00ff00ff] The MORE you Gather / Craft = Higher / Faster rates[/#]"
}So your lang file is constructed the same as mine and never had a problem with errors
HardStyle
Ohh, so the error comes if a player leaves before the message appears?
correct
pookins
Mine is still working without any console errors, only difference is my config
{ "WaitIntervalInSeconds": 1.0 }
{ "Welcome": "[#00ffffff]Welcome to Pal-Ul-Don CAN YOU Survive {0} ?[/#] \n[#ffff00ff] For KIT MENU type / kit do NOT use with a full inventory[/#] \n[#00ff00ff] WARNING SERVER DECAY is ON : TWIGS , WOOD AND STONE DECAY [/#] \n[#ffff00ff] THIS IS NOT A CREATIVE SERVER[/#] \n[#ffff00ff] Rules and hints will scroll Top Right of screen[/#] \n[#ffff00ff] WATCH OUT FOR NPC Patrols in Monument areas and Map[/#] \n[#00ff00ff] The MORE you Gather / Craft = Higher / Faster rates[/#]" }So your lang file is constructed the same as mine and never had a problem with errors
most likely because players do not leave within one second
Well, that there is no reason to change anything, i set the wait interval to 20 because i want player to "wake up" and start moving before the message pops up :)
Ideally the plugin should be checking if the player is connected before sending it.
but it seems more like it checks for when the player have spawned on the map, anyways, changed to another plugin :)
Still an Exception when a Player leaves before the timer occurs. In my oppinion your isNull case is at the wrong point.
Replace:
Replace:
if (player != null && player.IsConnected)
{
timeInSeconds = Convert.ToSingle(Config["WaitIntervalInSeconds"]);
timer.Once((timeInSeconds), () =>
{
player.Reply(covalence.FormatText(string.Format(lang.GetMessage("Welcome", this, player.Id), player.Name.Sanitize())));
});
}With:
timeInSeconds = Convert.ToSingle(Config["WaitIntervalInSeconds"]);
timer.Once((timeInSeconds), () =>
{
if (player != null && player.IsConnected)
player.Reply(covalence.FormatText(string.Format(lang.GetMessage("Welcome", this, player.Id), player.Name.Sanitize())));
});
return; Good call, I did not notice this when I tested it.
No problem. Just had this a few times on my servers.