Table of Contents

Class PlayerWeaponSlots

Namespace
SampSharp.Entities.SAMP
Assembly
SampSharp.OpenMp.Entities.dll

Represents a collection of weapon slots for a player spawn class.

public class PlayerWeaponSlots : IEnumerable<PlayerWeaponSlot>, IEnumerable
Inheritance
PlayerWeaponSlots
Implements
Inherited Members

Constructors

PlayerWeaponSlots()

Initializes a new instance of the PlayerWeaponSlots class with empty weapon slots.

public PlayerWeaponSlots()

PlayerWeaponSlots(WeaponSlotData[])

Initializes a new instance of the PlayerWeaponSlots class with the specified weapon slot data.

public PlayerWeaponSlots(WeaponSlotData[] data)

Parameters

data WeaponSlotData[]

The weapon slot data array.

Exceptions

ArgumentException

Thrown when the data array length does not match the maximum weapon slot count.

Properties

this[int]

Gets the weapon slot at the specified index. Use Add(PlayerWeaponSlot), Reset(WeaponSlot), or Remove(Weapon) to modify slots.

public PlayerWeaponSlot this[int slot] { get; }

Parameters

slot int

The zero-based index of the weapon slot.

Property Value

PlayerWeaponSlot

A PlayerWeaponSlot containing the weapon and ammo information.

Exceptions

ArgumentOutOfRangeException

Thrown when the slot index is less than 0 or greater than or equal to the maximum weapon slot count.

Methods

Add(PlayerWeaponSlot)

Adds a weapon slot to this collection.

public void Add(PlayerWeaponSlot item)

Parameters

item PlayerWeaponSlot

The item to add.

GetEnumerator()

public IEnumerator<PlayerWeaponSlot> GetEnumerator()

Returns

IEnumerator<PlayerWeaponSlot>

Remove(PlayerWeaponSlot)

Removes the weapon from its associated slot.

public bool Remove(PlayerWeaponSlot item)

Parameters

item PlayerWeaponSlot

The item whose weapon slot should be removed.

Returns

bool

true if the associated slot was non-empty; otherwise, false.

Remove(Weapon)

Removes the weapon from its associated slot.

public bool Remove(Weapon weapon)

Parameters

weapon Weapon

The weapon to remove.

Returns

bool

true if the associated slot was non-empty; otherwise, false.

Reset(WeaponSlot)

Resets the specified weapon slot.

public void Reset(WeaponSlot weaponSlot)

Parameters

weaponSlot WeaponSlot

The weapon slot to reset.

ToOmpData()

Converts this weapon slots collection to open.mp weapon slots data.

public WeaponSlots ToOmpData()

Returns

WeaponSlots

A WeaponSlots instance containing the open.mp representation of the weapon slots.