Player Pickup Drop Event||doc135600

September 20, 2022

Format

 PRE_CHECK_PICK_ITEM
  • The class to which the function belongs:Player

Description

This event is triggered when the player pre-checks before picking up the drop.


Context

The context content of the event

name type Description
obj1 Player The instance of the player who picked up the drop
canPick boolean Whether it can be picked up, the default is true
item Item Picked item instance
dropItem DropItem Drop example


Code Samples

On the server side of the player entity templateglobal script, a pre-check before a registered player takes a dropCallback, assign the property of canPick to false, so that the player cannot pick up the dropped items

Trigger.RegisterHandler(this:cfg(), "PRE_CHECK_PICK_ITEM", function(context)
    local player = context.obj1
    context.canPick = false
end)