1. hi,

    It is not possible to include two variables like this ?

    Code:
    message = UnityEngine.StringExtensions.QuoteSafe( message )
    target:SendConsoleCommand( "chat.add \"" .. self.Config.Settings.ChatName .. "\" \"<color=red>My Prefix</color> : <color=yellow>" .. message .. "</color>\"" );
    I tried all possible solutions, but my message is not displayed correctly.
    Result : My Prefix : <color=yellow>
     
  2. Wulf

    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>")
     
  3. 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 do not use correctly "self:SendMessage " >< I had too many """""""""""""

    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
    But I get: My test prefix : "My test message"
     
    Last edited by a moderator: Sep 22, 2015