Alright so, how do I check if a config value exists or not? What I was doing is
However that isn't working. It never adds new items. So what can I do to check if a config value is null?Code:if (Config[item.displayName.english] == null) { Config[item.displayName.english] = item.stackable; dirty = true; }
Solved If config value doesn't exist (C#)
Discussion in 'Rust Development' started by AnExiledGod, Jul 10, 2015.
-
Which item is not catched this way? If a key does not exist "null" is returned, so everything should work fine
Edit: your plugin worked fine this way? [Stack Size Controller] Updating configuration file with new values.Last edited by a moderator: Jul 10, 2015 -
I have it running on my server right now, and it's not updating my config file. I'll have to delete my config to update, but the second I do that I can't add the new items.
-
are there any new stackable items? wondering why i got the update config message on my server...
-
Dumb question perhaps, but did you use SaveConfig()?
-
SaveConfig is there...
I've checked it again with rename/removing of config entries, and everytime the plugin is loaded the missing ones where re-added, so all should be fine. Also if i delete the config, on plugin add/reload a new config is created with all stackable items...
Correct me if i'm wrong but the list looks complete to me:
Code:{ "12 Gauge Buckshot": 64, "12 Gauge Slug": 32, "5.56 Rifle Ammo\n": 64, "Acoustic Guitar": 1, "Animal Fat": 1000, "Anti-Radiation Pills": 10, "Apple": 10, "Bandage": 1, "Barbed Wooden Barricade": 1, "Battery - Small": 1, "Beancan Grenade": 1, "Bear Meat": 20, "Bed": 1, "Black Raspberries": 1, "Blood": 1000, "Blue Longsleeve T-Shirt": 1, "Blueberries": 20, "Bone Fragments": 1000, "Bota Bag": 1, "Bucket Helmet": 1, "Building Plan": 1, "Burlap Headwrap": 1, "Burlap Shirt": 1, "Burlap Shoes": 1, "Burlap Trousers": 1, "Burned Chicken": 20, "Burned Human Meat": 20, "Burned Wolf Meat": 20, "Camera": 1, "Camp Fire": 1, "Can of Beans": 1, "Can of Tuna": 1, "Candle Hat": 1, "Charcoal": 500, "Chocolate Bar": 1, "Cloth": 1000, "Code Lock": 1, "Coffee Can Helmet": 1, "Concrete Barricade": 1, "Cooked Chicken": 20, "Cooked Human Meat": 20, "Cooked Wolf Meat": 20, "Corn Seed": 50, "Door Key": 1, "Empty Can Of Beans": 1, "Empty Tuna Can": 1, "Explosive 5.56 Rifle Ammo": 64, "Explosives": 100, "F1 Grenade": 1, "Flare": 1, "Furnace": 1, "Granola Bar": 1, "Green T-Shirt": 1, "Gun Powder": 1000, "Hammer": 1, "Handmade Shell": 64, "Hazmat Boots": 1, "Hazmat Gloves": 1, "Hazmat Helmet": 1, "Hazmat Jacket": 1, "Hazmat Pants": 1, "Hide Boots": 1, "Hide Pants": 1, "Hide Poncho": 1, "Hide Vest": 1, "High Velocity Arrow": 48, "High Velocity Rocket": 3, "Huge Wooden Sign": 1, "Human Skull": 1, "HV 5.56 Rifle Ammo": 64, "HV Pistol Ammo\t": 64, "Incendiary 5.56 Rifle Ammo": 64, "Incendiary Pistol Bullet": 64, "Incendiary Rocket": 3, "Land Mine": 5, "Lantern": 1, "Large Medkit": 1, "Large Water Catcher": 1, "Large Wood Box": 1, "Large Wooden Sign": 1, "Leather Gloves": 1, "Lock": 1, "Low Grade Fuel": 500, "Medical Syringe": 1, "Metal - Refined": 100, "Metal Barricade": 1, "Metal Chest Plate": 1, "Metal Facemask": 1, "Metal Fragments": 1000, "Metal Ore": 1000, "Miners Hat": 1, "Mining Quarry": 1, "Mushroom": 10, "Note": 1, "Paper": 1000, "Paper Map": 1, "Pistol Bullet": 64, "Pumpkin Seed": 50, "Raw Chicken Breast": 20, "Raw Human Meat": 20, "Raw Wolf Meat": 20, "Red Jacket": 1, "Repair Bench": 1, "Research Table": 1, "Riot Helmet": 1, "Road Sign Jacket": 1, "Rocket": 3, "Rotten Apple": 1, "Salt Water": 2147483647, "Sandbag Barricade": 1, "Sleeping Bag": 1, "Small Water Bottle": 1, "Small Water Catcher": 1, "Small Wooden Sign": 1, "Smoke Rocket WIP!!!!": 3, "Snap Trap": 1, "Snow Jacket - Black": 1, "Snow Jacket - Red": 1, "Snow Jacket - Wood Camo": 1, "Spoiled Chicken": 20, "Spoiled Human Meat": 20, "Spoiled Wolf Meat": 20, "Stone Barriade": 1, "Stones": 1000, "Sulfur": 1000, "Sulfur Ore": 1000, "Supply Signal": 1, "Survey Charge": 10, "Timed Explosive Charge": 10, "Tool Cupboard": 1, "Urban Boots": 1, "Urban Pants": 1, "Vagabond Jacket": 1, "Water": 2147483647, "Wolf Headdress": 1, "Wolf Skull": 1, "Wood": 1000, "Wood Storage Box": 1, "Wooden Arrow": 32, "Wooden Barricade": 1, "Wooden Floor Spikes": 1, "Wooden Ladder": 1, "Wooden Sign": 1 }
-
Your right, and I'm an idiot. Hehe. I forgot I have a check in there that doesn't include things with durability, and these new items don't have durability.
I am not a smart man.