so, people seem to ignore my post, so here it is:
Why do you capitalize stuff randomly and then leave out camelCase in important places? In Torque it does not matter, but in a real programming language it will.
There's actually a bunch of ways to do this, none of them 100% correct, which is probably why there's no one "isHost" method on the GameConnection.
%client.isLocalConnection()
This is without a doubt
the best method for detecting the host. If they're the local connection, they ARE the host.
Does not work with dedicated servers.%client.bl_id == getNumKeyID()
Also good. If the bl_id is the same as the num key, they are the same CD Key as the host.
Does not work with LAN.Probably the best way to do it is something like this:
function GameConnection::isHost(%client)
{
if($Server::Dedicated)
{
if($Server::LAN)
{
return %client.isSuperAdmin;
}
else
{
return %client.bl_id == getNumKeyID();
}
}
else
{
return %client.isLocalConnection();
}
}
If the server is dedicated and it's a LAN server, the only proper way to check is to ask if the client is a super admin. Therefore, there can be multiple hosts.
If the server is dedicated and it's an Internet server, we check Blockland IDs.
If the server isn't dedicated, we only care if it's the local connection.