From 1ddb5164ff145f4197826ad874ddee873d9194e3 Mon Sep 17 00:00:00 2001 From: hydrant Date: Tue, 13 Apr 2021 22:39:28 +0200 Subject: [PATCH 1/4] fix gangwar geld --- ReallifeGamemode.Server/Gangwar/Turf.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReallifeGamemode.Server/Gangwar/Turf.cs b/ReallifeGamemode.Server/Gangwar/Turf.cs index 825fe065..dfd08df8 100644 --- a/ReallifeGamemode.Server/Gangwar/Turf.cs +++ b/ReallifeGamemode.Server/Gangwar/Turf.cs @@ -247,7 +247,7 @@ namespace ReallifeGamemode.Server.Gangwar Player[] attackers = NAPI.Pools.GetAllPlayers().Where(c => c.IsLoggedIn() && c.GetUser().Faction?.Name == this.Attacker).ToArray(); Faction ownerFaction = dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Name == getOwner()).FirstOrDefault(); - Faction attackerFaction = dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Name == getOwner()).FirstOrDefault(); + Faction attackerFaction = dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Name == getAttacker()).FirstOrDefault(); if (ownerFaction == null || attackerFaction == null) { From ecca103970f58525fe9375406add8122578d4922 Mon Sep 17 00:00:00 2001 From: hydrant Date: Thu, 15 Apr 2021 00:15:51 +0200 Subject: [PATCH 2/4] [HOTFIX] fix medic heal task server crash --- ReallifeGamemode.Server/Events/Death.cs | 3 ++- ReallifeGamemode.Server/Factions/Medic/Medic.cs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ReallifeGamemode.Server/Events/Death.cs b/ReallifeGamemode.Server/Events/Death.cs index c810c4ff..afcd7ad6 100644 --- a/ReallifeGamemode.Server/Events/Death.cs +++ b/ReallifeGamemode.Server/Events/Death.cs @@ -94,6 +94,8 @@ namespace ReallifeGamemode.Server.Events } } + Medic.delHealTask(player); + if (user.JailTime <= 0) { user.Dead = true; @@ -113,7 +115,6 @@ namespace ReallifeGamemode.Server.Events MedicName = "none" }; Medic.AddTaskToList(reviveTask); - Medic.delHealTask(player); ChatService.BroadcastFaction("~y~[MEDIC] ~w~" + player.Name + " ist soeben verstorben.", new List() { 2 }); } diff --git a/ReallifeGamemode.Server/Factions/Medic/Medic.cs b/ReallifeGamemode.Server/Factions/Medic/Medic.cs index 7bb2fd2d..f5c27650 100644 --- a/ReallifeGamemode.Server/Factions/Medic/Medic.cs +++ b/ReallifeGamemode.Server/Factions/Medic/Medic.cs @@ -263,7 +263,7 @@ namespace ReallifeGamemode.Server.Factions.Medic { player.SetData("healauftrag", false); var medicPlayer = PlayerService.GetPlayerByNameOrId(task.MedicName); - if (task.MedicName != "none") + if (medicPlayer != null) { medicPlayer.TriggerEvent("destroyMedicTaskCheckpoint"); } From 55e324f3223e51fad787866bacd06f07d30bf817 Mon Sep 17 00:00:00 2001 From: hydrant Date: Thu, 15 Apr 2021 01:29:49 +0200 Subject: [PATCH 3/4] =?UTF-8?q?[HOTFIX]=20punkte=20vergeben=20aufger=C3=A4?= =?UTF-8?q?umt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Managers/InteractionManager.cs | 125 ++++++++---------- 1 file changed, 58 insertions(+), 67 deletions(-) diff --git a/ReallifeGamemode.Server/Managers/InteractionManager.cs b/ReallifeGamemode.Server/Managers/InteractionManager.cs index b8012632..fc2af555 100644 --- a/ReallifeGamemode.Server/Managers/InteractionManager.cs +++ b/ReallifeGamemode.Server/Managers/InteractionManager.cs @@ -486,7 +486,7 @@ namespace ReallifeGamemode.Server.Managers using var dbContext = new DatabaseContext(); var user = player.GetUser(dbContext); - if(user.FactionId == null) + if (user.FactionId == null) { return; } @@ -517,7 +517,7 @@ namespace ReallifeGamemode.Server.Managers } var factionVehicleCount = dbContext.FactionVehicles.ToList().Where(v => v.Id == id && v.GetOwners().Contains(user.FactionId.Value)).Count(); - if(factionVehicleCount <= 6) + if (factionVehicleCount <= 6) { ChatService.ErrorMessage(player, "Die Fraktion braucht mindestens 6 Fahrzeuge"); return; @@ -589,85 +589,76 @@ namespace ReallifeGamemode.Server.Managers public void InteractionMenu_LSPD_Points3(Player player, string jsonNameOrId, string jsoAmount, string jsonReason) { string nameOrId = (string)JsonConvert.DeserializeObject(jsonNameOrId); - int amount = Int32.Parse((string)JsonConvert.DeserializeObject(jsoAmount)); string reason = (string)JsonConvert.DeserializeObject(jsonReason); Player target = PlayerService.GetPlayerByNameOrId(nameOrId); string playername = NAPI.Player.GetPlayerName(player); string targetname = NAPI.Player.GetPlayerName(target); + + if (!int.TryParse((string)JsonConvert.DeserializeObject(jsoAmount), out int amount)) + { + player.SendNotification("~r~Es muss eine gültige Zahl für die Punkte angegeben werden!"); + return; + } + if (target == null || !target.IsLoggedIn()) { ChatService.PlayerNotFound(player); return; } - else if (target.GetUser().DriverLicenseVehicle == false && target.GetUser().DriverLicenseBike == false) - { - player.SendNotification("~r~Spieler hat weder Auto- noch Motorradführerschein!"); - } - else if (target == player) + + if (target == player) { player.SendNotification("~r~Du kannst dir selbst keine Punkte setzen!"); + return; + } + + using var dbContext = new DatabaseContext(); + User targetUser = target.GetUser(dbContext); + + if(targetUser == null) + { + ChatService.PlayerNotFound(player); + return; + } + + if (targetUser.DriverLicenseVehicle == false && targetUser.DriverLicenseBike == false) + { + player.SendNotification("~r~Spieler hat weder Auto- noch Motorradführerschein!"); + return; + } + + if (amount < -13 || amount > 13) + { + player.SendNotification("~r~Du kannst nur zwischen 1 und 12 Punkte verteilen!"); + return; + } + + targetUser.Points += amount; + + player.SendNotification($"~w~Du hast ~y~{targetname} ~b~{amount} ~w~Strafpunkte gegeben. Grund: ~g~{reason}~w~."); + target.SendNotification($"~b~{player.GetUser().FactionRank.RankName} | {playername} ~w~hat dir ~y~{amount} ~w~Strafpunkte gegeben.", true); + ChatService.HQMessage(targetname + " hat von " + playername + " " + amount + " Strafpunkt(e) erhalten. Gesamt: " + targetUser.Points); + + if (targetUser.Points < 0) + { + targetUser.Points = 0; + dbContext.SaveChanges(); + } + else if (targetUser.Points >= 12) + { + target.SendNotification($"~w~Grund: ~g~{reason}~w~. ~x~Du hast nun ~r~12/12 ~x~Strafpunkten.", true); + target.SendNotification($"~w~Dir wird ~r~Auto- ~w~und ~r~Motorradführerschein ~w~entzogen.", true); //FlashNotif + + ChatService.HQMessage(targetname + " besitzt nun keinen Führerschein mehr."); + + targetUser.Points = 0; + targetUser.DriverLicenseVehicle = false; + targetUser.DriverLicenseBike = false; + dbContext.SaveChanges(); } else { - if (amount > -13 && amount < 13) - { - using (var dbContext = new DatabaseContext()) - { - User target2 = target.GetUser(dbContext); - target2.Points += amount; - dbContext.SaveChanges(); - } - player.SendNotification($"~w~Du hast ~y~{targetname} ~b~{amount} ~w~Strafpunkte gegeben. Grund: ~g~{reason}~w~."); - target.SendNotification($"~b~{player.GetUser().FactionRank.RankName} | {playername} ~w~hat dir ~y~{amount} ~w~Strafpunkte gegeben.", true); - ChatService.BroadcastFaction("!{#8181E9}HQ: " + targetname + " hat von " + playername + " " + amount + " Strafpunkt(e) erhalten. Gesamt: " + target.GetUser().Points, new List() { 1, 3 }); - if (target.GetUser().Points < 0) - { - using (var dbContext = new DatabaseContext()) - { - User target2 = target.GetUser(dbContext); - target2.Points = 0; - dbContext.SaveChanges(); - } - } - else if (target.GetUser().Points >= 12) - { - target.SendNotification($"~w~Grund: ~g~{reason}~w~. ~x~Du hast nun ~r~12/12 ~x~Strafpunkten.", true); - target.SendNotification($"~w~Dir wird ~r~Auto- ~w~und ~r~Motorradführerschein ~w~entzogen.", true); //FlashNotif - ChatService.HQMessage(targetname + "hat von" + playername + " " + amount + " Strafpunkt erhalten(e). Gesamt: " + target.GetUser().Points); - foreach (var copPlayer in NAPI.Pools.GetAllPlayers()) - { - User copUser = copPlayer.GetUser(); - if (copUser == null) - { - continue; - } - - if (copUser.FactionId == 1 || copUser.FactionId == 3) - { - if (copUser.GetData("duty") == true) - { - ChatService.HQMessage(targetname + " besitzt nun keinen Führerschein mehr."); - } - } - } - using (var dbContext = new DatabaseContext()) - { - User target2 = target.GetUser(dbContext); - target2.Points = 0; - target2.DriverLicenseVehicle = false; - target2.DriverLicenseBike = false; - dbContext.SaveChanges(); - } - } - else - { - target.SendNotification($"~w~Grund: ~g~{reason}~w~. ~x~Du hast nun ~y~{target.GetUser().Points}/12 ~x~Strafpunkten.", true); - } - } - else - { - player.SendNotification("~r~Du kannst nur zwischen 1 und 12 Punkte verteilen!"); - } + target.SendNotification($"~w~Grund: ~g~{reason}~w~. ~x~Du hast nun ~y~{targetUser.Points}/12 ~x~Strafpunkten.", true); } } From 86afa2bb9397e73ca94a014b7e645717715c30b2 Mon Sep 17 00:00:00 2001 From: hydrant Date: Thu, 15 Apr 2021 01:49:35 +0200 Subject: [PATCH 4/4] [HOTFIX] fix weapon in hup --- ReallifeGamemode.Client/util/animationSync.ts | 9 ++++++--- ReallifeGamemode.Server/Extensions/ClientExtension.cs | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ReallifeGamemode.Client/util/animationSync.ts b/ReallifeGamemode.Client/util/animationSync.ts index 169a070b..4601cb67 100644 --- a/ReallifeGamemode.Client/util/animationSync.ts +++ b/ReallifeGamemode.Client/util/animationSync.ts @@ -133,11 +133,14 @@ export default function animationSync() { mp.events.callRemote("CLIENT:ClearAnimationData", false); } + const blockInputControls = [12, 13, 14, 15, 22, 24, 25, 37, 261, 262]; + mp.events.add("render", () => { + mp.gui.chat.push("blockInput = " + blockInput); if (blockInput) { - mp.game.controls.disableControlAction(32, 25, true); - mp.game.controls.disableControlAction(32, 24, true); - mp.game.controls.disableControlAction(32, 22, true); + blockInputControls.forEach((ctrl) => { + mp.game.controls.disableControlAction(32, ctrl, true); + }); } }); diff --git a/ReallifeGamemode.Server/Extensions/ClientExtension.cs b/ReallifeGamemode.Server/Extensions/ClientExtension.cs index 9c354a51..b400682a 100644 --- a/ReallifeGamemode.Server/Extensions/ClientExtension.cs +++ b/ReallifeGamemode.Server/Extensions/ClientExtension.cs @@ -433,6 +433,7 @@ namespace ReallifeGamemode.Server.Extensions return; player.SyncAnimation("hup"); + NAPI.Player.SetPlayerCurrentWeapon(player, WeaponHash.Unarmed); if (player.GetUser().Wanteds > 0) PositionManager.cuffPoints.Add(player);