Exemplo n.º 1
0
        // Timer Function
        private void timerPort()
        {
            if (teleportingPlayers.Count > 0)
            {
                for (int i = teleportingPlayers.Count - 1; i >= 0; i--)
                {
                    LustyTeleportings teleportingPlayer = teleportingPlayers[i];
                    BasePlayer player = findPlayer(teleportingPlayer.userid);

                    if (checkTeleport(player, teleportingPlayer))
                    {
                        if (DateTime.UtcNow > teleportingPlayer.starttime.AddSeconds(teleportDuration))
                        {
                            if (teleportingPlayer.back)
                            {
                                LustyPlayers lustyPlayer = lustyPlayers.Find(r => r.userid == player.userID);
                                lustyPlayers.Remove(lustyPlayer);
                                savePlayers();
                            }
                            else
                            {
                                if (lustyPlayers.Count > 0)
                                {
                                    LustyPlayers lustyPlayerCheck = lustyPlayers.Find(r => r.userid == player.userID);
                                    if (lustyPlayerCheck == null)
                                    {
                                        addPlayer(player);
                                    }
                                }
                                else
                                {
                                    addPlayer(player);
                                }                                
                            }

                            Vector3 destination = new Vector3(teleportingPlayer.lustyPort.x, teleportingPlayer.lustyPort.y, teleportingPlayer.lustyPort.z);
                            TeleportPlayerPosition(player, destination);

                            teleportingPlayers.RemoveAt(i);
                        }
                        else
                        {
                            TimeSpan timeSpan = teleportingPlayer.starttime.AddSeconds(teleportDuration).Subtract(DateTime.UtcNow);
                            int time = Convert.ToInt16(Math.Ceiling(timeSpan.TotalSeconds));
                            if (time > 0 && time < teleportDuration)
                            {
                                playerMsg(player, "Teleporting in " + time.ToString());
                            }
                        }
                    }
                    else
                    {
                        teleportingPlayers.RemoveAt(i);
                        playerMsg(player, "Movement detected, aborting teleport.");
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void addPlayer(BasePlayer player)
        {
            LustyPlayers lustyPlayer = new LustyPlayers();
            lustyPlayer.userid = player.userID;

            LustyPorts lustyPort = new LustyPorts();
            lustyPort.admin = false;
            lustyPort.name = player.userID.ToString();
            lustyPort.x = player.transform.position.x;
            lustyPort.y = player.transform.position.y;
            lustyPort.z = player.transform.position.z;

            lustyPlayer.lustyPort = lustyPort;
            lustyPlayers.Add(lustyPlayer);
            savePlayers();
        }