Game Development Community

Client check if connected

by frostwind · in Torque 3D Beginner · 10/06/2013 (6:39 pm) · 1 replies

How do I check if I connect to a server? Like, say if I connect so a server, and when I connect, something like newchatso.addline("This is a client-only chat message. You successfully connected."); would happen. Thanks!

#1
10/07/2013 (3:35 pm)
If your looking for the moment when the client connects to the server you can probably check out the "GameConnection::onConnect" function in "game/core/scripts/server/clientConnection.cs"

They actually already have code in there to send a message:

// Inform the client we've joined up
   messageClient(%client,
      'MsgClientJoin', 'Welcome to a Torque application %1.', 
      %client.playerName, 
      %client,
      %client.sendGuid,
      %client.team,
      %client.score,
      %client.isAiControlled(), 
      %client.isAdmin, 
      %client.isSuperAdmin);

That's around line 100 in my file.

Hope this helps!