Game Development Community

Problems with disconnect();

by Lluis Andreu · in Torque 3D Professional · 10/19/2009 (5:39 pm) · 3 replies

Hi,

I'm trying to make a multiplayer game, but I have a problem when users exit from game. Trying in a full Template of T3D 1.0, when users exit (press ESC and say YES, for instance), the rest of users still seeing the "character" in their computers. If the same user come in another time, then there will be 2 characters by the same user, one with movement and one without it.

Are there any way to "clean" the users "vision"? I've searched a bit into the forum and I've seen something about onClientLeave or something like this, but I don't know how to use and where is it?

Thanks for all!

#1
10/19/2009 (7:31 pm)
Not certain if it's the issue but try this:

scripts/server/gamecore.cs

function GameCore::onClientLeaveGame(%game, %client)
{
   //echo (%game @"\c4 -> "@ %game.class @" -> GameCore::onClientLeaveGame");
/*
   // Cleanup the camera
   if (isObject(%this.camera))
      %this.camera.delete();
   // Cleanup the player
   if (isObject(%this.player))
      %this.player.delete();
*/	  
   // Cleanup the camera
   if (isObject(%client.camera))
      %client.camera.delete();
	  echo("camera delete");
   // Cleanup the player
   if (isObject(%client.player))
      %client.player.delete();
	  echo("player.delete");
}
#2
10/20/2009 (7:50 am)
Thanks Steve for your soon answer!

Yeah! It works! With this fix, the other players don't see anymore the player who has left the game.
#3
10/20/2009 (3:59 pm)
My fault for that, it was simply overlooked when changing things over to the gametype methods. This is/will be fixed for 1.1 -- I didn't know about the 1.01 version until after the fact.