Пример #1
0
        internal bool OnPlayerRequestSpawn(int playerid)
        {
            var args = new RequestSpawnEventArgs();

            OnPlayerRequestSpawn(BasePlayer.FindOrCreate(playerid), args);

            return(!args.PreventSpawning);
        }
Пример #2
0
        public override void OnRequestSpawn(RequestSpawnEventArgs e)
        {
            base.OnRequestSpawn(e);

            if (!(HasAccount && IsLoggedIn))
            {
                e.PreventSpawning = true;
            }
        }
Пример #3
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);
    }
Пример #4
0
        private void Class_PlayerRequestSpawn(object sender, RequestSpawnEventArgs e)
        {
            if (!(sender is Player player))
            {
                return;
            }

            var random   = new Random();
            var angle    = 0.0f;
            var position = Vector3.Zero;

            var spawns = new ClassSpawnRepository(ConnectionFactory.GetConnection).GetAllByClassType((int)player.PlayerClass);
            var index  = random.Next(0, spawns.Count());

            switch (player.PlayerClass)
            {
            case PlayerClassType.TruckDriver:
                position = new Vector3(spawns.ElementAt(index).PositionX, spawns.ElementAt(index).PositionY, spawns.ElementAt(index).PositionZ);
                angle    = spawns.ElementAt(index).Angle;

                BasePlayer.SendClientMessageToAll(Messages.PlayerJoinedTruckerClass, player.Name);
                break;

            case PlayerClassType.BusDriver:
                position = new Vector3(spawns.ElementAt(index).PositionX, spawns.ElementAt(index).PositionY, spawns.ElementAt(index).PositionZ);
                angle    = spawns.ElementAt(index).Angle;

                BasePlayer.SendClientMessageToAll(Messages.PlayerJoinedBusDriverClass, player.Name);
                break;

            case PlayerClassType.Pilot:
                position = new Vector3(spawns.ElementAt(index).PositionX, spawns.ElementAt(index).PositionY, spawns.ElementAt(index).PositionZ);
                angle    = spawns.ElementAt(index).Angle;

                BasePlayer.SendClientMessageToAll(Messages.PlayerJoinedPilotClass, player.Name);
                break;

            case PlayerClassType.Police:

                if (!player.CheckIfPlayerCanJoinPolice())
                {
                    e.PreventSpawning = true;
                    return;
                }

                if (player.Account.Score < 100)
                {
                    player.GameText("You need 100 score points for police class", 5000, 4);
                    player.SendClientMessage(Color.Red, "You need 100 score points for police class");
                    e.PreventSpawning = true;
                    return;
                }

                if (player.Account.Wanted > 0)
                {
                    player.GameText("You are not allowed to choose police class when you're wanted", 5000, 4);
                    player.SendClientMessage(Color.Red, "You are not allowed to choose police class when you're wanted");
                    e.PreventSpawning = true;
                    return;
                }

                position = new Vector3(spawns.ElementAt(index).PositionX, spawns.ElementAt(index).PositionY, spawns.ElementAt(index).PositionZ);
                angle    = spawns.ElementAt(index).Angle;

                BasePlayer.SendClientMessageToAll(Messages.PlayerJoinedPoliceClass, player.Name);
                break;

            case PlayerClassType.Mafia:
                position = new Vector3(spawns.ElementAt(index).PositionX, spawns.ElementAt(index).PositionY, spawns.ElementAt(index).PositionZ);
                angle    = spawns.ElementAt(index).Angle;

                BasePlayer.SendClientMessageToAll(Messages.PlayerJoinedMafiaClass, player.Name);
                break;

            case PlayerClassType.Assistance:
                position = new Vector3(spawns.ElementAt(index).PositionX, spawns.ElementAt(index).PositionY, spawns.ElementAt(index).PositionZ);
                angle    = spawns.ElementAt(index).Angle;

                BasePlayer.SendClientMessageToAll(Messages.PlayerJoinedAssistanceClass, player.Name);
                break;
            }

            player.SetSpawnInfo(0, player.Skin, position, angle);
        }