diff --git a/ReallifeGamemode.Server/Events/Death.cs b/ReallifeGamemode.Server/Events/Death.cs index 04983d00..c139df91 100644 --- a/ReallifeGamemode.Server/Events/Death.cs +++ b/ReallifeGamemode.Server/Events/Death.cs @@ -57,7 +57,10 @@ namespace ReallifeGamemode.Server.Events if (player != killer) { Autowanted.Check_AutoWanted(killer, player); - string message = "~y~[HINWEIS]: " + killer.Name + " hat " + player.Name + " getötet (" + NAPI.Player.GetPlayerCurrentWeapon(killer) + ")"; + //string message = "~y~[HINWEIS]: " + killer.Name + " hat " + player.Name + " getötet (" + NAPI.Player.GetPlayerCurrentWeapon(killer) + ")"; + string weaponHash = NAPI.Player.GetPlayerCurrentWeapon(killer).ToString(); + ChatService.Broadcast("test: " + weaponHash); + string message = "~y~[HINWEIS]: " + killer.Name + " hat " + player.Name + " getötet (" + Managers.WeaponManager.GetWeaponNameByHash(weaponHash) + ")"; ChatService.BroadcastAdmin(message, AdminLevel.ADMIN); } } diff --git a/ReallifeGamemode.Server/Managers/WeaponManager.cs b/ReallifeGamemode.Server/Managers/WeaponManager.cs index a61e00c5..e441d830 100644 --- a/ReallifeGamemode.Server/Managers/WeaponManager.cs +++ b/ReallifeGamemode.Server/Managers/WeaponManager.cs @@ -103,6 +103,11 @@ namespace ReallifeGamemode.Server.Managers "fireextinguisher" }; + public static Dictionary WeaponHashDictionary = new Dictionary + { + { "2441047180", "NavyRevolver" } + }; + public static bool IsValidHash(uint hash) { foreach (WeaponHash vh in Enum.GetValues(typeof(WeaponHash))) @@ -110,12 +115,29 @@ namespace ReallifeGamemode.Server.Managers if ((uint)vh == hash) return true; } + /* foreach (string mod in _modWeapons) { if (NAPI.Util.GetHashKey($"weapon_{mod}") == hash) return true; } + */ + + Dictionary.ValueCollection values = WeaponHashDictionary.Values; + foreach (string mod in values) + { + if (NAPI.Util.GetHashKey($"weapon_{mod}") == hash) return true; + } return false; } + + public static String GetWeaponNameByHash(String hash) + { + if (WeaponHashDictionary.ContainsKey(hash)) + { + return WeaponHashDictionary[hash]; + } + return null; + } } }