Table of Contents

Struct WeaponInfo

Namespace
SampSharp.OpenMp.Core.Api
Assembly
SampSharp.OpenMp.Core.dll

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

type PlayerWeaponType
slot int
range float
clipSize int
shootTime int
reloadTime int

Properties

ClipSize

Magazine capacity. 0 if not applicable.

public int ClipSize { get; }

Property Value

int

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

IReadOnlyList<WeaponInfo>

Range

Effective range, in game units.

public float Range { get; }

Property Value

float

ReloadTime

Reload time in milliseconds. 0 if the weapon doesn't reload.

public int ReloadTime { get; }

Property Value

int

ShootTime

Time between shots, in milliseconds.

public int ShootTime { get; }

Property Value

int

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

int

Type

The weapon's category (melee, bullet, rocket, etc.).

public PlayerWeaponType Type { get; }

Property Value

PlayerWeaponType

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

weapon PlayerWeapon

Returns

WeaponInfo

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

weapon byte

Returns

WeaponInfo