ArgumentOutOfRangeException trying to get item from listSolved
whitelist = new List<string>
                {

                    "berry-black-collectable",
                    "berry-blue-collectable",
                    "berry-green-collectable",
                    "berry-red-collectable",
                    "berry-white-collectable",
                    "berry-yellow-collectable",
                    "hemp-collectable",

                },


if (config.whitelist.Contains(entity.ShortPrefabName)) 
                {
                    Puts("works");    
                }

i can't figure out why this doesn't work. can someone help?

if it helps, when i do this i get this error.
[ChatCommand("whitelist")]
        void whitelist(BasePlayer player)
        {

            Puts(config.whitelist[5]);
        }​

Failed to call hook 'whitelist' on plugin 'BlueberryChance v1.0.0' (ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index)
  at System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) [0x00029] in <437ba245d8404784b9fbab9b439ac908>:0
  at System.ThrowHelper.ThrowArgumentOutOfRangeException () [0x00000] in <437ba245d8404784b9fbab9b439ac908>:0                                                                                                           
  at Oxide.Plugins.BlueberryChance.berry (BasePlayer player) [0x0001c] in <9aac57cab65d4a3ea519332fe2932867>:0
  at Oxide.Plugins.BlueberryChance.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x0005c] in <9aac57cab65d4a3ea519332fe2932867>:0
  at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <d09a1f46ca2f4432811bcfe45ad13c7b>:0
  at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <cf88a28c7fb44d36890d85a78331cc9d>:0
  at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <cf88a28c7fb44d36890d85a78331cc9d>:0​
Loop over the list to see what it contains. It doesn't have the number based on the exception.

You also showed the C# creation of the list, not the actual config file contents.
5e13a8d5b2bc5.jpg Wulf
Loop over the list to see what it contains. It doesn't have the number based on the exception.

You also showed the C# creation of the list, not the actual config file contents.

sorry, i made a small error. The config file didnt update when i changed it.

Locked automatically