OnPlayerThrown
The player was thrown off the horse they ride - a low branch, the horse, or the mode’s own order.
The game’s own rider fall: a head hit on a branch or a beam at speed, a horse throwing its rider, or ThrowPlayerFromHorse.
The rider’s game plays the fall, the lying still and the get-up by itself, and every player who sees them sees the same fall on
their body. It comes before OnPlayerDismount of the same fall. The server takes the rider’s game’s word for a fall
only within 4 metres of where it last had them and not within 3 seconds of the one before; such a fall plays on the rider’s
own screen alone and is not told here. For the few seconds the fall lasts
(IsPlayerThrown) the server lets the rider’s body move faster than a walker may, in the measure of the saddle - a body
tumbling along the ground is not a speed hack. Anything that moves the player on the server’s word - a death, a respawn,
SetPlayerPos, a new ride - ends that allowance early.
cause is one of THROW_HEAD_HIT (a branch or a beam), THROW_HORSE (the horse threw them), THROW_OTHER (their game threw
them and the server could not tell why) and THROW_MODE (ThrowPlayerFromHorse). flung is true for the game’s strong
throw, the one a rearing horse gives.
Syntax
Section titled “Syntax”function OnPlayerThrown(pid, id, cause, flung) -- ...end| Parameter | Type | |
|---|---|---|
pid |
number | the rider |
id |
number | the horse they fell from |
cause |
number | THROW_HEAD_HIT, THROW_HORSE, THROW_OTHER or THROW_MODE |
flung |
boolean | true when it was the game’s strong throw |
Returns
Section titled “Returns”nothing
Example
Section titled “Example”-- a fall hurts: 10 health, 30 when the horse flung themfunction OnPlayerThrown(pid, id, cause, flung) local health = GetPlayerHealth(pid) SetPlayerHealth(pid, math.max(1, health - (flung and 30 or 10))) SendClientMessage(pid, COLOR_RED, cause == THROW_HEAD_HIT and "Mind the branches!" or "You were thrown!")endSee also
Section titled “See also”OnPlayerDismount · ThrowPlayerFromHorse · SetPlayerRiderHeadHit · IsPlayerThrown · the Horses group of the index
