OnPlayerWhistle
The player whistled for their horse with the game’s own whistle.
The game’s call for the horse, on foot (at most once a second). Their own screen shows the whistle, but no horse comes by
itself: bring theirs with MoveActor - it walks or gallops to them around the walls and stops where you send it - and play
the whistle’s sound for the others with PlaySound (v_horse_whistle). Nothing happens unless the mode does it.
Syntax
Section titled “Syntax”function OnPlayerWhistle(pid) -- ...end| Parameter | Type | |
|---|---|---|
pid |
number | the player |
Returns
Section titled “Returns”nothing
Example
Section titled “Example”-- the whistle brings the player's own horse from up to 300 m away, at a canterfunction OnPlayerWhistle(pid) local x, y, z = GetPlayerPos(pid) PlaySound("v_horse_whistle", x, y, z + 1.6) local horse = GetPlayerHorse(pid) if not horse or GetHorseOwner(horse) ~= pid or GetPlayerMount(pid) == horse then return end local hx, hy = GetEntityPos(horse) if (hx - x) ^ 2 + (hy - y) ^ 2 < 300 ^ 2 then MoveActor(horse, x + 1.5, y + 1.5, -1, 6.5) endendSee also
Section titled “See also”MoveActor · GetPlayerHorse · OnActorArrive · PlaySound · the Horses group of the index
