OnPlayerPickUpCarryItem
A player reaches for a carry item with the “Pick up” prompt - return false to refuse.
Only while the players’ own pickup is on (SetItemCarrying). The server has checked that the player sees the item, stands
within reach (and in the open, when [validation] line_of_sight is on), has his hands free and that nobody else holds it; the
mode has the last word. Returning false stops the pickup - the player is told he cannot pick it up - anything else lets it
start. Not run for the mode’s own orders (PickUpCarryItem, GivePlayerCarryItem).
Syntax
Section titled “Syntax”function OnPlayerPickUpCarryItem(pid, id, item) -- ...end| Parameter | Type | |
|---|---|---|
pid |
number | the player who reaches for it |
id |
number | the carry item’s entity id |
item |
string | the item’s name ("waterBucket" …), or its class GUID when the server’s item table does not name it |
Returns
Section titled “Returns”false refuses the pickup; nothing, nil or true lets it start
Example
Section titled “Example”-- only the miller's men (team 2) may carry the flourfunction OnPlayerPickUpCarryItem(pid, id, item) if item == "mlynaruvUcen_sackcarryable" and GetPlayerTeam(pid) ~= 2 then SendClientMessage(pid, COLOR_RED, "That flour belongs to the mill.") return false endendSee also
Section titled “See also”SetItemCarrying · OnPlayerPutDownCarryItem · PickUpCarryItem · the Carry items group of the index
