1. Wulf

    Wulf Community Admin

    Do you have language files in Russian? Otherwise you will still see English.
     
  2. yep, i have Russian language files, if i write in chat "/lang ru" - it's work.
     
  3. Wulf

    Wulf Community Admin

    The chat command uses the same thing, so that doesn't make any sense.
     
  4. I see the sense in it.
    Where i can find information about: lang, player.ConsoleMessage and other oxide functions?
    and why this code works for other people but not for me?
    Code:
    lang.SetLanguage("ru", player.UserIDString);
    maybe I did not connect the necessary libraries?

    It's all code:
    Code:
    namespace Oxide.Plugins
    {
        [Info("Lang", "hulimontana", 0.1)]
        [Description("Auto change language")]    class Lang : RustPlugin
        {
            void OnPlayerInit(BasePlayer player)
            {
                if (player == null || player.net == null || player.net.connection == null) return;
                string ply_lang = player.net.connection.info.GetString("global.language", null);
                // returns a shortcode like 'en'
                if (ply_lang != null)
                {
                    //do whatelse example
                    string lng = ply_lang.Substring(0, 1);
                    Puts($"Player {player.displayName} has the language {lng}");
                    lang.SetLanguage(lng, player.UserIDString);
                }
            }
        }
    }
     
  5. Wulf

    Wulf Community Admin

    player.ConsoleMessage is from Rust, not Oxide, and is not for running commands.

    The 'lang' library helper is from Oxide, and can be found in Oxide's source on GitHub.

    If the plugin is compiling, it should be working. Is the plugin compiling successfully? Do you see the message that you have with Puts?
     
  6. what you mean about compilation? i just create .txt file and rename it in "lang.cs".
    if you about loading plugin:
    [​IMG]
     
    Last edited by a moderator: Dec 28, 2016
  7. Code:
    public static string GetLanguage(this Connection connection)
    {
        bool flag = connection != null;
        string result;
        if (flag)
        {
            result = connection.info.GetString("global.language", "en").ToUpper();
        }
        else
        {
            result = "EN";
        }
        return result;
    }