after todays update Notifier is putting out some errors in console, i know Notifier is out dated however ive kept it because it still works to what i need it to. however this is the error that im getting now:
and thisCode:Failed to run a 300.00 timer in 'Notifier v3.1.3' (NullReferenceException: Object reference not set to an instance of an object) at Oxide.Core.Libraries.Covalence.Formatter+Lexer.Lex (System.String text) [0x00000] in <filename unknown>:0 at Oxide.Core.Libraries.Covalence.Formatter.Parse (System.String text) [0x00000] in <filename unknown>:0 at Oxide.Core.Libraries.Covalence.Formatter.ToTreeFormat (System.String text, System.Collections.Generic.Dictionary`2 translations) [0x00000] in <filename unknown>:0 at Oxide.Core.Libraries.Covalence.Formatter.ToUnity (System.String text) [0x00000] in <filename unknown>:0 at Oxide.Game.Rust.Libraries.Server.Broadcast (System.String message, System.String prefix, UInt64 userId) [0x00000] in <filename unknown>:0 at Oxide.Game.Rust.Libraries.Rust.BroadcastChat (System.String name, System.String message, System.String userId) [0x00000] in <filename unknown>:0 at Oxide.Plugins.Notifier.Say (System.String msg, System.String profile, Boolean usePrefix) [0x00000] in <filename unknown>:0 at Oxide.Plugins.Notifier.AdvertsLoop () [0x00000] in <filename unknown>:0 at Oxide.Plugins.Notifier.<Loaded>m__1 () [0x00000] in <filename unknown>:0 at Oxide.Core.Libraries.Timer+TimerInstance.FireCallback () [0x00000] in <filename unknown>:0
any help with this would be appreciatedCode:Failed to call hook 'OnPlayerInit' on plugin 'Notifier v3.1.3' (NullReferenceException: Object reference not set to an instance of an object) at Oxide.Core.Libraries.Covalence.Formatter+Lexer.Lex (System.String text) [0x00000] in <filename unknown>:0 at Oxide.Core.Libraries.Covalence.Formatter.Parse (System.String text) [0x00000] in <filename unknown>:0 at Oxide.Core.Libraries.Covalence.Formatter.ToTreeFormat (System.String text, System.Collections.Generic.Dictionary`2 translations) [0x00000] in <filename unknown>:0 at Oxide.Core.Libraries.Covalence.Formatter.ToUnity (System.String text) [0x00000] in <filename unknown>:0 at Oxide.Game.Rust.Libraries.Server.Broadcast (System.String message, System.String prefix, UInt64 userId) [0x00000] in <filename unknown>:0 at Oxide.Game.Rust.Libraries.Rust.BroadcastChat (System.String name, System.String message, System.String userId) [0x00000] in <filename unknown>:0 at Oxide.Plugins.Notifier.Say (System.String msg, System.String profile, Boolean usePrefix) [0x00000] in <filename unknown>:0 at Oxide.Plugins.Notifier.JoinMessages (.BasePlayer player) [0x00000] in <filename unknown>:0 at Oxide.Plugins.Notifier.InitializePlayer (.BasePlayer player, Boolean joined) [0x00000] in <filename unknown>:0 at Oxide.Plugins.Notifier.OnPlayerInit (.BasePlayer player) [0x00000] in <filename unknown>:0 at Oxide.Plugins.Notifier.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00000] in <filename unknown>:0
Solved SendChatMessage and Broadcast usage?
Discussion in 'Rust Development' started by GhostGaming, Nov 2, 2017.
-
i installed a new oxide and i have a problem
with
Code:rust.SendChatMessage(player, SimpleColorFormat("<silver>" + msg + "<end>"), null, profile);
i read a wulf
but i don't understand what i must to change
Notable changes:
If you have any C# plugins using rust.SendChatMessage or rust.Broadcast and are sending a null message instead of a prefix, they'll likely error. I'd encourage updating to Server.Broadcast or Server.Message instead, as the "rust." library helpers are slated to be removed eventually. -
Wulf Community Admin
You are sending the message as the prefix when you should be sending it as the message with that null is.
-
Code:if (!String.IsNullOrEmpty(PluginPrefix) && EnablePluginPrefix && usePrefix) msg = PluginPrefix + " " + msg; if (profile == "0" && EnablePluginIcon) profile = IconProfile; rust.SendChatMessage(player, SimpleColorFormat("<silver>" + msg + "<end>"), null, profile);
-
How to update to Server.Message in this code
Code:BasePlayer currentPlayer = current.GetBasePlayer(); if (currentPlayer != null) rust.SendChatMessage(currentPlayer, Group.Format(player, message), null, player.Id);
-
anyone know?
-
Wulf Community Admin
-
@W
-
Code:`Oxide.Plugins.BetterChat.Player' does not contain a definition for `Message'
-
so how would i fix my issues with Notifier Wulf?
Last edited by a moderator: Nov 2, 2017 -
Wulf Community Admin
The many methods that work for chat sending:
Rust-specific methods:
- rust.SendChatMessage(BasePlayer player, string prefix, string message) - If you don't want a prefix, it needs to be null; do not make the message null.
- rust.BroadcastChat(string prefix, string message) - If you don't want a prefix, it needs to be null; do not make the message null.
- Player.Message(BasePlayer player, string message, string prefix, ulong id) - If you don't want a prefix, it needs to be null; do not make the message null. The prefix and id are optional.
- Server.Broadcast(string message, string prefix, ulong id) - If you don't want a prefix, it needs to be null; do not make the message null. The prefix and id are optional.
- PrintToChat(BasePlayer player, string message, object[] args) - args being optional if you have none.
- PrintToChat(string message, object[] args) - args being optional if you have none.
- SendReply(ConsoleSystem.Arg arg, string message, object[] args) - args being optional if you have none.
- SendReply(BasePlayer player, string message, object[] args) - args being optional if you have none.
- player.Message(IPlayer player, string message)
- player.Message(IPlayer player, string message, object[] args)
- player.Reply(IPlayer player, string message)
- player.Reply(IPlayer player, string message, object[] args)
- server.Broadcast(string message)
- covalence.Player.Message(IPlayer player, string message)
- covalence.Player.Message(IPlayer player, string message, object[] args)
- covalence.Player.Reply(IPlayer player, string message)
- covalence.Player.Reply(IPlayer player, string message, object[] args)
- covalence.Server.Broadcast(string message)
-
Code:Failed to call hook 'OnPlayerInit' on plugin 'Notifier v3.1.3' (NullReferenceException: Object reference not set to an instance of an object) (13:59:23) | at Oxide.Core.Libraries.Covalence.Formatter+Lexer.Lex (System.String text) [0x00000] in <filename unknown>:0 at Oxide.Core.Libraries.Covalence.Formatter.Parse (System.String text) [0x00000] in <filename unknown>:0 at Oxide.Core.Libraries.Covalence.Formatter.ToTreeFormat (System.String text, System.Collections.Generic.Dictionary`2 translations) [0x00000] in <filename unknown>:0 at Oxide.Core.Libraries.Covalence.Formatter.ToUnity (System.String text) [0x00000] in <filename unknown>:0 at Oxide.Game.Rust.Libraries.Server.Broadcast (System.String message, System.String prefix, UInt64 userId) [0x00000] in <filename unknown>:0 at Oxide.Game.Rust.Libraries.Rust.BroadcastChat (System.String name, System.String message, System.String userId) [0x00000] in <filename unknown>:0 at Oxide.Plugins.Notifier.Say (System.String msg, System.String profile, Boolean usePrefix) [0x00000] in <filename unknown>:0 at Oxide.Plugins.Notifier.JoinMessages (.BasePlayer player) [0x00000] in <filename unknown>:0 at Oxide.Plugins.Notifier.InitializePlayer (.BasePlayer player, Boolean joined) [0x00000] in <filename unknown>:0 at Oxide.Plugins.Notifier.OnPlayerInit (.BasePlayer player) [0x00000] in <filename unknown>:0 at Oxide.Plugins.Notifier.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00000] in <filename unknown>:0
-
1 man helped me with a fix
Just change
in your plugin
Code:private void Say(string msg, string profile = "0", bool usePrefix = true) { Con(msg); string prefix = null; if (!String.IsNullOrEmpty(PluginPrefix) && EnablePluginPrefix && usePrefix) //msg = PluginPrefix + " " + msg; prefix = PluginPrefix; if (profile == "0" && EnablePluginIcon) profile = IconProfile; //rust.BroadcastChat(SimpleColorFormat("<silver>" + msg + "<end>"), null, profile); Server.Broadcast(SimpleColorFormat("<silver>" + msg + "<end>", false), prefix, 0); } private void Tell(BasePlayer player, string msg, string profile = "0", bool usePrefix = true) { if (!String.IsNullOrEmpty(PluginPrefix) && EnablePluginPrefix && usePrefix) msg = PluginPrefix + " " + msg; if (profile == "0" && EnablePluginIcon) profile = IconProfile; //rust.SendChatMessage(player, SimpleColorFormat("<silver>" + msg + "<end>"), null, profile); PrintToChat(player, SimpleColorFormat("<silver>" + msg + "<end>"));
-
-
find SendChatMessage and you will found all
-
-
-
[DOUBLEPOST=1509712500][/DOUBLEPOST]now i am getting this when someone joins/leaves my server? any ideas, sorry about all this i dont really know anything about codingAttached Files:
-
-
Wulf Community Admin
and
rust.SendChatMessage(player, SimpleColorFormat(null, "<silver>" + msg + "<end>"), profile);
Newer methods were not required, just the right order or arguments. -