Plugin cannot read datafile after server restartSolved
Im using nested keys to read and write data to a datafile by doing
dataFile["admins", player.UserIDString, "Admin"] = "true"
dataFile.Save();​

and then using an if statement to check it

if(dataFile["admins", player.UserIDString, "Admin"] == "true")
{

}

which seems to work perfectly well until you restart the server which it then goes past all of my if statements and does nothing even if its checking if it is null.
The only way i have found to fix it is to clear the datafile but at the same time that really isnt a fix.

or if the plugin gets reloaded
Are you sure you are reading the file right? 

Merged post

Also whats the point of using the string instead of boolean?
im quite sure im reading the file considering it works fine without the plugin reloading unless you can tell me otherwise and i am using the code below to define dataFile
DynamicConfigFile dataFile = Interface.Oxide.DataFileSystem.GetDatafile("Aquatic")


and im using a string instead of a boolean due to the if statement not liking me using a boolean as it errors with this:

Error while compiling: Aquatic.cs(108,25): error CS0019: Operator `==' cannot be applied to operands of type `object' and `bool'

Pixel1001
im quite sure im reading the file considering it works fine without the plugin reloading unless you can tell me otherwise and i am using the code below to define dataFile
DynamicConfigFile dataFile = Interface.Oxide.DataFileSystem.GetDatafile("Aquatic")


and im using a string instead of a boolean due to the if statement not liking me using a boolean as it errors with this:

Error while compiling: Aquatic.cs(108,25): error CS0019: Operator `==' cannot be applied to operands of type `object' and `bool'

Why dont you cast it to boolean then?
ok, i have done that now and that seems to have fixed it
but i dont really get why it fixed that
Pixel1001
ok, i have done that now and that seems to have fixed it
but i dont really get why it fixed that

The way you did it initially was wrong. If you are sure about variable type you should typecast it to avoid errors. Also I do not recommend to work with indexers in datafile, it's less error-prone to create a custom class and (de)serialize it with DynamicConfigFile.(Read/Write)Object<T>(string)

Locked automatically