setWeaponClipAmmo | Multi Theft Auto: Wiki Skip to content

setWeaponClipAmmo

Client-side
Server-side
Shared

Pair: getWeaponClipAmmo

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


This function sets the ammo left in a custom weapon's magazine/clip.

Syntax

setWeaponClipAmmo ( )

Code Examples

client

This example adds a/weaponcommand that creates a M4 where the player uses it, and gives 1 clip ammo to it.

function createWeaponWithLowClipAmmo()
local wep = createWeapon("m4", getElementPosition(localPlayer))
setWeaponClipAmmo(wep, 1) -- Give the weapon 1 clip ammo, so it will reload at the next shoot.
end
addCommandHandler("weapon", createWeaponWithLowClipAmmo)

See Also