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

Function

getPedTotalAmmo

Server and clientPedsIdentical to MTA:SA

Returns 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.

Syntax

int getPedTotalAmmo(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

Total number of rounds.

Example

addCommandHandler("amunicja", function(player)
    outputChatBox("Naboje: " .. getPedTotalAmmo(player), player)
end)

See also