Author Topic: Delete player created objects  (Read 4801 times)

Wuild

  • Guest
Delete player created objects
« on: February 20, 2013, 08:35:22 PM »
Hi, im trying to create a script that will delete a player created object when they disconnect from a channel/server.
Does anyone have any idea on how this can be done?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile

Wuild

  • Guest
Re: Delete player created objects
« Reply #2 on: February 20, 2013, 09:26:23 PM »
I dont understand.
I got it to work. sortof. the player object is only destroyd if there is atleast 1 other player online when disconnected, when another then is connecting again that last object wasnt destroyed and is still there.
« Last Edit: February 20, 2013, 09:50:19 PM by Wuild »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Delete player created objects
« Reply #3 on: February 21, 2013, 04:31:43 AM »
You should close the channel when the last player leaves. When joining a channel, pass "false" for the persistent flag.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Delete player created objects
« Reply #4 on: February 23, 2013, 10:02:35 AM »
I made this easier in TNet 1.6.0. You can now specify an additional flag when creating the object which will determine whether the object will remain in the scene or will be destroyed when the player leaves.