From aa31a9280e8492388223797c4721233916f9b984 Mon Sep 17 00:00:00 2001 From: Lukas Moungos Date: Fri, 13 Dec 2019 19:32:26 +0100 Subject: [PATCH] try fix --- ReallifeGamemode.Server/Events/Death.cs | 2 +- .../Managers/WeaponManager.cs | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/ReallifeGamemode.Server/Events/Death.cs b/ReallifeGamemode.Server/Events/Death.cs index 8970622b..b3f1e708 100644 --- a/ReallifeGamemode.Server/Events/Death.cs +++ b/ReallifeGamemode.Server/Events/Death.cs @@ -58,7 +58,7 @@ namespace ReallifeGamemode.Server.Events { Autowanted.Check_AutoWanted(killer, player); - string message = "~y~[HINWEIS]: " + killer.Name + " hat " + player.Name + " getötet (" + Managers.WeaponManager.GetWeaponNameByHash((uint)NAPI.Player.GetPlayerCurrentWeapon(killer)) + ")"; + string message = "~y~[HINWEIS]: " + killer.Name + " hat " + player.Name + " getötet (" + Managers.WeaponManager.GetWeaponNameByHash(NAPI.Player.GetPlayerCurrentWeapon(killer)) + ")"; ChatService.BroadcastAdmin(message, AdminLevel.ADMIN); } } diff --git a/ReallifeGamemode.Server/Managers/WeaponManager.cs b/ReallifeGamemode.Server/Managers/WeaponManager.cs index 3437b400..1f323a8e 100644 --- a/ReallifeGamemode.Server/Managers/WeaponManager.cs +++ b/ReallifeGamemode.Server/Managers/WeaponManager.cs @@ -121,16 +121,22 @@ namespace ReallifeGamemode.Server.Managers public static String GetWeaponNameByHash(uint hash) { - if (!IsValidHash(hash)) - return "unbekannt"; - - foreach (string w in _modWeapons) + foreach (WeaponHash vh in Enum.GetValues(typeof(WeaponHash))) { - if(NAPI.Util.GetHashKey(w) == hash) + if ((uint)vh == hash) { - return w; + foreach (string w in _modWeapons) + { + if (NAPI.Util.GetHashKey(w) == hash) + { + return w; + } + } } + } + + return "unbekannt"; } }