GetPickupAmount

From Multi Theft Auto: Wiki
Revision as of 10:53, 28 November 2006 by MrJax (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This function retreives the amount of health or armour given from a pickup.

Syntax

int getPickupAmount ( pickup pickup )        

Required Arguments

  • pickup: The pickup you wish to retrieve the amount from.

Returns

Returns an integer of the amount the pickup is set to.

Example

This example takes a player's money appropriately according to the amount of heakth he 'buys'.

addEventHandler ( "onPickupHit", root, "onPickupHit" ) --add an event handler for onPickupHit
function onPickupHit ( player ) --when someone hits a pickup
    if getPickupType ( source ) == 0 then --check the type of pickup, if it is a health pickup then
        amount = getPickupAmount ( source )
        takePlayerMoney ( player, amount ) -- take the player's money according to the amount in the pickup
    end
end

See Also