Tasharen Entertainment Forum

Support => TNet 3 Support => Topic started by: krvc on January 12, 2017, 12:43:08 PM

Title: Cant clear channel data after player exit
Post by: krvc on January 12, 2017, 12:43:08 PM
hi. my players sometimes write data on channel. (example tno.isMine TNManager.SetChannelData("info", +1);)
i cant find good way how clear it. (players lose connection or use alt+f4 to exit from game)

1.  i create empty "sample object" and write data to it. (TNManager.Instantiate FALSE)
then players off - object destroy, and i use code in Destroy() void - every players send ("info", -1) - wrong result.....

2. i added if tno.isMine - sometimes clear info, sometimes no... (players lose connection or use alt+f4 to exit from game)

3. okay i create new object (TNManager.Instantiate TRUE) for ONE player - its my virtual host. it player clear data other players.
yes, now data others players clear a good. Then player a leave object change owner to next player, object have tno.isMine
and clear data for One player, but sometimes its clearing data for new Owner too...
Title: Re: Cant clear channel data after player exit
Post by: ArenMook on January 13, 2017, 10:54:00 PM
SetChannelData("info", null);

Note that tno.isMine is the wrong check here. Channel data can only be set by the channel's host. You should be checking for TNManager.IsHosting(tno.channelID);