Skip to content

OnPlayerCarry

A player reaches for a body with the game’s grab - return false to refuse.

Only while the players’ own grab is on (SetCarrying). The server has checked that the player has the body in view and within reach (and in the open, when [validation] line_of_sight is on), that the rules allow this kind of body and that nobody else has it; the mode has the last word. Returning false stops the grab - the player is told they cannot carry it - anything else lets it start. Not run for the mode’s own orders (CarryPlayer, CarryEntity).

kind is "player" (a knocked-out player; id is their player id), "corpse" (a body that lies dead; id is the entity id) or "actor" (a knocked-out NPC actor; id is the entity id). victim is the player id of the dead player a corpse was, -1 for anyone else - or a player who has left.

function OnPlayerCarry(pid, kind, id, victim)
-- ...
end
Parameter Type
pid number the player who reaches for it
kind string "player", "corpse" or "actor"
id number the player’s id, or the entity id
victim number the player a corpse was; -1 otherwise

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

-- only guards (team 1) may carry other players; anyone may carry the dead
function OnPlayerCarry(pid, kind, id, victim)
if kind == "player" and GetPlayerTeam(pid) ~= 1 then
SendClientMessage(pid, COLOR_RED, "Only the guards may carry prisoners.")
return false
end
end

SetCarrying · OnPlayerCarryStart · CarryPlayer · the Carrying group of the index