GetPickupType

From Multi Theft Auto: Wiki
Revision as of 15:49, 13 August 2006 by Talidan (talk | contribs)
Jump to navigation Jump to search

This function retreives the type of a pickup, either a health, armour or weapon pickup.

Syntax

int getPickupType ( pickup pickup )        

Required Arguments

  • pickup: The pickup you wish to retrieve the type of

Returns

Returns an integer of the type of the pickup, which include:

  • 0: Health pickup
  • 1: Armour pickup
  • 2: Weapon pickup

Example

This example takes a player's money appropriately according to the amount of health 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
        health = getPickupHealth ( source )
        takePlayerMoney ( player, health ) -- take the player's money according to the amount of hp points in the pickup
    end
end

See Also