first draft eventport
This commit is contained in:
@@ -16,7 +16,54 @@ using ReallifeGamemode.Services;
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user