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.
Checking if a dictionary has a null table?
Discussion in 'Rust Development' started by ThunderZ, Jun 28, 2016.
-
Wulf Community Admin
Something like that may work, otherwise just a == null check may work.Code:if (!playerData.Kills.ContainsKey(player.userID)) playerData.Kills[player.userID] = 0;
-
!playerData.Kills.ContainsKey(player.userID)
Yeah i just found that out just now google ftw sorry
works.
