OnPickupUse: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (See Also for server events)
No edit summary
Line 19: Line 19:
This example announces whena  player picks up a pickup
This example announces whena  player picks up a pickup
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
addEventHandler ( "onPickupUse", getRootElement(), "pickupUse" )
function pickupUse ( thePlayer )
function pickupUse ( thePlayer )
     outputChatBox ( getClientName ( thePlayer ) .. " picked up a pickup!" )
     outputChatBox ( getClientName ( thePlayer ) .. " picked up a pickup!" )
end
end
addEventHandler ( "onPickupUse", getRootElement(), pickupUse )
</syntaxhighlight>
</syntaxhighlight>


{{See also/Server event|Pickup events}}
{{See also/Server event|Pickup events}}

Revision as of 12:10, 13 May 2009

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

Parameters

void onPickupUse ( player player )
  • player: A player element refering to the player who used the pickup

Source

The source of this event is the pickup that is getting used by the player.

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

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

See Also

Pickup events


Event functions