Class PlayerWeaponSlots
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
dataWeaponSlotData[]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
slotintThe 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
itemPlayerWeaponSlotThe item to add.
GetEnumerator()
public IEnumerator<PlayerWeaponSlot> GetEnumerator()
Returns
Remove(PlayerWeaponSlot)
Removes the weapon from its associated slot.
public bool Remove(PlayerWeaponSlot item)
Parameters
itemPlayerWeaponSlotThe item whose weapon slot should be removed.
Returns
Remove(Weapon)
Removes the weapon from its associated slot.
public bool Remove(Weapon weapon)
Parameters
weaponWeaponThe weapon to remove.
Returns
Reset(WeaponSlot)
Resets the specified weapon slot.
public void Reset(WeaponSlot weaponSlot)
Parameters
weaponSlotWeaponSlotThe 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.