public void SendPlayerData(string clientName) { ConnectedClientDataMsg msg = new ConnectedClientDataMsg(); msg.SteamID = Sync.MyId; msg.Name = clientName; msg.Join = true; var buffer = new byte[1024]; uint length; uint ticketHandle; // TODO: Store handle and end auth session on end if (!MySteam.API.GetAuthSessionTicket(out ticketHandle, buffer, out length)) { MyGuiScreenMainMenu.UnloadAndExitToMenu(); MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox( messageCaption: MyTexts.Get(MyCommonTexts.MessageBoxCaptionError), messageText: MyTexts.Get(MyCommonTexts.MultiplayerErrorConnectionFailed))); return; } msg.Token = new byte[length]; Array.Copy(buffer, msg.Token, length); ReplicationLayer.SendClientConnected(ref msg); }
void SendClientData(ulong steamTo, ulong connectedSteamID, string connectedClientName, bool join) { ConnectedClientDataMsg msg = new ConnectedClientDataMsg(); msg.SteamID = connectedSteamID; msg.Name = connectedClientName; msg.IsAdmin = MySandboxGame.ConfigDedicated.Administrators.Contains(connectedSteamID.ToString()) || MySandboxGame.ConfigDedicated.Administrators.Contains(ConvertSteamIDFrom64(connectedSteamID)); msg.Join = join; ReplicationLayer.SendClientConnected(ref msg, steamTo); }