From e30f1bb7f351e7bc4b8a22eb58b6cf6a00f3cb61 Mon Sep 17 00:00:00 2001 From: hydrant Date: Mon, 19 Apr 2021 21:16:15 +0200 Subject: [PATCH] admin unshow und tsupport links anzeigen --- ReallifeGamemode.Client/Gui/blips.ts | 15 ++++-- ReallifeGamemode.Client/Gui/infobox.ts | 46 ++++++++++++++----- ReallifeGamemode.Client/Gui/nametags.ts | 4 ++ .../Entities/Logs/LogEntry.cs | 30 ++++++++++++ .../Commands/AdminCommands.cs | 29 ++++++++++++ .../Extensions/ClientExtension.cs | 8 +++- 6 files changed, 117 insertions(+), 15 deletions(-) create mode 100644 ReallifeGamemode.Database/Entities/Logs/LogEntry.cs diff --git a/ReallifeGamemode.Client/Gui/blips.ts b/ReallifeGamemode.Client/Gui/blips.ts index 1c44de47..250bed9a 100644 --- a/ReallifeGamemode.Client/Gui/blips.ts +++ b/ReallifeGamemode.Client/Gui/blips.ts @@ -26,13 +26,22 @@ } let pBlip = playerBlipMap.get(player); if (player.isDead()) { - pBlip.setSprite(303); + pBlip.setSprite(274); + pBlip.setScale(0.5); } else { pBlip.setSprite(1); + pBlip.setSprite(0.7); } let color = player.getVariable("blipColor"); - pBlip.setColour(isNaN(color) ? 0 : color); - pBlip.setPosition(player.position.x, player.position.y, player.position.z); + + if (color === -1) { + pBlip.setAlpha(0); + } else { + pBlip.setAlpha(200); + + pBlip.setColour(isNaN(color) ? 0 : color); + pBlip.setPosition(player.position.x, player.position.y, player.position.z); + } }); }, 50); diff --git a/ReallifeGamemode.Client/Gui/infobox.ts b/ReallifeGamemode.Client/Gui/infobox.ts index eb8a65fa..5e53bb15 100644 --- a/ReallifeGamemode.Client/Gui/infobox.ts +++ b/ReallifeGamemode.Client/Gui/infobox.ts @@ -14,6 +14,8 @@ export default function (globalData: IGlobalData): void { var draw = false; var editMode = false; var adutyMode = false; + var adminUnshow = false; + var adminTSupport = false; var dutyMode = false; let jailTime = 0; let att_score = 0; @@ -62,6 +64,14 @@ export default function (globalData: IGlobalData): void { adutyMode = toggle; }); + mp.events.add('toggleTSupportMode', (toggle) => { + adminTSupport = toggle; + }); + + mp.events.add('toggleAdminUnshowMode', (toggle) => { + adminUnshow = toggle; + }); + mp.events.add("toggleEditMode", (toggle) => { editMode = toggle; }); @@ -300,16 +310,6 @@ export default function (globalData: IGlobalData): void { centre: false }) } - if (adutyMode === true) { - mp.game.graphics.drawText("~r~SUPPORT", [0.92, 0.6], - { - font: 2, - color: [0, 255, 255, 255], - scale: [0.7, 0.7], - outline: true, - centre: false - }) - } if (dutyMode === true) { mp.game.graphics.drawText("~r~Duty", [0.92, 0.55], { @@ -320,7 +320,31 @@ export default function (globalData: IGlobalData): void { centre: false }) } - + if (adutyMode === true) { + var adutyText = "~r~SUPPORT"; + if (adminTSupport) { + adutyText = "SUPPORT"; + } + mp.game.graphics.drawText(adutyText, [0.92, 0.6], + { + font: 2, + color: [0, 229, 238, 255], + scale: [0.7, 0.7], + outline: true, + centre: false + }) + } + if (adminUnshow) { + mp.game.graphics.drawText("~r~UNSHOW", [0.92, 0.65], + { + font: 2, + color: [0, 255, 255, 255], + scale: [0.7, 0.7], + outline: true, + centre: false + }) + } + if (countdown > 0) { var now = Date.now(); var diff = Math.trunc((now - cdTimestamp) / 1000); diff --git a/ReallifeGamemode.Client/Gui/nametags.ts b/ReallifeGamemode.Client/Gui/nametags.ts index 21e76eea..1c106922 100644 --- a/ReallifeGamemode.Client/Gui/nametags.ts +++ b/ReallifeGamemode.Client/Gui/nametags.ts @@ -49,6 +49,10 @@ export default function customNametags() { let colorId = game.players.at(player.remoteId).nametagColor; + if (colorId === -3) { + return; + } + let color = colors.find(c => c.id === colorId).color; let nametagText = player.name + " (" + player.remoteId + ")"; diff --git a/ReallifeGamemode.Database/Entities/Logs/LogEntry.cs b/ReallifeGamemode.Database/Entities/Logs/LogEntry.cs new file mode 100644 index 00000000..0b025ba2 --- /dev/null +++ b/ReallifeGamemode.Database/Entities/Logs/LogEntry.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.Text; + +namespace ReallifeGamemode.Database.Entities.Logs +{ + public class LogEntry + { + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + public long Id { get; set; } + + public User User { get; set; } + + public int UserId { get; set; } + + public User AffectedBy { get; set; } + + public int? AffectedById { get; set; } + + public Faction AffectedFaction { get; set; } + + public int? AffectedFactionId { get; set; } + + public string Message { get; set; } + + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + public DateTime Time { get; set; } + } +} diff --git a/ReallifeGamemode.Server/Commands/AdminCommands.cs b/ReallifeGamemode.Server/Commands/AdminCommands.cs index b2ab2901..8706a6b4 100644 --- a/ReallifeGamemode.Server/Commands/AdminCommands.cs +++ b/ReallifeGamemode.Server/Commands/AdminCommands.cs @@ -259,11 +259,13 @@ namespace ReallifeGamemode.Server.Commands } if (player.GetData("SAdminduty") == false) { + player.TriggerEvent("toggleTSupportMode", true); player.SetData("SAdminduty", true); ChatService.SendMessage(player, "~g~ ** " + "Du befindest dich im T-Support"); } else { + player.TriggerEvent("toggleTSupportMode", false); player.SetData("SAdminduty", false); ChatService.SendMessage(player, "!{#ee4d2e}** " + "Du befindest dich nicht mehr im T-Support"); } @@ -1442,6 +1444,33 @@ namespace ReallifeGamemode.Server.Commands Medic.delReviveTask(target); } + [Command("aunshow", "~m~Benutzung:~s~ /aunshow")] + public void CmdAdminUnshow(Player player) + { + User user = player.GetUser(); + if (!user.IsAdmin(AdminLevel.HEADADMIN)) + { + ChatService.NotAuthorized(player); + return; + } + + bool currentStatus = user.GetData("adminUnshow"); + currentStatus = !currentStatus; + user.SetData("adminUnshow", currentStatus); + player.TriggerEvent("toggleAdminUnshowMode", currentStatus); + + user.SetBlipAndNametagColor(); + + if(currentStatus) + { + ChatService.SendMessage(player, "~b~[ADMIN]~s~ Du bist nun Unshow"); + } + else + { + ChatService.SendMessage(player, "~b~[ADMIN]~s~ Du bist nun nicht mehr Unshow"); + } + } + [Command("setap", "~m~Benutzung: ~s~/setap [Spieler] (Armor)")] public void CmdAdminSetAP(Player player, string name, int armor = 100) { diff --git a/ReallifeGamemode.Server/Extensions/ClientExtension.cs b/ReallifeGamemode.Server/Extensions/ClientExtension.cs index 80ef22a7..3a665dd0 100644 --- a/ReallifeGamemode.Server/Extensions/ClientExtension.cs +++ b/ReallifeGamemode.Server/Extensions/ClientExtension.cs @@ -345,8 +345,14 @@ namespace ReallifeGamemode.Server.Extensions } bool duty = user.GetData("duty"); + bool adminUnshow = user.GetData("adminUnshow"); - if (player.GetData("SAdminduty")) + if(adminUnshow) + { + blipColor = -1; + nameTagColor = -3; + } + else if (player.GetData("SAdminduty")) { blipColor = 30; nameTagColor = -2;