> For the complete documentation index, see [llms.txt](https://sneakyevil.gitbook.io/sleeping-dogs-de-script-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sneakyevil.gitbook.io/sleeping-dogs-de-script-api/game-classes/simweapon.md).

# SimWeapon

General game-weapon, properties & functions are derived from SimObject.

### Properties:

<table><thead><tr><th>Name</th><th width="183.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td>ClipAmmo</td><td>integer</td><td>Current loaded ammo</td></tr><tr><td>TotalAmmo</td><td>integer</td><td>Current total ammo</td></tr><tr><td>LastFiredTime</td><td>float (Read Only)</td><td>based on <a href="/sleeping-dogs-de-script-api/game-classes/metrics.md">Metrics.SimTime</a></td></tr><tr><td>RateOfFireOverride</td><td>float</td><td>-1.0 - disabled</td></tr></tbody></table>

### Static Functions:

#### .Create

`SimWeapon.Create(model: Hash, coords: Vector3, rotation: Vector3)`: SimWeapon

| Argument | Type    | Description                                                                          |
| -------- | ------- | ------------------------------------------------------------------------------------ |
| model    | Hash    | [More info](https://github.com/SDmodding/Script-Mod/blob/main/Info/WeaponModels.txt) |
| coords   | Vector3 | Position of new Weapon                                                               |
| rotation | Vector3 | Rotation of new Weapon                                                               |

Returns SimWeapon object when successfully created.

#### .CreateAndEquip

`SimWeapon.CreateAndEquip(character: SimCharacter, model: Hash)`: SimWeapon

| Argument  | Type         | Description                                                                          |
| --------- | ------------ | ------------------------------------------------------------------------------------ |
| character | SimCharacter | Valid Character Object                                                               |
| model     | Hash         | [More info](https://github.com/SDmodding/Script-Mod/blob/main/Info/WeaponModels.txt) |

Returns SimWeapon object when successfully created and equipped. Note: Any current equipped weapon will be destroyed!

#### .CreateAndEquipStowed

`SimWeapon.CreateAndEquipStowed(character: SimCharacter, model: Hash)`: SimWeapon

| Argument  | Type                                                                      | Description                                                                          |
| --------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ |
| character | [SimCharacter](/sleeping-dogs-de-script-api/game-classes/simcharacter.md) | Valid Character Object                                                               |
| model     | Hash                                                                      | [More info](https://github.com/SDmodding/Script-Mod/blob/main/Info/WeaponModels.txt) |

Returns SimWeapon object when successfully created and equipped. Note: Any current stowed weapon will be destroyed!

#### .Get

`SimWeapon.Get(object: SimObject)`: SimWeapon

| Argument | Type      | Description     |
| -------- | --------- | --------------- |
| object   | SimObject | Valid SimObject |

This will cast SimObject to SimWeapon use this only if you know what you're doing!

#### .GetEquipped

`SimWeapon.GetEquipped(character: SimCharacter)`: SimWeapon

| Argument  | Type                                                                      | Description            |
| --------- | ------------------------------------------------------------------------- | ---------------------- |
| character | [SimCharacter](/sleeping-dogs-de-script-api/game-classes/simcharacter.md) | Valid Character Object |

Returns SimWeapon object if there is any equipped weapon on character otherwise null.

#### .GetStowed

`SimWeapon.GetStowed(character: SimCharacter)`: SimWeapon

| Argument  | Type                                                                      | Description            |
| --------- | ------------------------------------------------------------------------- | ---------------------- |
| character | [SimCharacter](/sleeping-dogs-de-script-api/game-classes/simcharacter.md) | Valid Character Object |

Returns SimWeapon object if there is any stowed weapon on character otherwise null.

### Functions:

#### .IsStowable

`SimWeapon.IsStowable()`: boolean

Returns true if weapon can be stowed.

#### .Equip

`SimWeapon.Equip(character: SimCharacter)`: boolean

| Argument  | Type                                                                      | Description            |
| --------- | ------------------------------------------------------------------------- | ---------------------- |
| character | [SimCharacter](/sleeping-dogs-de-script-api/game-classes/simcharacter.md) | Valid Character Object |

Returns true if weapon was successfully equipped. Note: Any current equipped weapon will be destroyed!
