Skip to content

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).

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

false refuses the pickup; nothing, nil or true lets it start

-- only the miller's men (team 2) may carry the flour
function 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
end
end

SetItemCarrying · OnPlayerPutDownCarryItem · PickUpCarryItem · the Carry items group of the index