Hi guys. I'm stuck. How do I get random string + ulong out of this Dictionary and add it to ItemManager? Any help would be highly appreciated. Thanks in advance. :)
Dictionary<string, ulong> item = new Dictionary<string, ulong>()
{
{"hoodie", 889718910},
{"pants", 889714798},
{"hat.boonie", 10058},
{"mask.bandana", 889712013},
{"burlap.gloves", 1106600389},
{"shoes.boots", 920390242}
};
void OnEntitySpawned(BaseEntity entity)
{
int amount = 1;
if (entity != null && entity is NPCPlayerCorpse)
{
PlayerCorpse corpse = entity.GetComponent<PlayerCorpse>();
if (corpse._playerName == "Bob" && corpse.playerSteamID.ToString().StartsWith("76561198") != true)
{
float value = Random.value;
if (value > 0.7f)
{
int rnd = Random.Range(0, item.Count);
var createitem = ItemManager.CreateByName(item[rnd].Key, amount, item[rnd].Value);
NextTick(() =>
{
createitem.MoveToContainer(corpse.containers[0]);
});
}
}
}
}