ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Server functions
  3. setWeaponAmmo

Function

setWeaponAmmo

ServerWeaponsIdentical to MTA:SA

Sets ammo. For a ped it sets the ammo of a given weapon; for a scripted weapon it sets its reserve.

Syntax

Ped

bool setWeaponAmmo(ped thePed, int weapon, int ammo [, int ammoInClip])

Scripted weapon

bool setWeaponAmmo(weapon theWeapon, int ammo)

Arguments

thePedped/weapon
A ped or a scripted weapon.
weaponint
Weapon ID (for a ped).
ammoint
Amount of ammo.
ammoInClipint, optional = nil
Rounds in the clip (for a ped).

Returns

true on success.

Example

setWeaponAmmo(player, 31, 500)
setWeaponAmmo(turret, 1000)

See also