How do I change the color of the output of a string?
For example I got:
Code:function PLUGIN:cmdMe(player) local Name = player.net.connection.displayName -- I know that it may be totally wrong but thats not my subject. Its just an example... rust.SendChatMessage(player, "ME", "Your displayname is" .. Name ) -- This Name should be colored in the output. I just tested, i cant just put <color= orange></color> around it, because it would count as part of the String name. end
Solved Change color of output string? (Lua)
Discussion in 'Rust Development' started by LaserHydra, Mar 29, 2015.
-
Wulf Community Admin
-
:v Eh I should take a deeper look into that page before psoting, shouldn't I? Sry :c
[DOUBLEPOST=1427664651][/DOUBLEPOST]Wait ---
That does not work for me...
Code:[Oxide] 11:30 PM [Error] Failed to load plugin colortest File: colortest.lua Line: 24 unexpected symbol near '<': at NLua.Lua.ThrowExceptionFromError (Int32 oldTop) [0x00000] in :0 at NLua.Lua.LoadString (System.String chunk, System.String name) [0x00000] in :0 at Oxide.Lua.Plugins.LuaPlugin.Load () [0x00000] in :0 at Oxide.Lua.Plugins.LuaPluginLoader.Load (System.String directory, System.String name) [0x00000] in :0 at Oxide.Core.OxideMod.LoadPlugin (System.String name) [0x00000] in :0
Code:function PLUGIN:cmdMe(player) local Name = player.net.connection.displayName rust.SendChatMessage(player,"ME","Your displayname is".. <color= #00ff00ff>Name</color> ) end
Last edited by a moderator: Mar 29, 2015 -
Wulf Community Admin
You have to wrap the HTML with quotation marks, HTML is not a variable.
Code:rust.SendChatMessage(player, "ME", "Your display name is <color=#00ff00ff>" .. Name .. "</color>")
-
okay thanks ^^