Skip to content

ThrowPlayerFromHorse

Has a rider’s game throw them off their horse, the fall every player sees.

The rider’s own game plays the throw - the fall, the lying still, the get-up - so it is the game’s real fall, not a teleport, and every player who has their body sees it. The order goes to their game; the throw itself follows a moment later, and OnPlayerThrown (cause THROW_MODE) tells you it happened. It may not happen at all: a game that cannot play the throw (an unsupported build) is refused up front, and one that declines it after all simply never answers - the order lapses after two seconds. By default the rider is flung backward off the horse’s rear, the throw a rearing horse gives; flung set to false drops them where they sit instead, the fall of a head hit on a branch.

false with the reason as the asker reads it when the player is not connected, not in the world, dead, not on a horse, already falling or being pulled off their horse (OnPlayerPulledDown), cannot be thrown by the rules (SetPlayerRiderThrow), or their game cannot play the throw.

ThrowPlayerFromHorse(pid [, flung])
Parameter Type
pid number the rider
flung boolean true or nil for the backward throw off the horse’s rear (the default); false for the plain drop (optional)

boolean, string - true when the order went out; false and the reason when it did not

-- /throw <player>: an admin knocks a rider off
function OnPlayerCommandText(pid, cmd, args)
if cmd ~= "throw" or not IsPlayerAdmin(pid) then return false end
local target = tonumber(args) or GetPlayerId(args)
local ok, why = ThrowPlayerFromHorse(target)
if not ok then SendClientMessage(pid, COLOR_RED, why) end
return true
end

OnPlayerThrown · IsPlayerThrown · SetPlayerRiderThrow · GetPlayerMount · the Horses group of the index