ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. getPedAmmoInClip

Function

getPedAmmoInClip

Server and clientPedsIdentical to MTA:SA

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