fix unknown weapon names (mk 2 weapons)
This commit is contained in:
119
ReallifeGamemode.Server/Managers/WeaponManager.cs
Normal file
119
ReallifeGamemode.Server/Managers/WeaponManager.cs
Normal file
@@ -0,0 +1,119 @@
|
||||
using GTANetworkAPI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace ReallifeGamemode.Server.Managers
|
||||
{
|
||||
class WeaponManager
|
||||
{
|
||||
private static readonly List<string> _modWeapons = new List<string>()
|
||||
{
|
||||
"dagger",
|
||||
"bat",
|
||||
"bottle",
|
||||
"crowbar",
|
||||
"flashlight",
|
||||
"golfclub",
|
||||
"hammer",
|
||||
"hatchet",
|
||||
"knuckle",
|
||||
"knife",
|
||||
"machete",
|
||||
"switchblade",
|
||||
"nightstick",
|
||||
"wrench",
|
||||
"battleaxe",
|
||||
"poolcue",
|
||||
"stone_hatchet",
|
||||
"pistol",
|
||||
"pistol_mk2",
|
||||
"combatpistol",
|
||||
"appistol",
|
||||
"stungun",
|
||||
"pistol50",
|
||||
"snspistol",
|
||||
"snspistol_mk2",
|
||||
"heavypistol",
|
||||
"vintagepistol",
|
||||
"flaregun",
|
||||
"marksmanpistol",
|
||||
"revolver",
|
||||
"revolver_mk2",
|
||||
"doubleaction",
|
||||
"raypistol",
|
||||
"microsmg",
|
||||
"smg",
|
||||
"smg_mk2",
|
||||
"assaultsmg",
|
||||
"combatpdw",
|
||||
"machinepistol",
|
||||
"raycarbine",
|
||||
"pumpshotgun",
|
||||
"pumpshotgun_mk2",
|
||||
"sawnoffshotgun",
|
||||
"assaultshotgun",
|
||||
"bullpupshotgun",
|
||||
"musket",
|
||||
"heavyshotgun",
|
||||
"dbshotgun",
|
||||
"autoshotgun",
|
||||
"assaultrifle",
|
||||
"assaultrifle_mk2",
|
||||
"carbinerifle",
|
||||
"carbinerifle_mk2",
|
||||
"advancedrifle",
|
||||
"specialcarbine",
|
||||
"specialcarbine_mk2",
|
||||
"bullpuprifle",
|
||||
"bullpuprifle_mk2",
|
||||
"compactrifle",
|
||||
"mg",
|
||||
"combatmg",
|
||||
"combatmg_mk2",
|
||||
"gusenberg",
|
||||
"sniperrifle",
|
||||
"heavysniper",
|
||||
"heavysniper_mk2",
|
||||
"marksmanrifle",
|
||||
"marksmanrifle_mk2",
|
||||
"rpg",
|
||||
"grenadelauncher",
|
||||
"grenadelauncher_smoke",
|
||||
"minigun",
|
||||
"firework",
|
||||
"railgun",
|
||||
"hominglauncher",
|
||||
"compactlauncher",
|
||||
"rayminigun",
|
||||
"grenade",
|
||||
"bzgas",
|
||||
"molotov",
|
||||
"stickybomb",
|
||||
"proxmine",
|
||||
"snowball",
|
||||
"pipebomb",
|
||||
"ball",
|
||||
"smokegrenade",
|
||||
"flare",
|
||||
"petrolcan",
|
||||
"parachute",
|
||||
"fireextinguisher"
|
||||
};
|
||||
|
||||
public static bool IsValidHash(uint hash)
|
||||
{
|
||||
foreach (WeaponHash vh in Enum.GetValues(typeof(WeaponHash)))
|
||||
{
|
||||
if ((uint)vh == hash) return true;
|
||||
}
|
||||
|
||||
foreach (string mod in _modWeapons)
|
||||
{
|
||||
if (NAPI.Util.GetHashKey($"weapon_{mod}") == hash) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user