getPickupAmount | Multi Theft Auto: Wiki Skip to content

getPickupAmount

Client-side
Server-side
Shared

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


This function retrieves the amount of health or armor given from a pickup.

Syntax

int getPickupAmount ( pickup thePickup )
Required Arguments
  • thePickup: The pickup you wish to retrieve the amount from.

Returns

  • int: value

Returns an integer of the amount the pickup is set to, false if it's invalid, 0 if it's no health or amor pickup.

Code Examples

shared
function onPickupHitFunction ( thePlayer )
if getPickupType ( source ) == 0 then -- check the type of pickup, if it is a health pickup then
amount = getPickupAmount ( source )
outputChatBox ( "You picked up " .. amount .. " health", thePlayer)
end
end
addEventHandler ( "onPickupHit", root, onPickupHitFunction ) -- add an event handler for onPickupHit