hi,
It is not possible to include two variables like this ?
I tried all possible solutions, but my message is not displayed correctly.Code:message = UnityEngine.StringExtensions.QuoteSafe( message ) target:SendConsoleCommand( "chat.add \"" .. self.Config.Settings.ChatName .. "\" \"<color=red>My Prefix</color> : <color=yellow>" .. message .. "</color>\"" );
Result : My Prefix : <color=yellow>
[Lua] target:SendConsoleCommand manipulation
Discussion in 'Rust Development' started by Loup-des-Neiges, Sep 22, 2015.
-
Wulf Community Admin
Firstly, Oxide has a QuoteSafe function you can use, you don't need to use UnityEngine's.
Secondly, why not use rust.BroadcastChat(prefix, message) or rust.SendChatMessage(player, prefix .. message)?
Ex. rust.BroadcastChat(self.Config.Settings.ChatName, "<color=red>My Prefix</color> : <color=yellow>" .. message .. "</color>") -
Thank you, I realized where does my worries. :x
Code:function PLUGIN:OutputMessage( target, message ) if not target then return end if not target:IsConnected() then return end if not message then return end if type( message ) == "table" then for _, message in pairs( message ) do self:SendMessage( target, "<color=yellow>" .. message .. "</color>" ) end return end message = UnityEngine.StringExtensions.QuoteSafe( message ) rust.SendChatMessage(target, "<color=red>My test prefix</color> : " .. message .. "") end
I correct with :
Code:function PLUGIN:OutputMessage( target, message ) if not target then return end if not target:IsConnected() then return end if not message then return end if type( message ) == "table" then for _, message in pairs( message ) do self:SendMessage( target, message ) end return end message = rust.QuoteSafe( message ) rust.SendChatMessage(target, "<color=red>My test prefix</color> : <color=yellow>" .. message .. "</color>") end
Last edited by a moderator: Sep 22, 2015