public override void OnConnectionReady(NetConnection client) { // Allocate the player to a team AddPlayerToTeam(client, NetPlayerComponent.GetPlayer(client)); // Get client up to date NetChannel.FireEvent("Client_GamemodeInfo", client, (ushort)SCORE_CAP); NetChannel.FireEvent("Client_UpdateScores", client, RemoteFlag.None, NetDeliveryMethod.ReliableOrdered, (short)teamAScore, (short)teamBScore); // Spawn their player AddRespawn(client, 0); }
private void ObjectComponent_OnCreatableInstantiated(object sender, NetCreatableInfo e) { ServerMPPlayer player = e.Creatable as ServerMPPlayer; if (player != null) { // Update network player NetworkPlayer netPlayer = NetPlayerComponent.GetPlayer(e.Owner); netPlayer.CharacterId = player.StateInfo.Id; // Player is all set Players.Add(player.StateInfo.Owner, player); // Inform the rest of the gamemode OnPlayerAdded(player.StateInfo.Owner, player); } }
protected override void OnPlayerRespawn(NetConnection client) { // Find the connections networkplayer NetworkPlayer netPlayer = NetPlayerComponent.GetPlayer(client); Team team = netPlayer.Team; if (team == Team.None) { DashCMD.WriteError("[TDMGamemode] Failed to respawn player, they do not have a team!"); } else { Vector3 spawnLocation = team == Team.A ? redPost.Transform.Position : bluePost.Transform.Position; // Create the character SpawnPlayer(client, spawnLocation, team); } }
public override void OnConnectionReady(NetConnection client) { // Allocate the player to a team AddPlayerToTeam(client, NetPlayerComponent.GetPlayer(client)); // Get client up to date NetChannel.FireEvent("Client_GamemodeInfo", client, (ushort)SCORE_CAP); NetChannel.FireEvent("Client_UpdateScores", client, RemoteFlag.None, NetDeliveryMethod.ReliableOrdered, (short)teamAScore, (short)teamBScore); if (redIntel.Holder != null) { NetChannel.FireEvent("Client_IntelPickedUp", client, (byte)Team.A, ((ServerMPPlayer)redIntel.Holder).StateInfo.Id); } if (blueIntel.Holder != null) { NetChannel.FireEvent("Client_IntelPickedUp", client, (byte)Team.B, ((ServerMPPlayer)blueIntel.Holder).StateInfo.Id); } // Spawn their player AddRespawn(client, 0); }