1. onStyle

    onStyle Scavenger

    Code (Text):
           
    void Loaded()
            {
            lang.RegisterMessages(Messages, this);
            lang.GetLanguages(language, Messages, this);
            }      
     
    Console: SkipNightVote.cs(29,21): error CS0103: The name `language' does not exist in the current context
    SkipNightVote.cs(29,8): error CS1501: No overload for method `GetLanguages' takes `3' arguments
    /home/k8169_s5095/server_5095/Oxide.Core.dll (Location of the symbol related to previous error)

    I dont know what to do ;x SkipNightVote | Oxide Maybe u can explain me how to do it. Im really newbie.
     
  2. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    You don't need lang.GetLanguages. You also aren't using "language" in any of that code there, so look on line 29.
     
  3. onStyle

    onStyle Scavenger

    So what i need to use to read lang/{language} ?
     
  4. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    You need to use lang.RegisterMessages for each language, else manually create the files.
     
  5. onStyle

    onStyle Scavenger

    hastebin it should works, i created the files and still.. no idea
     
  6. onStyle

    onStyle Scavenger

    Code (Text):
            private string GetMSG(string key, string userid = null) => lang.GetMessage(key, this, userid);
            Dictionary<string, string> Messages = new Dictionary<string, string>
            {
                {"Force open a new vote", "Force open a new vote" },
                {"Cancel the current vote", "Cancel the current vote" },
                {"There is not a vote currently open", "There is not a vote currently open" },
                {"You have voted to skip night", "You have voted to skip night" },
                {"have voted to skip night", "players have voted to skip night" },
                {"Voting was successful, skipping night.", "Voting was successful, skipping night." },
                {"Voting was unsuccessful.", "Voting was unsuccessful." },
                {"Minutes", "Minutes" },
                {"Minute", "Minute" },
                {"Seconds", "Seconds" },
                {"voteMSG", "{secCol}Type</color> {mainCol}/voteday</color> {secCol}now if you want to skip night. If </color>{mainCol}{reqVote}%</color> {secCol}of players vote night will be skipped</color>" },
                {"timeRem", "{secCol}Voting ends in</color> {mainCol}{time} {type}</color>{secCol}, use </color>{mainCol}/voteday</color>{secCol} to cast your vote</color>" }
            }, this);

            Dictionary<string, string> Messages = new Dictionary<string, string>
            {
                {"Force open a new vote", "Force open a new vote" },
                {"Cancel the current vote", "Cancel the current vote" },
                {"There is not a vote currently open", "There is not a vote currently open" },
                {"You have voted to skip night", "You have voted to skip night" },
                {"have voted to skip night", "players have voted to skip night" },
                {"Voting was successful, skipping night.", "Voting was successful, skipping night." },
                {"Voting was unsuccessful.", "Voting was unsuccessful." },
                {"Minutes", "Minutes" },
                {"Minute", "Minute" },
                {"Seconds", "Seconds" },
                {"voteMSG", "{secCol}Type</color> {mainCol}/voteday</color> {secCol}now if you want to skip night. If </color>{mainCol}{reqVote}%</color> {secCol}of players vote night will be skipped</color>" },
                {"timeRem", "{secCol}Voting ends in</color> {mainCol}{time} {type}</color>{secCol}, use </color>{mainCol}/voteday</color>{secCol} to cast your vote</color>" }
            }, this, "pl");

            Dictionary<string, string> Messages = new Dictionary<string, string>
            {
                {"Force open a new vote", "Force open a new vote" },
                {"Cancel the current vote", "Cancel the current vote" },
                {"There is not a vote currently open", "There is not a vote currently open" },
                {"You have voted to skip night", "You have voted to skip night" },
                {"have voted to skip night", "players have voted to skip night" },
                {"Voting was successful, skipping night.", "Voting was successful, skipping night." },
                {"Voting was unsuccessful.", "Voting was unsuccessful." },
                {"Minutes", "Minutes" },
                {"Minute", "Minute" },
                {"Seconds", "Seconds" },
                {"voteMSG", "{secCol}Type</color> {mainCol}/voteday</color> {secCol}now if you want to skip night. If </color>{mainCol}{reqVote}%</color> {secCol}of players vote night will be skipped</color>" },
                {"timeRem", "{secCol}Voting ends in</color> {mainCol}{time} {type}</color>{secCol}, use </color>{mainCol}/voteday</color>{secCol} to cast your vote</color>" }
            }, this, "de");
    still not working and i must change to lang.RegisterMessages(new Dictionary<string, string> ? and problems with { }

    btw. update was: P
     
  7. onStyle

    onStyle Scavenger

    Will be update for itemv2 branch?
     
  8. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    No, you're placing each language under the same variable now; just register them directly.
     
  9. onStyle

    onStyle Scavenger

    Okey, my plugin is working, generated lang/pl lang/ru lang/de lang/de, but i have Polish Hurtworld and is using english language, server was restarted.
     
  10. onStyle

    onStyle Scavenger

    Okey, i was talking with Tom and he said me i should contact with you Wulf,
    Code (Text):

    private new void LoadDefaultMessages()
             {
               // English
               lang.RegisterMessages(new Dictionary<string, string>
               {
                 {"GiveRoll_ItemGive","<color=#7FFF00>[ROLL]</color> {player} has rolled the dice and recieved {amount} {itemname}"},
                 {"GiveRoll_StatGive","<color=#7FFF00>[ROLL]</color> {player} has rolled the dice and recieved {amount} {stat} points"},
                 {"GiveRoll_SpawnGive","<color=#7FFF00>[ROLL]</color> {player} has rolled the dice and spawned {amount} {creature}"},
                 {"GiveRoll_ItemReplace","<color=#7FFF00>[ROLL]</color> {player} has rolled the dice and replaced {amount1} {itemname1} with {amount2} {itemname2}"},
                 {"SendListRollEdition_1","permission \"permission name\" => set the permission needed to get this roll"},
                 {"SendListRollEdition_2","description \"description text here\" => set a description for this roll"},
                 {"SendListRollEdition_3","authlevel XXX"},
                 {"SendListRollEdition_4","cooldown XXX"},
                 {"SendListRollEdition_5","max XXX"},
                 {"SendListRollEdition_6","additem <itemId> <amount> <chance> => set new items for your roll"},
                 {"SendListRollEdition_7","addstat <type> <amount> <chance> => alter player stat"},
                 {"SendListRollEdition_8","addspawn <creature> <amount> <chance> => spawn creatures on player"},
                 {"SendListRollEdition_9","addreplace <itemId> <amount> <chance> => replace random inventory item"},
                 {"SendListRollEdition_10","hide TRUE/FALSE => dont show this roll in lists (EVER)"},
                 {"CmdRoll_CantSeeRoll", "{rollname} - {desc} {reason}"},
                 {"CmdRoll_Player1","====== Player Commands ======"},
                 {"CmdRoll_Player2","/roll => to get the list of rolls"},
                 {"CmdRoll_Player3","/roll ROLLNAME => to redeem the roll"},
                 {"CmdRoll_Admin1", "====== Admin Commands ======"},
                 {"CmdRoll_Admin2","/roll add ROLLNAME => add a roll"},
                 {"CmdRoll_Admin3","/roll remove ROLLNAME => remove a roll"},
                 {"CmdRoll_Admin4","/roll edit ROLLNAME => edit a roll"},
                 {"CmdRoll_Admin5","/roll list => get a raw list of rolls (the real full list)"},
                 {"CmdRoll_Admin6","/roll give PLAYER/STEAMID ROLLNAME => make a player roll the dice"},
                 {"CmdRoll_Admin7","/roll resetrolls => deletes all rolls"},
                 {"CmdRoll_Admin8","/roll resetdata => reset player data"},
                 {"CmdRoll_NoAccess","You don't have access to this command"},
                 {"CmdRoll_RollList","{rollname} - {description}"},
                 {"CmdRoll_ResetAll","All player and roll data has been reset"},
                 {"CmdRoll_ResetPlayer", "All player data has been reset"},
                 {"CmdRoll_NewRollExists", "This roll already exists"},
                 {"CmdRoll_NewRollNotExists", "This roll doesn't seem to exist"},
                 {"CmdRoll_NewRoll", "You've created a new roll: {rollname}"},
                 {"CmdRoll_Give","/roll give PLAYER/STEAMID ROLLNAME"},
                 {"CmdRoll_GiveNoPlayer", "No player found"},
                 {"CmdRoll_GiveMultiple", "Multiple players found"},
                 {"CmdRoll_Given","You gave {player} the roll: {rollname}"},
                 {"CmdRoll_GivenReceive", "You've received the roll {rollname} from {player} enjoy!"},
                 {"CmdRoll_Edit", "You are now editing roll: {rollname}"},
                 {"CmdRoll_Remove","{rollname} was removed"},
                 {"CmdRoll_NotInEdit", "You are not creating or editing a roll"},
                 {"CmdRoll_Dirty", "There was an error while getting this roll, was it changed while you were editing it?"},
                 {"CmdRoll_AddItem", "Item added successfully"},
                 {"CmdRoll_AddStat", "Stat added successfully"},
                 {"CmdRoll_AddSpawn", "Spawn added successfully"},
                 {"CmdRoll_AddReplace", "Item replacement added successfully"},
                 {"CmdRoll_InvalidArgs", "{arg} Invalid agrument"},
                 {"GiveRoll_NotExist", "The roll '{rollname}' doesn't exist"},
                 {"TryGiveRoll_Completed", "Roll Completed" },
                 {"CanRedeemARoll_NotExist", "The roll '{rollname}' doesn't exist"},
                 {"CanRedeemARoll_NotAllowed", "You are not allowed to roll the dice at this moment"},
                 {"CanRedeemARoll_NoLevel", "You don't have the level to use this roll"},
                 {"CanRedeemARoll_NoPerm", "You don't have the permissions to use this roll"},
                 {"CanRedeemARoll_Out", "You already took all your chances with this roll"},
                 {"CanRedeemARoll_Wait", "You need to wait {seconds} seconds to use this roll"}
               }, this);

               // Polish
               lang.RegisterMessages(new Dictionary<string, string>
               {
                 {"GiveRoll_ItemGive","<color=#7FFF00>[ROLL]</color> {player} zalosował i wygrał {amount} {itemname}"},
                 {"GiveRoll_StatGive","<color=#7FFF00>[ROLL]</color> {player} zalosował i wygrał {amount} {stat}"},
                 {"GiveRoll_SpawnGive","<color=#7FFF00>[ROLL]</color> {player} zalosował i wygrał {amount} {creature}"},
                 {"GiveRoll_ItemReplace","<color=#7FFF00>[ROLL]</color> {player} rzucił kostką i wylosował zamianę {itemname1} {amount1} z {itemname2} {amount2}"},
                 {"SendListRollEdition_1","permission \"permission name\" => set the permission needed to get this roll"},
                 {"SendListRollEdition_2","description \"description text here\" => set a description for this roll"},
                 {"SendListRollEdition_3","authlevel XXX"},
                 {"SendListRollEdition_4","cooldown XXX"},
                 {"SendListRollEdition_5","max XXX"},
                 {"SendListRollEdition_6","additem <itemId> <amount> <chance> => set new items for your roll"},
                 {"SendListRollEdition_7","addstat <type> <amount> <chance> => alter player stat"},
                 {"SendListRollEdition_8","addspawn <creature> <amount> <chance> => spawn creatures on player"},
                 {"SendListRollEdition_9","addreplace <itemId> <amount> <chance> => replace random inventory item"},
                 {"SendListRollEdition_10","hide TRUE/FALSE => dont show this roll in lists (EVER)"},
                 {"CmdRoll_CantSeeRoll", "{rollname} - {desc} {reason}"},
                 {"CmdRoll_Player1","====== Player Commands ======"},
                 {"CmdRoll_Player2","/roll => to get the list of rolls"},
                 {"CmdRoll_Player3","/roll ROLLNAME => to redeem the roll"},
                 {"CmdRoll_Admin1", "====== Admin Commands ======"},
                 {"CmdRoll_Admin2","/roll add ROLLNAME => add a roll"},
                 {"CmdRoll_Admin3","/roll remove ROLLNAME => remove a roll"},
                 {"CmdRoll_Admin4","/roll edit ROLLNAME => edit a roll"},
                 {"CmdRoll_Admin5","/roll list => get a raw list of rolls (the real full list)"},
                 {"CmdRoll_Admin6","/roll give PLAYER/STEAMID ROLLNAME => make a player roll the dice"},
                 {"CmdRoll_Admin7","/roll resetrolls => deletes all rolls"},
                 {"CmdRoll_Admin8","/roll resetdata => reset player data"},
                 {"CmdRoll_NoAccess","Nie masz dostępu do tej komendy."},
                 {"CmdRoll_RollList","{rollname} - {description}"},
                 {"CmdRoll_ResetAll","All player and roll data has been reset"},
                 {"CmdRoll_ResetPlayer", "All player data has been reset"},
                 {"CmdRoll_NewRollExists", "This roll already exists"},
                 {"CmdRoll_NewRollNotExists", "This roll doesn't seem to exist"},
                 {"CmdRoll_NewRoll", "You've created a new roll: {rollname}"},
                 {"CmdRoll_Give","/roll give PLAYER/STEAMID ROLLNAME"},
                 {"CmdRoll_GiveNoPlayer", "No player found"},
                 {"CmdRoll_GiveMultiple", "Multiple players found"},
                 {"CmdRoll_Given","You gave {player} the roll: {rollname}"},
                 {"CmdRoll_GivenReceive", "You've received the roll {rollname} from {player} enjoy!"},
                 {"CmdRoll_Edit", "You are now editing roll: {rollname}"},
                 {"CmdRoll_Remove","{rollname} was removed"},
                 {"CmdRoll_NotInEdit", "You are not creating or editing a roll"},
                 {"CmdRoll_Dirty", "There was an error while getting this roll, was it changed while you were editing it?"},
                 {"CmdRoll_AddItem", "Item added successfully"},
                 {"CmdRoll_AddStat", "Stat added successfully"},
                 {"CmdRoll_AddSpawn", "Spawn added successfully"},
                 {"CmdRoll_AddReplace", "Item replacement added successfully"},
                 {"CmdRoll_InvalidArgs", "{arg} Invalid agrument"},
                 {"GiveRoll_NotExist", "Losowanie '{rollname}' nie istnieje."},
                 {"TryGiveRoll_Completed", "Losowanie zakończone." },
                 {"CanRedeemARoll_NotExist", "Losowanie '{rollname}' nie istnieje."},
                 {"CanRedeemARoll_NotAllowed", "Nie masz uprawnień, aby rzucić kostką w tej chwili."},
                 {"CanRedeemARoll_NoLevel", "Nie posiadasz odpowiedniego poziomu, aby rzucić kostką."},
                 {"CanRedeemARoll_NoPerm", "Nie posiadasz odpowiednich uprawnień, aby rzucić kostką."},
                 {"CanRedeemARoll_Out", "Wykorzystałeś już wszystkie losowania."},
                 {"CanRedeemARoll_Wait", "Musisz odczekać {seconds} sekund zanim użyjesz losowania ponownie."}
               }, this, "pl");
             
    Code i think is good, no warning, no errors. Generating lang/pl, lang/en, lang/de, but in game loading lang/en only when i have in settings Polish?
     
  11. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    Considering that has nothing to do with Hurtworld itself, not sure why you'd ask him. :p

    Did you change your language using "/lang pl" or "lang pl"?
     
  12. onStyle

    onStyle Scavenger

    bad image. it's proper: http://iv.pl/images/11568265821475229601.png
    --- Double Post Merged, Aug 14, 2017 at 6:50 PM ---
    Code (Text):
    {
      "GiveRoll_ItemGive": "<color=#7FFF00>[ROLL]</color> {player} zalosował i wygrał {amount} {itemname}",
      "GiveRoll_StatGive": "<color=#7FFF00>[ROLL]</color> {player} zalosował i wygrał {amount} {stat}",
      "GiveRoll_SpawnGive": "<color=#7FFF00>[ROLL]</color> {player} zalosował i wygrał {amount} {creature}",
      "GiveRoll_ItemReplace": "<color=#7FFF00>[ROLL]</color> {player} rzucił kostką i wylosował zamianę {itemname1} {amount1} z {itemname2} {amount2}",
      "SendListRollEdition_1": "permission \"permission name\" => set the permission needed to get this roll",
      "SendListRollEdition_2": "description \"description text here\" => set a description for this roll",
      "SendListRollEdition_3": "authlevel XXX",
      "SendListRollEdition_4": "cooldown XXX",
      "SendListRollEdition_5": "max XXX",
      "SendListRollEdition_6": "additem <itemId> <amount> <chance> => set new items for your roll",
      "SendListRollEdition_7": "addstat <type> <amount> <chance> => alter player stat",
      "SendListRollEdition_8": "addspawn <creature> <amount> <chance> => spawn creatures on player",
      "SendListRollEdition_9": "addreplace <itemId> <amount> <chance> => replace random inventory item",
      "SendListRollEdition_10": "hide TRUE/FALSE => dont show this roll in lists (EVER)",
      "CmdRoll_CantSeeRoll": "{rollname} - {desc} {reason}",
      "CmdRoll_Player1": "====== Player Commands ======",
      "CmdRoll_Player2": "/roll => to get the list of rolls",
      "CmdRoll_Player3": "/roll ROLLNAME => to redeem the roll",
      "CmdRoll_Admin1": "====== Admin Commands ======",
      "CmdRoll_Admin2": "/roll add ROLLNAME => add a roll",
      "CmdRoll_Admin3": "/roll remove ROLLNAME => remove a roll",
      "CmdRoll_Admin4": "/roll edit ROLLNAME => edit a roll",
      "CmdRoll_Admin5": "/roll list => get a raw list of rolls (the real full list)",
      "CmdRoll_Admin6": "/roll give PLAYER/STEAMID ROLLNAME => make a player roll the dice",
      "CmdRoll_Admin7": "/roll resetrolls => deletes all rolls",
      "CmdRoll_Admin8": "/roll resetdata => reset player data",
      "CmdRoll_NoAccess": "Nie masz dostępu do tej komendy.",
      "CmdRoll_RollList": "{rollname} - {description}",
      "CmdRoll_ResetAll": "All player and roll data has been reset",
      "CmdRoll_ResetPlayer": "All player data has been reset",
      "CmdRoll_NewRollExists": "This roll already exists",
      "CmdRoll_NewRollNotExists": "This roll doesn't seem to exist",
      "CmdRoll_NewRoll": "You've created a new roll: {rollname}",
      "CmdRoll_Give": "/roll give PLAYER/STEAMID ROLLNAME",
      "CmdRoll_GiveNoPlayer": "No player found",
      "CmdRoll_GiveMultiple": "Multiple players found",
      "CmdRoll_Given": "You gave {player} the roll: {rollname}",
      "CmdRoll_GivenReceive": "You've received the roll {rollname} from {player} enjoy!",
      "CmdRoll_Edit": "You are now editing roll: {rollname}",
      "CmdRoll_Remove": "{rollname} was removed",
      "CmdRoll_NotInEdit": "You are not creating or editing a roll",
      "CmdRoll_Dirty": "There was an error while getting this roll, was it changed while you were editing it?",
      "CmdRoll_AddItem": "Item added successfully",
      "CmdRoll_AddStat": "Stat added successfully",
      "CmdRoll_AddSpawn": "Spawn added successfully",
      "CmdRoll_AddReplace": "Item replacement added successfully",
      "CmdRoll_InvalidArgs": "{arg} Invalid agrument",
      "GiveRoll_NotExist": "Losowanie '{rollname}' nie istnieje.",
      "TryGiveRoll_Completed": "Losowanie zakończone.",
      "CanRedeemARoll_NotExist": "Losowanie '{rollname}' nie istnieje.",
      "CanRedeemARoll_NotAllowed": "Nie masz uprawnień, aby rzucić kostką w tej chwili.",
      "CanRedeemARoll_NoLevel": "Nie posiadasz odpowiedniego poziomu, aby rzucić kostką.",
      "CanRedeemARoll_NoPerm": "Nie posiadasz odpowiednich uprawnień, aby rzucić kostką.",
      "CanRedeemARoll_Out": "Wykorzystałeś już wszystkie losowania.",
      "CanRedeemARoll_Wait": "Musisz odczekać {seconds} sekund zanim użyjesz losowania ponownie."
    }
    My lang/pl, are u talking about this? Tom is very good, he is much helping community :)
    --- Double Post Merged, Aug 14, 2017 at 6:56 PM ---
    Ok! I said on chat "/lang pl". Player language set to pl. Still English!
     
  13. onStyle

    onStyle Scavenger

    Will be fix oxide or ?
     
  14. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    It's not something for Oxide to fix, the Lang API is working fine. I use it daily with multiple plugins, all of which use around 5 languages. If the language is not being selected as your own, then either the plugin is not using the player's ID when getting the message or those messages are not available in that language. The default in each case is English.
     
  15. onStyle

    onStyle Scavenger

  16. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    That wrapper doesn't really tell me anything or do anything special. Make sure wherever you are getting the message from the Lang API that you are using the player's ID so that it can get which language they picked.
     
  17. onStyle

    onStyle Scavenger

    Okey, i find some. Only "You have voted to skip night" is working.

    Code (Text):
                if (VoteOpen)
                {
                    if (!AlreadyVoted(player.Id))
                    {
                        ReceivedVotes.Add(player.Id);
                        player.Reply(GetMSG("You have voted to skip night", player.Id));
                        if (DisplayCountEveryVote)
                            server.Broadcast($"{configData.Messaging.MainColor}{ReceivedVotes.Count} / {RequiredVotes}</color> {configData.Messaging.MSGColor}{GetMSG("have voted to skip night", player.Id)}</color>");
                        if (ReceivedVotes.Count >= RequiredVotes)
                            VoteEnd(true);
                        return;
                    }
                }
    How this should look? How i should send message to whole server in right language and add playerid?
    Code (Text):
    server.Broadcast($"<color=#66e42a>{GetMSG("Voting was successful, skipping night.")}</color>");
     
  18. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    You'd have to loop through all of the players to do a broadcast that is localized.
     
    onStyle likes this.
  19. MonkeY12

    MonkeY12 Scavenger

    @Wulf pls update itemv2 github :D
     
  20. 5311

    5311 Scavenger

    @Wulf Can u help me?

    I have one error when I try update LootConfig to V2.

    Code (Text):
    14:36 [Error] Error while compiling: LootConfig.cs(206,30): error CS1061: Type `Oxide.Plugins.LootConfig.LootTreeNodeData' does not contain a definition for `AddChild' and no extension method `AddChild' of type `Oxide.Plugins.LootConfig.LootTreeNodeData' could be found. Are you missing an assembly reference?