getPedTotalAmmo | Multi Theft Auto: Wiki Skip to content

getPedTotalAmmo

Client-side
Server-side
Shared

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 returns an integer that contains the total ammo in a specified ped's weapon. See Weapon Info

Note

Clientside, this function will not return a correct value for remote player weapons that aren't in hand.

Syntax

getPedTotalAmmo ( )

Code Examples

server

This example outputs the total amount of ammo a player calledSomeguyhas for his weapon.

-- Find the player called 'Someguy'
myPlayer = getPlayerFromName ( "Someguy" )
-- If a player called 'Someguy' was found then
if ( myPlayer ) then
-- Retrieve the total amount of ammo for that player, and store it in a variable called 'ammo'
ammo = getPedTotalAmmo ( myPlayer )
-- Tell all the players how much ammo 'Someguy' has
outputChatBox ( "Someguy's current total ammo: " .. ammo .. "." )
end

Issues

ID Description
734 Sometimes wrong count of player ammo, if get it in onPlayerWeaponFire

See Also