From 523e1933174f7211c208df94198ed1c7f5e5a8ee Mon Sep 17 00:00:00 2001 From: hydrant Date: Sun, 11 Apr 2021 21:53:08 +0200 Subject: [PATCH 1/9] wanted abtauchen blinken --- ReallifeGamemode.Client/Gui/wanteds.ts | 4 + .../assets/html/wanteds/index.html | 133 +++++++++++------- .../Wanted/WantedEscapeTimer.cs | 18 ++- 3 files changed, 101 insertions(+), 54 deletions(-) diff --git a/ReallifeGamemode.Client/Gui/wanteds.ts b/ReallifeGamemode.Client/Gui/wanteds.ts index 3a33f5eb..2b04bbfc 100644 --- a/ReallifeGamemode.Client/Gui/wanteds.ts +++ b/ReallifeGamemode.Client/Gui/wanteds.ts @@ -4,4 +4,8 @@ mp.events.add("SERVER:SetWanteds", (count: number) => { browser.execute(`setWanteds(${count});`); }); + + mp.events.add("SERVER:SetWantedFlash", (flash) => { + browser.execute(`setFlashing(${flash});`); + }); } \ No newline at end of file diff --git a/ReallifeGamemode.Client/assets/html/wanteds/index.html b/ReallifeGamemode.Client/assets/html/wanteds/index.html index c374c5a1..dc979115 100644 --- a/ReallifeGamemode.Client/assets/html/wanteds/index.html +++ b/ReallifeGamemode.Client/assets/html/wanteds/index.html @@ -1,60 +1,99 @@  - - - Wanteds - - + #wanteds img { + width: 25px; + height: 25px; + margin-right: 5px; + filter: drop-shadow(0px 0px 1px #000000); + -webkit-filter: drop-shadow(0px 0px 1px #000000); + -moz-filter: drop-shadow(0px 0px 1px #000000); + } + + #wanteds span { + color: white; + font-family: "Pricedown", sans-serif; + font-size: 2.5em; + line-height: 1; + -webkit-text-stroke: 1px black; + margin-top: -5px; + } + - + - - + + \ No newline at end of file diff --git a/ReallifeGamemode.Server/Wanted/WantedEscapeTimer.cs b/ReallifeGamemode.Server/Wanted/WantedEscapeTimer.cs index 16786f60..530e4741 100644 --- a/ReallifeGamemode.Server/Wanted/WantedEscapeTimer.cs +++ b/ReallifeGamemode.Server/Wanted/WantedEscapeTimer.cs @@ -27,12 +27,8 @@ namespace ReallifeGamemode.Server.Wanted } */ - public static void ResetWantedTimeToElapse(Player client) + public static void ResetWantedTimeToElapse(User user) { - User user = client.GetUser(); - if (user.FactionId == 1 || user.FactionId == 3) - return; - waTimer[user.Id] = WantedEscapeTime; } @@ -45,7 +41,7 @@ namespace ReallifeGamemode.Server.Wanted if (user != null && user.Wanteds > 0) { if (!waTimer.ContainsKey(user.Id)) - ResetWantedTimeToElapse(player); + ResetWantedTimeToElapse(user); bool isNearCop = false; foreach (var playerCop in NAPI.Pools.GetAllPlayers()) @@ -70,7 +66,7 @@ namespace ReallifeGamemode.Server.Wanted if (waTimer[user.Id] <= 0) { - ResetWantedTimeToElapse(player); + ResetWantedTimeToElapse(user); player.SendChatMessage("~y~Du hast erfolgreich einen Wanted abgetaucht."); user.Wanteds -= 1; if (user.Wanteds == 0) @@ -82,7 +78,15 @@ namespace ReallifeGamemode.Server.Wanted waTimer[user.Id] = WantedEscapeTime; } else if (!isNearCop) + { + player.TriggerEvent("SERVER:SetWantedFlash", true); waTimer[user.Id] -= 2500; + } + else if (isNearCop) + { + player.TriggerEvent("SERVER:SetWantedFlash", false); + ResetWantedTimeToElapse(user); + } } } } From 8284983f0c24a9d8bcd8ef0f0a87b0574d6b3e5b Mon Sep 17 00:00:00 2001 From: hydrant Date: Sun, 11 Apr 2021 22:18:27 +0200 Subject: [PATCH 2/9] [HOTFIX] Anticheat: dont kick players who are not logged in --- ReallifeGamemode.Server/Admin/AntiCheat.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReallifeGamemode.Server/Admin/AntiCheat.cs b/ReallifeGamemode.Server/Admin/AntiCheat.cs index 1dc48cce..1feb42ae 100644 --- a/ReallifeGamemode.Server/Admin/AntiCheat.cs +++ b/ReallifeGamemode.Server/Admin/AntiCheat.cs @@ -26,7 +26,7 @@ namespace ReallifeGamemode.Server.Admin { if (!cheater.IsLoggedIn()) { - cheater.Kick(); + return; } if(cheater.IsAdminDuty()) From 231edc71d9ff448f818e9c785e8dc11337188307 Mon Sep 17 00:00:00 2001 From: hydrant Date: Sun, 11 Apr 2021 22:35:03 +0200 Subject: [PATCH 3/9] [HOTFIX] fix some nullreferences --- ReallifeGamemode.Server/Events/Death.cs | 8 +++- ReallifeGamemode.Server/Events/Disconnect.cs | 41 ++++++++++--------- .../Extensions/ClientExtension.cs | 3 +- 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/ReallifeGamemode.Server/Events/Death.cs b/ReallifeGamemode.Server/Events/Death.cs index 5dff77b5..c810c4ff 100644 --- a/ReallifeGamemode.Server/Events/Death.cs +++ b/ReallifeGamemode.Server/Events/Death.cs @@ -238,8 +238,12 @@ namespace ReallifeGamemode.Server.Events } player.RemoveAllWeapons(); MedicTask task = Medic.ReviveTasks.FirstOrDefault(t => t.Victim == player.Name); - Player medicPlayer = PlayerService.GetPlayerByNameOrId(task.MedicName); - Medic.RemoveTaskFromList(task); + + if(task != null) + { + Player medicPlayer = PlayerService.GetPlayerByNameOrId(task.MedicName); + Medic.RemoveTaskFromList(task); + } player.SafeTeleport(new Vector3(-495.45, -336.33, 34.5), 0, true); } diff --git a/ReallifeGamemode.Server/Events/Disconnect.cs b/ReallifeGamemode.Server/Events/Disconnect.cs index de3dd8c8..ab181cb4 100644 --- a/ReallifeGamemode.Server/Events/Disconnect.cs +++ b/ReallifeGamemode.Server/Events/Disconnect.cs @@ -30,6 +30,13 @@ namespace ReallifeGamemode.Server.Events public void OnPlayerDisconnected(Player player, DisconnectionType type, string reason) { if (!player.IsLoggedIn()) return; + using var saveUser = new DatabaseContext(); + User user = player.GetUser(saveUser); + + if(user == null) + { + return; + } if (type == DisconnectionType.Left) { @@ -49,7 +56,7 @@ namespace ReallifeGamemode.Server.Events GlobalHelper.DutyAdmins.Remove(player); }*/ - if (player.GetUser().IsAdmin(AdminLevel.MAPPING)) + if (user.IsAdmin(AdminLevel.MAPPING)) { ChatService.BroadcastAdmin("!{#FFFF00}*** " + player.Name + " hat den Server verlassen", AdminLevel.MAPPING); } @@ -74,8 +81,8 @@ namespace ReallifeGamemode.Server.Events { Report.Report.listReports.Remove(temp); - Player user = PlayerService.GetPlayerByNameOrId(temp.getUser()); - user.SendChatMessage("!{#008fff}[REPORT]!{#FFFFFF} Chat beendet. Der Admin hat den Server verlassen"); + Player ticketUser = PlayerService.GetPlayerByNameOrId(temp.getUser()); + ticketUser.SendChatMessage("!{#008fff}[REPORT]!{#FFFFFF} Chat beendet. Der Admin hat den Server verlassen"); break; } @@ -124,27 +131,23 @@ namespace ReallifeGamemode.Server.Events } } - using (var saveUser = new DatabaseContext()) + Vector3 pos = player.Position; + + user.PositionX = pos.X; + user.PositionY = pos.Y; + user.PositionZ = pos.Z; + saveUser.SaveChanges(); + user.Dead = player.HasData("isDead") ? (bool)player.GetData("isDead") : false; + + if (user.Wanteds > 0) { - var user = player.GetUser(saveUser); - Vector3 pos = player.Position; - - user.PositionX = pos.X; - user.PositionY = pos.Y; - user.PositionZ = pos.Z; - saveUser.SaveChanges(); - user.Dead = player.HasData("isDead") ? (bool)player.GetData("isDead") : false; - - if (user.Wanteds > 0) - { - ChatService.HQMessage("Der Straftäter " + player.GetUser().Name + " ist vom Radar verschwunden"); - } - + ChatService.HQMessage("Der Straftäter " + user.Name + " ist vom Radar verschwunden"); } + player.SetData("isLoggedIn", false); player.TriggerEvent("CLIENT:DestroyPed", 1); player.TriggerEvent("CLIENT:DestroyPed", 2); - player.TriggerEvent("CLIENT:DestroyPed", 3); + player.TriggerEvent("CLIENT:DestroyPed", 3); player.TriggerEvent("CLIENT:DestroyPed", 4); Medic.delHealTask(player); diff --git a/ReallifeGamemode.Server/Extensions/ClientExtension.cs b/ReallifeGamemode.Server/Extensions/ClientExtension.cs index 38d79ada..9c354a51 100644 --- a/ReallifeGamemode.Server/Extensions/ClientExtension.cs +++ b/ReallifeGamemode.Server/Extensions/ClientExtension.cs @@ -31,8 +31,9 @@ namespace ReallifeGamemode.Server.Extensions /// public static User GetUser(this Player client, DatabaseContext context = null) { - context = context ?? new DatabaseContext(); if (!client.IsLoggedIn()) return null; + + context = context ?? new DatabaseContext(); return context .Users .Include(u => u.Faction) From fbbc61a523d90d94f57e0b08682360c7da24b5c7 Mon Sep 17 00:00:00 2001 From: hydrant Date: Sun, 11 Apr 2021 22:39:24 +0200 Subject: [PATCH 4/9] [HOTFIX] Set Spawn dimension --- ReallifeGamemode.Server/Events/Connect.cs | 1 + ReallifeGamemode.Server/Events/Login.cs | 2 ++ 2 files changed, 3 insertions(+) diff --git a/ReallifeGamemode.Server/Events/Connect.cs b/ReallifeGamemode.Server/Events/Connect.cs index 7852a425..9a235a20 100644 --- a/ReallifeGamemode.Server/Events/Connect.cs +++ b/ReallifeGamemode.Server/Events/Connect.cs @@ -27,6 +27,7 @@ namespace ReallifeGamemode.Server.Events //player.SetSharedData("vehicleAdminSpeed2", 1.0); player.SetData("isLoggedIn", false); player.SafeTeleport(new Vector3(-1883.736, -781.4911, -10)); + player.Dimension = (uint)(player.Handle.Value + 1); bool registered = false; diff --git a/ReallifeGamemode.Server/Events/Login.cs b/ReallifeGamemode.Server/Events/Login.cs index 0d46c49c..2966c9d0 100644 --- a/ReallifeGamemode.Server/Events/Login.cs +++ b/ReallifeGamemode.Server/Events/Login.cs @@ -144,6 +144,8 @@ namespace ReallifeGamemode.Server.Events { Jail.Check_PutBehindBars(user); } + + player.Dimension = 0; } player.TriggerEvent("draw", player.Name, player.Handle.Value); From 1943c703c2e5fdd731eb5398ed56db20d442ff5d Mon Sep 17 00:00:00 2001 From: hydrant Date: Sun, 11 Apr 2021 22:39:40 +0200 Subject: [PATCH 5/9] [HOTFIX] Add stungun, remove some unreliable messages[HOTFIX] Add stungun to anticheat --- ReallifeGamemode.Client/admin/anticheat.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ReallifeGamemode.Client/admin/anticheat.ts b/ReallifeGamemode.Client/admin/anticheat.ts index 078a8b86..051cfced 100644 --- a/ReallifeGamemode.Client/admin/anticheat.ts +++ b/ReallifeGamemode.Client/admin/anticheat.ts @@ -23,7 +23,8 @@ -2084633992, -1075685676, -1786099057, - -1074790547 + -1074790547, + -1569615261 ] mp.events.add("playerJoin", () => { @@ -189,12 +190,12 @@ let Difference = Behaviour.subtractVector(Behaviour.pos, mp.players.local.position) if (Math.abs(Difference.x) > 30 || Math.abs(Difference.y) > 30) { if (Behaviour.isWalking()) { - mp.events.callRemote("CLIENT:CheatDetection", "Flyhack/Teleport") + //mp.events.callRemote("CLIENT:CheatDetection", "Flyhack/Teleport") } } if (mp.players.local.vehicle) { if (Behaviour.checkCarPos(25)) { - mp.events.callRemote("CLIENT:CheatDetection", "Vehicle Flyhack") + //mp.events.callRemote("CLIENT:CheatDetection", "Vehicle Flyhack") } if (Behaviour.VehicleFasterThan(250)) { mp.events.callRemote("CLIENT:CheatDetection", "Vehicle Speedhack") From b12619b2a2c35ac92b9fb20b4a252013735867d6 Mon Sep 17 00:00:00 2001 From: hydrant Date: Sun, 11 Apr 2021 22:49:43 +0200 Subject: [PATCH 6/9] [HOTFIX] remove unallowed weapon debug message --- ReallifeGamemode.Client/admin/anticheat.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/ReallifeGamemode.Client/admin/anticheat.ts b/ReallifeGamemode.Client/admin/anticheat.ts index 051cfced..0eaf4fed 100644 --- a/ReallifeGamemode.Client/admin/anticheat.ts +++ b/ReallifeGamemode.Client/admin/anticheat.ts @@ -153,7 +153,6 @@ checkWeaponhash() { let h = this.weapon; if (allowedWeaponHashes.indexOf(h) === -1) { - mp.gui.chat.push("unallowed weapon: " + h); return true } return false From f103c2e3e28b67f186290d1a41f83cabe3751d3a Mon Sep 17 00:00:00 2001 From: hydrant Date: Sun, 11 Apr 2021 23:13:29 +0200 Subject: [PATCH 7/9] [HOTFIX] WT for all when started, not loaded --- ReallifeGamemode.Server/WeaponDeal/WeaponDealManager.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ReallifeGamemode.Server/WeaponDeal/WeaponDealManager.cs b/ReallifeGamemode.Server/WeaponDeal/WeaponDealManager.cs index 096e59de..e2aa0781 100644 --- a/ReallifeGamemode.Server/WeaponDeal/WeaponDealManager.cs +++ b/ReallifeGamemode.Server/WeaponDeal/WeaponDealManager.cs @@ -18,7 +18,15 @@ namespace ReallifeGamemode.Server.WeaponDeal public static bool checkWeaponDbyVehicle(Vehicle vehicle) { if (!vehicle.HasData("WeaponDealLoad") || vehicle.GetData("WeaponDealLoad") == false) + { return false; + } + + + if(!vehicle.HasData("weaponDeal") || vehicle.GetData("weapionDeal") == false) + { + return false; + } return true; } From cab9e6c0a98e492af3e68d43578e1db30b47d740 Mon Sep 17 00:00:00 2001 From: hydrant Date: Sun, 11 Apr 2021 23:13:41 +0200 Subject: [PATCH 8/9] [HOTFIX] showtickets alias /st --- ReallifeGamemode.Server/Report/Report.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReallifeGamemode.Server/Report/Report.cs b/ReallifeGamemode.Server/Report/Report.cs index 7d42f5ea..3c0ba2c7 100644 --- a/ReallifeGamemode.Server/Report/Report.cs +++ b/ReallifeGamemode.Server/Report/Report.cs @@ -24,7 +24,7 @@ namespace ReallifeGamemode.Server.Report //ChatService.BroadcastAdmin("Eingehendes Ticket von " + client.Name + ": " + message + " (Benutze /showtickets)", AdminLevel.ADMIN); } - [Command("showtickets", "~m~Benutzung: ~s~/showtickets")] + [Command("showtickets", "~m~Benutzung: ~s~/showtickets", Alias = "st")] public void CmdAdminShowtickets(Player client) { if (!client.GetUser()?.IsAdmin(AdminLevel.SUPPORTER) ?? true) From 1c32b38487364c89554ec8b2d52f4b823effeb5c Mon Sep 17 00:00:00 2001 From: hydrant Date: Sun, 11 Apr 2021 23:51:20 +0200 Subject: [PATCH 9/9] [HOTFIX] Warn meldungen nicht mehr an alle --- ReallifeGamemode.Server/Commands/AdminCommands.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ReallifeGamemode.Server/Commands/AdminCommands.cs b/ReallifeGamemode.Server/Commands/AdminCommands.cs index fb46010a..d9606545 100644 --- a/ReallifeGamemode.Server/Commands/AdminCommands.cs +++ b/ReallifeGamemode.Server/Commands/AdminCommands.cs @@ -841,13 +841,13 @@ namespace ReallifeGamemode.Server.Commands dbContext.SaveChanges(); if (userwarn.warn >= 3) { - ChatService.Broadcast("~y~INFO: Das war der 3. Warn - bitte bannen!"); + ChatService.BroadcastAdmin("~y~INFO: Das war der 3. Warn - bitte bannen!", AdminLevel.ADMIN); } } ChatService.SendMessage(target, "~r~WARNINFO: ~w~Du wurdest von " + adminPlayername + " verwarnt: " + reason); - ChatService.Broadcast("~y~INFO: ~w~" + targetPlayername + " wurde von " + player.GetUser().AdminLevel.GetName() + " " + adminPlayername + " verwarnt: " + reason); + ChatService.BroadcastAdmin("~y~INFO: ~w~" + targetPlayername + " wurde von " + player.GetUser().AdminLevel.GetName() + " " + adminPlayername + " verwarnt: " + reason, AdminLevel.ADMIN); } [Command("ip", "~m~Benutzung: ~s~/ip [Spieler]")]