OnSiegeEngineAction
A player puts a hand to a siege engine - return false to refuse.
Runs before the server acts on the player’s use prompt ("operate": they would take the operator’s place) or on its operator’s
keys ("load", "fire") - on a siege ladder, "push" (they knock it down from its top) or "raise" (they stand a fallen one
up from its foot); at a pile of stones, "lift" (they take a stone up) or "throw" (they throw the stone they hold). The
server’s own checks come first: the player is near it and on foot, nobody else works it, it is not wrecked. Return false to
refuse - tell the player why, the server says nothing more. Letting go (a stone put back) is never asked.
Syntax
Section titled “Syntax”function OnSiegeEngineAction(pid, id, action) -- ...end| Parameter | Type | |
|---|---|---|
pid |
number | the player |
id |
number | the engine |
action |
string | "operate", "load" or "fire"; a ladder’s "push" or "raise"; a pile’s "lift" or "throw" |
Returns
Section titled “Returns”false refuses; anything else lets it happen
Example
Section titled “Example”-- only the attackers' team works the engines, and a trebuchet fires only after the siege's startfunction OnSiegeEngineAction(pid, id, action) if GetPlayerTeam(pid) ~= TEAM_ATTACKERS then SendClientMessage(pid, COLOR_RED, "Only the attackers work the engines.") return false end if action == "fire" and not SIEGE_STARTED then SendClientMessage(pid, COLOR_RED, "Hold your fire until the siege begins.") return false end return trueendSee also
Section titled “See also”GetPlayerSiegeEngine · SetSiegeEngineOperator · LoadSiegeEngine · FireSiegeEngine · the Siege engines group of the index
