Tasharen Entertainment Forum

Support => TNet 3 Support => Topic started by: xandeck on May 10, 2016, 08:13:25 PM

Title: TNet 3 - Join channel replaces original player limit
Post by: xandeck on May 10, 2016, 08:13:25 PM
Hello Aren,

I was testing the new server now and it looks like everytime someone join the channel, it replaces the last max player limit in the room.
This code:
  1. TNManager.JoinChannel(channelId, null, false, 0, "123", false);
  2.  

Replaces the original max player that a host created first.
What I should place in there to leave "max players" as before?

- I am creating a room normally
  1. TNManager.CreateChannel(null, false, 10, "123", false);
  2.  
- A player join the room using that Join code above
- No matter if I put, as parameter, max player to 0, 10, 99... it replaces what the host created

What should I use there?
Thanks

EDIT: I made it work because I know how many players the host had before, and before connecting, the new player uses the same max player limit to Join (which is actually not a solution I believe). So, if there is any other way, please let me know =)
Title: Re: TNet 3 - Join channel replaces original player limit
Post by: ArenMook on May 14, 2016, 06:42:31 PM
Looking at the code, this only happens if the level name was not specified. I think this is more of a bug than anything. You can fix it by replacing TNGameServer.cs line 1036:
  1.                         else if (string.IsNullOrEmpty(channel.password) || (channel.password == pass))
  2.                         {
  3.                                 if (string.IsNullOrEmpty(channel.level))
  4.                                 {
  5.                                         channel.persistent = persist;
  6.                                         channel.level = levelName;
  7.                                         channel.playerLimit = playerLimit;
  8.                                 }
  9.  
  10.                                 SendJoinChannel(player, channel, levelName);
  11.                         }
with:
  1.                         else if (string.IsNullOrEmpty(channel.password) || (channel.password == pass))
  2.                         {
  3.                                 SendJoinChannel(player, channel, channel.level);
  4.                         }
Title: Re: TNet 3 - Join channel replaces original player limit
Post by: xandeck on May 15, 2016, 05:31:31 PM
Thanks, I will change that.