private void addPort(BasePlayer player, string name, bool admin = false) { if (findPort(name) == null) { LustyPorts lustyPort = new LustyPorts(); lustyPort.name = name; lustyPort.admin = admin; lustyPort.x = player.transform.position.x; lustyPort.y = player.transform.position.y; lustyPort.z = player.transform.position.z; lustyPorts.Add(lustyPort); savePorts(); string adminTxt = ""; if (admin) { adminTxt = " (Admin only)"; } playerMsg(player, "Teleport location<color=#00ff00ff> " + name + adminTxt + "</color> added"); } else { playerMsg(player, "There is already a teleport location named<color=#00ff00ff> " + name + "</color>"); } }
private void tpPort(BasePlayer player, bool back, string name = null) { LustyPorts lustyPort = new LustyPorts(); if (back) { if (lustyPlayers.Count > 0) { lustyPort = lustyPlayers.Find(r => r.userid == player.userID).lustyPort; if (lustyPort == null) { playerMsg(player, "You do not have an orginal location to teleport back too"); return; } } else { playerMsg(player, "You do not have an orginal location to teleport back too"); return; } } else { lustyPort = findPort(name); } if (lustyPort != null) { if (findTeleportingPlayer(player.userID) == null) { if (!lustyPort.admin) { startPort(player, lustyPort, back); } else if (isAdmin(player)) { startPort(player, lustyPort, back); } else { playerMsg(player, "You do not have access to teleport to that location"); } } else { playerMsg(player, "You already have an active teleport request"); } } else { playerMsg(player, "Teleport location <color=#00ff00ff>" + name + "</color> not found"); } }
private void startPort(BasePlayer player, LustyPorts lustyPort, bool back) { LustyTeleportings tpPlayer = new LustyTeleportings(); tpPlayer.starttime = DateTime.UtcNow; tpPlayer.userid = player.userID; tpPlayer.x = player.transform.position.x; tpPlayer.y = player.transform.position.y; tpPlayer.z = player.transform.position.z; tpPlayer.lustyPort = lustyPort; tpPlayer.back = back; teleportingPlayers.Add(tpPlayer); playerMsg(player, "Teleport initiated, you will be teleported in <color=#00ff00ff>" + teleportDuration + "</color> seconds, remain still!"); }
private void delPort(BasePlayer player, string name) { LustyPorts lustyPort = findPort(name); if (lustyPort != null) { lustyPorts.Remove(lustyPort); savePorts(); playerMsg(player, "Teleport location<color=#00ff00ff> " + name + " </color>removed"); } else { playerMsg(player, "There is already a teleport location named<color=#00ff00ff> " + name + "</color>"); } }
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(); }
private LustyPorts findPort(string name) { LustyPorts lustyPort = lustyPorts.Find(r => r.name.ToLower() == name.ToLower()); return lustyPort; }