getPickupAmmo | Multi Theft Auto: Wiki Skip to content

getPickupAmmo

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 retrieves the amount of ammo in a weapon pickup.

Syntax

getPickupAmmo ( )

Code Examples

server
function onPickupHitFunction ( thePlayer )
if getPickupType ( source ) ~= 2 then return end -- if the pickup is no weapon, stop
local ammo = getPickupAmmo ( source ) -- get the amount of ammo
local weapon = getPickupWeapon ( source ) -- get the weapon of the pickup
outputChatBox ( "You just picked up a " .. getWeaponNameFromID(weapon) .. " with " .. ammo .. " ammo", thePlayer ) -- output a message to the player
end
addEventHandler ( "onPickupHit", root, onPickupHitFunction ) -- add an event handler for onPickupHit