Struct WeaponInfo
Static metadata for a single weapon ID: its category, slot, effective range,
clip size, shoot time and reload time. Mirrors the open.mp SDK WeaponInfo struct.
public readonly struct WeaponInfo
- Inherited Members
Remarks
Values are pulled verbatim from WeaponInfoList in open.mp-sdk/include/player.hpp.
They are GTA: San Andreas constants and don't change at runtime, so the table
is mirrored here as managed data — there is no native lookup.
Constructors
WeaponInfo(PlayerWeaponType, int, float, int, int, int)
Initializes a new instance of the WeaponInfo struct.
public WeaponInfo(PlayerWeaponType type, int slot, float range, int clipSize, int shootTime, int reloadTime)
Parameters
Properties
ClipSize
Magazine capacity. 0 if not applicable.
public int ClipSize { get; }
Property Value
List
The static table of weapon information indexed by weapon ID, with one entry per ID from 0 to MAX_WEAPON_ID - 1.
public static IReadOnlyList<WeaponInfo> List { get; }
Property Value
Range
Effective range, in game units.
public float Range { get; }
Property Value
ReloadTime
Reload time in milliseconds. 0 if the weapon doesn't reload.
public int ReloadTime { get; }
Property Value
ShootTime
Time between shots, in milliseconds.
public int ShootTime { get; }
Property Value
Slot
The weapon's slot (0-12). -1 for IDs that don't map to a real weapon
(matches the SDK's INVALID_WEAPON_SLOT sentinel).
public int Slot { get; }
Property Value
Type
The weapon's category (melee, bullet, rocket, etc.).
public PlayerWeaponType Type { get; }
Property Value
Methods
Get(PlayerWeapon)
Looks up information for the given weapon ID. Returns a sentinel
(None with slot -1) for IDs out of range.
public static WeaponInfo Get(PlayerWeapon weapon)
Parameters
weaponPlayerWeapon
Returns
Get(byte)
Looks up information for the given weapon ID. Returns a sentinel
(None with slot -1) for IDs out of range.
public static WeaponInfo Get(byte weapon)
Parameters
weaponbyte