- Documentation
- Shared functions
- getPedAmmoInClip
Function
getPedAmmoInClip
Returns the number of rounds in the weapon's current clip, i.e. how many shots are left before reloading. Without a slot it refers to the weapon in hand; with a slot, to the weapon in that inventory slot. On the client it always refers to the weapon in hand.
Syntax
int getPedAmmoInClip(ped ped [, int slot = nil])Arguments
pedped- A player or an NPC.
slotint, optional = nil- Slot 0-12. Omitted = the weapon in hand. Ignored on the client.
Returns
Rounds in the clip (0 when the weapon has no clip).
Example
addEventHandler("onClientRender", root, function()
dxDrawText("Magazynek: " .. getPedAmmoInClip(localPlayer), 20, 400)
end)
See also
getPedTotalAmmoReturns all ammo for a weapon (clip plus reserve). Without a slot it refers to the weapon in hand; with a slot, to the weapon in that inventory slot. On the client it always refers to the weapon in hand.reloadPedWeaponMakes a ped reload the weapon it is holding, as if the reload key was pressed. On the server the order goes to the player's game; for an NPC it is stored as a reload request. On the client it only works for the local player.