SlashCo Wiki

SlashCo.DropItem

  SlashCo.DropItem( Player ply, function dropCallback, string ignoreField )

Description

Drops the survivor's currently held item (the secondary slot takes priority unless it's empty or flagged via ignoreField) as a physical entity in the world.
Runs the item's ITEM.PreDrop/ITEM.PreDropSecondary, ITEM.OnDrop, ITEM.OnSwitchFrom and ITEM.ItemDropped callbacks along the way; dropping can be cancelled by ITEM.PreDrop/ITEM.PreDropSecondary.
Does nothing in the lobby, for non-survivors, or while the player is frozen.

Arguments

1Player ply

The player whose item should be dropped.

2function dropCallback

Called with (ply, item, droppeditem, phys) once the item has been dropped, or with (nil) if nothing was dropped.

3string ignoreField

If the equipped secondary item has this field set, the primary slot is dropped instead.