CarryPlayer
Has a player carry another player over the shoulder - the mode’s own order.
The carrier’s game plays the grab and the carry, the target’s game is carried by the carrier’s body, and everyone who has both
bodies sees it. The target need not be knocked out: they show knocked out for the carry and wake after it - unless the mode
knocked them out (SetPlayerKnockedOut), then they stay down. Works with the players’ own grab switched off. speed is the
carrier’s pace in metres per second (nil or 0 = the rules’ of SetCarrying, 2.4 by default; any other number is held between 0.3 and 4).
OnPlayerCarryStart follows; OnPlayerCarry is not asked.
false and the reason (“Hans is too far away (8.2 m; 6 m at most).”, “Hans is on horseback.” …) when either player is dead,
not standing in the world or in another virtual world; when either is on horseback, in a cart, flying, in a dice match, in a
fall or a pull-down, or already carrying or carried; when the carrier is also knocked out, in a fight, at a shop or in a
dialogue; when they are more than six metres apart or cannot see each other yet; or when a player’s game cannot take part (an
older build).
Syntax
Section titled “Syntax”CarryPlayer(carrier, target [, speed])| Parameter | Type | |
|---|---|---|
carrier |
number | the player who carries |
target |
number | the player who is carried |
speed |
number | the carrier’s pace in m/s; nil = the rules’ speed (optional) |
Returns
Section titled “Returns”boolean, string - true when the grab started; false and the reason when it did not
Example
Section titled “Example”-- /arrest <player>: a guard (the caller) carries a prisoner to the cellsfunction OnPlayerCommandText(pid, cmd, args) if cmd ~= "arrest" then return false end local target = GetPlayerId(args) if not target then SendClientMessage(pid, COLOR_RED, "No such player.") return true end SetPlayerKnockedOut(target, true, 120) local ok, why = CarryPlayer(pid, target) if not ok then SendClientMessage(pid, COLOR_RED, why) end return trueendSee also
Section titled “See also”CarryEntity · StopCarry · SetPlayerKnockedOut · OnPlayerCarryStart · the Carrying group of the index
