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]]
[[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.


==Syntax==  
==Syntax==  
Line 8: Line 7:
void onPickupHit ( player player )  
void onPickupHit ( player player )  
</syntaxhighlight>  
</syntaxhighlight>  
==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==  
==Example==  
This example does...
This example creates a pickup and outputs a message to the chat box when the player walks over it
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--This line does...
createPickup ( 10.0, 10.0, 10.0, 2, 31, 3000, 50 ) --Create an M4 weapon pickup when script starts
blabhalbalhb --abababa
 
--This line does this...
function pickedUpWeaponCheck ( player, matchingDimension )
mooo
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 )
</syntaxhighlight>
</syntaxhighlight>

Revision as of 22:16, 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 )