OnPickupHit

From Multi Theft Auto: Wiki
Revision as of 22:17, 29 September 2007 by Ransom (talk | contribs)
Jump to navigation Jump to search

This event is triggered when a player hits a pickup. A pickup is health, armor, or a weapon.

Syntax

void onPickupHit ( player player ) 

Parameters

  • The source of this event refers to the pickup which was hit by the player.
  • thePlayer: a player element referring to the player who moved over the pickup.

Example

This example creates a pickup and outputs a message to the chat box when the player walks over it

createPickup ( 10.0, 10.0, 10.0, 2, 31, 3000, 50 ) --Create an M4 weapon pickup when script starts

function pickedUpWeaponCheck ( player, matchingDimension )
	if source == myPickup then --If the pickup I grabbed was myPickup
	    outputChatBox ( "You have picked up your pickup weapon" ) --Display this message in the chat box
	end
end
addEventHandler ( "onPickupHit", root, pickedUpWeaponCheck )