I have an error when i put {0} for exemple in server.Broadcast
Code:["HealedBroadcast"] = "<color=olive>{2}</color><color=green> were </color><color=red>healed</color><color=green> for </color><color=red>{0} health</color><color=green> by </color><color=olive>{1}</color>",Code:server.Broadcast(lang.GetMessage("HealedBroadcast", this, null));How can I put in Inside ??Code:at System.String.FormatHelper (System.Text.StringBuilder result, IFormatProvider provider, System.String format, System.Object[] args) [0x00000] in :0 at System.String.Format (IFormatProvider provider, System.String format, System.Object[] args) [0x00000] in :0 at System.String.Format (System.String format, System.Object[] args) [0x00000] in :0 at Oxide.Game.Rust.Libraries.Server.Broadcast (System.String message, System.String prefix, UInt64 userId, System.Object[] args) [0x00000] in :0 at Oxide.Game.Rust.Libraries.Covalence.RustServer.Broadcast (System.String message, System.String prefix, System.Object[] args) [0x00000] in :0 at Oxide.Game.Rust.Libraries.Covalence.RustServer.Broadcast (System.String message) [0x00000] in :0 at Oxide.Plugins.SlayforRust.HealCommand (IPlayer player, System.String command, System.String[] args) [0x00000] in :0 at Oxide.Plugins.SlayforRust.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in :0 at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00000] in :0 at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in :0 at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00000] in :0
(i'm new and I don't know too much)..
Thanks for all the answers
Solved Format error when sending a message (lacking args for formatting)
Discussion in 'Rust Development' started by rlevet, Nov 11, 2017.
-
Wulf Community Admin
You need to format it before sending it else send the actual args to be formatted. Right now Oxide is trying to format it for you as it has placeholders that are intended to be formatted such as {0}.
-
Code:
server.Broadcast(String.Format(lang.GetMessage("HealedBroadcast", this, null)));
-
Wulf Community Admin