コード例 #1
0
    protected override void OnPlayerRequestClass(BasePlayer sender, RequestClassEventArgs e)
    {
        var player = sender as Player;

        if (player.IsStateUser == StateUser.Kill)
        {
            player.IsStateUser = StateUser.None;
            player.SetSpawnInfo(0, 0, new Vector3(0, 0, 0), 0);
            player.Spawn();
            return;
        }

        /* Check if the player has died before entering class selection. */
        if (player.IsDead)
        {
            Player.Remove(player);
            TextDrawGlobal.UpdateCountUsers();
            TextDrawGlobal.Hide(player);
            TextDrawPlayer.Hide(player);
        }

        player.Color            = ColorWhite;
        player.Team             = BasePlayer.NoTeam;
        player.IsSelectionClass = true;
        player.Position         = new Vector3(-1389.137451, 3314.043701, 20.493314);
        player.CameraPosition   = new Vector3(-1399.776000, 3310.254150, 21.525623);
        player.SetCameraLookAt(new Vector3(-1395.072143, 3311.873291, 22.027709));
        player.Angle      = 111.68f;
        player.Interior   = 0;
        player.PlayerTeam = (e.ClassId == 0) ? (TeamAlpha) : (TeamBeta);
        player.PlayerTeam.GetMessageTeamEnable(out var msg);
        player.GameText(msg, 999999999, 3);
        player.PlaySound(1132);
        player.IsDead = false;
    }
コード例 #2
0
    protected override void OnPlayerDisconnected(BasePlayer sender, DisconnectEventArgs e)
    {
        base.OnPlayerDisconnected(sender, e);
        var player = sender as Player;

        BasePlayer.SendDeathMessageToAll(null, player, Weapon.Disconnect);
        if (player.IsCapturedFlag())
        {
            player.Drop();
        }
        if (player.Team != BasePlayer.NoTeam)
        {
            Player.Remove(player);
            TextDrawGlobal.UpdateCountUsers();
        }
        TextDrawPlayer.Destroy(player);
        TextDrawGlobal.Hide(player);
        Player.RemoveLevels(player);
        if (player.AFK)
        {
            Player.UserAFKs.Remove(new UserAFK()
            {
                Player = player
            });
        }
        player.UpdateData("lastConnection", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
    }
コード例 #3
0
 public void SetNoTeam()
 {
     Remove(this);
     TextDrawGlobal.UpdateCountUsers();
     Team       = NoTeam;
     PlayerTeam = null;
     Color      = GameMode.ColorWhite;
 }
コード例 #4
0
    protected override void OnPlayerRequestSpawn(BasePlayer sender, RequestSpawnEventArgs e)
    {
        base.OnPlayerRequestSpawn(sender, e);
        var player = sender as Player;

        if (player.Account == AccountState.Login)
        {
            player.SendClientMessage(Color.Red, "Error: Debes iniciar sesión.");
            e.PreventSpawning = true;
            return;
        }
        if (player.Account == AccountState.Register)
        {
            player.SendClientMessage(Color.Red, "Error: Debes registrarte.");
            e.PreventSpawning = true;
            return;
        }
        if (CurrentMap.IsLoading)
        {
            e.PreventSpawning = true;
            player.SendClientMessage(Color.Red, $"Error: En {CurrentMap.MAX_TIME_LOADING} segundos se cargará el próximo mapa.");
            return;
        }
        if (player.PlayerTeam.GetMessageTeamEnable(out var msg))
        {
            e.PreventSpawning = true;
            player.GameText(msg, 999999999, 3);
            return;
        }
        player.StopAudioStream();
        // player.PlayAudioStream("https://dl.dropboxusercontent.com/s/mzt9qnigsh7pdfs/soundtrack.mp3");
        player.IsSelectionClass = false;
        player.GameText("_", 1000, 4);
        Player.Add(player);
        BasePlayer.SendClientMessageToAll($"{player.PlayerTeam.OtherColor}[Team {player.PlayerTeam.NameTeam}]: {player.Name} se añadió al equipo {player.PlayerTeam.NameTeam}.");
        player.SendClientMessage($"{Color.Pink}[!] {Color.White}Captura la bandera del equipo contrario.");
        if (player.PlayerTeam.Id == TeamID.Alpha)
        {
            player.SendClientMessage($"{Color.Pink}[!] {Color.White}Guíate con el {TeamBeta.OtherColor}ícono Azul {Color.White}que aparece en el mapa radar.");
        }
        else
        {
            player.SendClientMessage($"{Color.Pink}[!] {Color.White}Guíate con el {TeamAlpha.OtherColor}ícono Rojo {Color.White}que aparece en el mapa radar.");
        }
        player.SendClientMessage($"{Color.Pink}[!] {Color.White}Luego lleva la bandera a tu base.");
        if (player.PlayerTeam.Flag.PlayerCaptured != null)
        {
            player.SendClientMessage($"{Color.Pink}[!] {Color.White}{player.PlayerTeam.Flag.PlayerCaptured.Name} capturó la bandera de tu equipo, debes recuperarla.");
        }
        TextDrawGlobal.Show(player);
        TextDrawGlobal.UpdateCountUsers();
        TextDrawPlayer.UpdateTdStats(player);
        TextDrawPlayer.UpdateTdRank(player);
        TextDrawPlayer.Show(player);
        TextDrawEntry.Hide(player);
    }
コード例 #5
0
    private static void ChangeTeam(Player player)
    {
        if (player.Team == BasePlayer.NoTeam)
        {
            player.SendClientMessage(Color.Red, "Error: Usted no pertenece a ningún equipo.");
            return;
        }
        TeamAlpha.GetMessageTeamEnable(out var msgAlpha, false);
        TeamBeta.GetMessageTeamEnable(out var msgBeta, false);
        var ct = new TablistDialog("Change Team",
                                   new[] {
            "Name",
            "Users",
            "Availability"
        }, "Seleccionar", "Cerrar");

        ct.ShowDialog(player);
        ct.Response += (sender, e) =>
        {
            if (e.DialogButton == DialogButton.Left)
            {
                if (player.PlayerTeam.Id == (TeamID)e.ListItem)
                {
                    player.SendClientMessage(Color.Red, "Error: Ya formas parte de ese equipo.");
                    ct.ShowDialog(player);
                    return;
                }
                if (TeamAlpha.Members == TeamBeta.Members)
                {
                    player.SendClientMessage(Color.Red, $"Error: No puedes cambiarte al equipo {(e.ListItem == 0 ? "Alpha" : "Beta")} porque el equipo {player.PlayerTeam.NameTeam} quedaría desequilibrado.");
                    ct.ShowDialog(player);
                    return;
                }
                if (player.PlayerTeam.TeamRival.IsFull())
                {
                    player.SendClientMessage(Color.Red, "Error: El equipo no está disponible.");
                    ct.ShowDialog(player);
                    return;
                }
                if (player.IsCapturedFlag())
                {
                    player.Drop();
                }
                Player.Remove(player);
                player.PlayerTeam = (e.ListItem == 0) ? TeamAlpha : TeamBeta;
                Player.Add(player);
                BasePlayer.SendClientMessageToAll($"{player.PlayerTeam.OtherColor}[Team {player.PlayerTeam.NameTeam}]: {player.Name} se cambió al equipo {player.PlayerTeam.NameTeam}.");
                TextDrawGlobal.UpdateCountUsers();
                player.Spawn();
            }
        };
    }
コード例 #6
0
 /* When the new map is loaded.. */
 public static void OnLoadedMap()
 {
     GameTextForAll("_", 1000, 4);
     IsLoading = false;
     ForceMap  = -1;
     SendClientMessageToAll(Color.Yellow, "** El mapa se cargó con éxito!");
     foreach (Player player in BasePlayer.GetAll <Player>())
     {
         if (player.IsConnected)
         {
             player.Kills         = 0;
             player.Deaths        = 0;
             player.KillingSprees = 0;
             player.Adrenaline    = 0;
             if (player.Data.LevelVip == 3)
             {
                 player.Adrenaline = 100;
             }
             if (player.Team != NoTeam)
             {
                 player.ToggleControllable(true);
                 player.SetForceClass();
             }
             player.Team  = NoTeam;
             player.Color = ColorWhite;
         }
     }
     TeamAlpha.Players.Clear();
     TeamBeta.Players.Clear();
     TextDrawGlobal.UpdateCountUsers();
     TeamAlpha.ResetStats();
     TeamBeta.ResetStats();
     timeLeft = MAX_TIME_ROUND;
     Server.SetWeather(Weather);
     Server.SetWorldTime(WorldTime);
 }