OnPickupHit: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
[[Category:Incomplete Event]]
__NOTOC__
__NOTOC__
This event is triggered when a player hits a pickup. A pickup is health, armor, or a weapon.
This event is triggered when a player hits a pickup. A pickup is health, armor, or a weapon.

Revision as of 22:17, 29 September 2007

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 )