Game Development Community

Check if client connected / pass vars to server when connecting

by Very Interactive Person · in Torque Game Engine · 05/08/2004 (3:09 pm) · 1 replies

These questions may sound stupid, but I only started scripting again last week (after a couple of months of not looking at torque), and I ran into a couple of problems/questions.

1) How do I know if a client is connected to a server or not (and I mean on the client... I have a gui that does a command to server, but if the client is not connected I want it to do something else)

2) When a client enters a game, %this (the client id) is passed to the onClientEntergame function on the server. How do I pass more variables to this function? I can't seem to find anything on the client side. I mean where is code on the client for this? The thing is I want to pass the server 2 client prefs.

#1
05/08/2004 (7:22 pm)
1) I think there is a global ServerConnection object which contains the connection to the server (in script). Or maybe it's GameConnection::getServerConnection(). Anyway, if there's a connection, you're connected, so find out if there's a connection. :)

2) That function is called from the GameConnection class. You could modify the C++ code or just set up a clientCmd to accept the data.