1. Im a newb to C#

    So basically i made a dictionary list to store kills and deaths of players but im trying to make it so that even if the player loses connection they won't lose their kills and deaths tracked for that round.

    OnPlayerInit() i want to set playerData.Kills[player.userID] = 0 if the field is null however im not sure how to check if playerData.Kills[player.userID] is null.


    I want to do this so if the player reconnects mid round their kills and deaths arent reset.
     
  2. Wulf

    Wulf Community Admin

    Code:
    if (!playerData.Kills.ContainsKey(player.userID)) playerData.Kills[player.userID] = 0;
    Something like that may work, otherwise just a == null check may work.
     
  3. !playerData.Kills.ContainsKey(player.userID)

    Yeah i just found that out just now google ftw sorry :) works.