OnPickupUse: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 4: Line 4:
==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
onPickupUse ( player player )
void onPickupUse ( player player )
</syntaxhighlight>  
</syntaxhighlight>  
==Variables==
* The source of this event refers to the pickup which was used
*'''player''': A player element refering to the player who used the pickup


===Canceling===
===Canceling===
Line 11: Line 15:


==Example==  
==Example==  
 
This example announces whena  player picks up a pickup
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
addEventHandler ( "onPickupUse", getRootElement(), "pickupUse" )
addEventHandler ( "onPickupUse", getRootElement(), "pickupUse" )
Line 18: Line 22:
end
end
</syntaxhighlight>
</syntaxhighlight>
==See Also==
{{Event_functions}}

Revision as of 15:49, 2 December 2006

This event is triggered when a player stands on a pickup while not in a vehicle.

Syntax

void onPickupUse ( player player )

Variables

  • The source of this event refers to the pickup which was used
  • player: A player element refering to the player who used the pickup

Canceling

If this event is canceled, the player will not be given the item they picked up.

Example

This example announces whena player picks up a pickup

addEventHandler ( "onPickupUse", getRootElement(), "pickupUse" )
function pickupUse ( thePlayer )
    outputChatBox ( getClientName ( thePlayer ) .. " picked up a pickup!" )
end

See Also