From 111a0f2dea71b70f6329f26906cd14b299f887e6 Mon Sep 17 00:00:00 2001 From: Fabian Date: Mon, 26 Apr 2021 01:55:53 +0200 Subject: [PATCH] sani revive tote wanteds --- ReallifeGamemode.Client/Event/event.ts | 34 +++++++++++++++++++ .../Commands/AdminCommands.cs | 12 +++++++ .../Commands/FactionCommands.cs | 7 ++++ 3 files changed, 53 insertions(+) create mode 100644 ReallifeGamemode.Client/Event/event.ts diff --git a/ReallifeGamemode.Client/Event/event.ts b/ReallifeGamemode.Client/Event/event.ts new file mode 100644 index 00000000..eafdb730 --- /dev/null +++ b/ReallifeGamemode.Client/Event/event.ts @@ -0,0 +1,34 @@ +import * as NativeUI from '../libs/NativeUI'; + +const Menu = NativeUI.Menu; +const UIMenuItem = NativeUI.UIMenuItem; +const UIMenuListItem = NativeUI.UIMenuListItem; +const UIMenuCheckboxItem = NativeUI.UIMenuCheckboxItem; +const BadgeStyle = NativeUI.BadgeStyle; +const Point = NativeUI.Point; +const ItemsCollection = NativeUI.ItemsCollection; +const Color = NativeUI.Color; + +let ggbItem = new UIMenuItem("Gut gegen Boese", ""); +ggbItem.BackColor = new Color(42, 46, 49); + +export default function createEvent(globalData: IGlobalData) { + + var eventMenu: NativeUI.Menu; + let screenRes = mp.game.graphics.getScreenResolution(0, 0); + + mp.events.add('showEventMenu', () => { + + if (!globalData.InMenu) { + globalData.InMenu = true; + + eventMenu = new Menu("Event starten", "", new Point(0, screenRes.y / 3), null, null); + eventMenu.AddItem(ggbItem); + eventMenu.Visible = true; + + eventMenu.MenuClose.on(() => { + globalData.InMenu = false; + }); + } + }); +} \ No newline at end of file diff --git a/ReallifeGamemode.Server/Commands/AdminCommands.cs b/ReallifeGamemode.Server/Commands/AdminCommands.cs index ed036f49..db79857d 100644 --- a/ReallifeGamemode.Server/Commands/AdminCommands.cs +++ b/ReallifeGamemode.Server/Commands/AdminCommands.cs @@ -545,6 +545,18 @@ namespace ReallifeGamemode.Server.Commands #region Admin + [Command("event", "~m~Benutzung: ~s~/event")] + public void CmdAdminEvent(Player player) + { + if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) + { + ChatService.NotAuthorized(player); + return; + } + + player.TriggerEvent("showEventMenu"); + } + [Command("countdown", "~m~Benutzung: ~s~/countdown [Zeit] [Text]", GreedyArg = true)] public void CmdAdminCountdown(Player player, string timer_string, string text) { diff --git a/ReallifeGamemode.Server/Commands/FactionCommands.cs b/ReallifeGamemode.Server/Commands/FactionCommands.cs index f6ad5d2a..83968304 100644 --- a/ReallifeGamemode.Server/Commands/FactionCommands.cs +++ b/ReallifeGamemode.Server/Commands/FactionCommands.cs @@ -402,10 +402,17 @@ namespace ReallifeGamemode.Server.Commands ChatService.ErrorMessage(player, "Der Spieler hat eine Revivesperre"); return; } + using (var dbContext = new DatabaseContext()) { var deadPlayerUser = deadPlayer.GetUser(dbContext); + if (deadPlayerUser.Wanteds > 0) + { + ChatService.ErrorMessage(player, "Dieser Spieler hat Wanteds"); + return; + } + if (deadPlayerUser.Handmoney >= 100) { deadPlayerUser.Handmoney -= 100;