first draft eventport

This commit is contained in:
Fabian
2021-04-25 17:15:44 +02:00
parent 49255eafd2
commit fa03d86d3f
2 changed files with 51 additions and 1 deletions

View File

@@ -17,6 +17,53 @@ namespace ReallifeGamemode.Server.Commands
{
internal class UserCommands : Script
{
[Command("eventport", "~m~eventport")]
public void CmdUserEventport(Player player, String option = "")
{
if (!player.IsLoggedIn()) return;
if (option == "on")
{
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
{
return;
}
PositionManager.eventportPosition = player.Position;
PositionManager.eventportActive = true;
player.SendChatMessage("~y~Du hast hier erfolgreich einen Eventport gesetzt.");
return;
}
if (option == "off")
{
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
{
return;
}
PositionManager.eventportActive = false;
player.SendChatMessage("Du hast den Eventport deaktiviert.");
return;
}
if (!PositionManager.eventportActive || PositionManager.eventportPosition == null)
{
player.SendChatMessage("Im Moment ist kein Eventport aktiv.");
return;
}
using (var dbContext = new DatabaseContext())
{
User user = player.GetUser(dbContext);
if (user.Wanteds > 0 || user.JailTime > 0 || player.HasData("inGangWar") || !player.IsAlive())
{
ChatService.ErrorMessage(player, "Momentan kannst du keinen Eventport nutzen");
return;
}
}
player.SafeTeleport(PositionManager.eventportPosition);
}
[Command("look", "~m~look")]
public void CmdUserLook(Player player)
{

View File

@@ -32,6 +32,9 @@ namespace ReallifeGamemode.Server.Managers
public static List<AmmunationPoint> AmmunationPoints = new List<AmmunationPoint>();
public static Vector3 eventportPosition;
public static bool eventportActive = false;
public static void LoadPositionManager()
{
#region DutyPoints