OnPickupUse: Difference between revisions
Jump to navigation
Jump to search
m (→Parameters) |
mNo edit summary |
||
Line 2: | Line 2: | ||
{{Server event}} | {{Server event}} | ||
This event is triggered when a [[player]] stands on a [[pickup]] while not in a [[vehicle]]. | This event is triggered when a [[player]] stands on a [[pickup]] while not in a [[vehicle]]. | ||
{{Tip|Pickups use [[colshape]]s, you can get the [[colshape]] of the [[pickup]] with [[getElementColShape]] and use [[colshape]] [[event]]s to it.}} | |||
Pickups use [[colshape]]s, you can get the [[colshape]] of the [[pickup]] with [[getElementColShape]] and use [[colshape]] [[event]]s to it. | |||
==Parameters== | ==Parameters== | ||
Line 19: | Line 18: | ||
==Example== | ==Example== | ||
This example | This example outputs a message to the chatbox when a player uses a pickup. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function pickupUse ( thePlayer ) | function pickupUse( thePlayer ) | ||
outputChatBox ( getPlayerName ( thePlayer ) .. " | outputChatBox( getPlayerName( thePlayer ) .. " used a pickup!" ) | ||
end | end | ||
addEventHandler ( "onPickupUse", | addEventHandler( "onPickupUse", root, pickupUse ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{ | ==See Also== | ||
{{Pickup events}} |
Revision as of 00:19, 2 July 2018
This event is triggered when a player stands on a pickup while not in a vehicle.
Tip: Pickups use colshapes, you can get the colshape of the pickup with getElementColShape and use colshape events to it. |
Parameters
player playerWhoUsed
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 outputs a message to the chatbox when a player uses a pickup.
function pickupUse( thePlayer ) outputChatBox( getPlayerName( thePlayer ) .. " used a pickup!" ) end addEventHandler( "onPickupUse", root, pickupUse )
See Also