Author Topic: How to use DeleteChannel  (Read 7922 times)

Shifty Geezer

  • Full Member
  • ***
  • Thank You
  • -Given: 7
  • -Receive: 9
  • Posts: 226
    • View Profile
How to use DeleteChannel
« on: November 28, 2016, 09:29:47 AM »
My game has drop in/drop out coop into a host's game. When the host leaves (level complete), the game closes and clients are returned to the menu with no host migration. I have Channel 1 open for sending game details for joining players, and Channel 2 is the game itself. When a level is complete, I want to close Channel 2 and the game and return everyone to the preparation phase using Channel 1.

I'm thinking I should delete Channel 2 so I can recreate it again in the way I do initially, but I get a "not authorized" error. I can't find any documentation on authorisation for Channel 2 removal - doesn't matter whether I'm in the channel or not, it seems.

So how do I go about deleting the channel and starting again from scratch as if Channel 2 was never created? Or should I go about this some other way?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How to use DeleteChannel
« Reply #1 on: November 28, 2016, 11:19:49 AM »
Assuming the channel isn't persistent, simply having all players leave the channel is enough to discard it.

If you want to explicitly close a channel, you need to set a server flag: TNManager.SetServerData("canCloseChannels", true); -- whoever creates the server can do this.