function hash to weaponname
This commit is contained in:
@@ -103,6 +103,11 @@ namespace ReallifeGamemode.Server.Managers
|
||||
"fireextinguisher"
|
||||
};
|
||||
|
||||
public static Dictionary<string, string> WeaponHashDictionary = new Dictionary<string, string>
|
||||
{
|
||||
{ "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<string, string>.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user