ToggleGate
Sends a gate the other way - from the end it rests at, or back from the way it is moving.
Heads away from whichever end the gate is at, reversing one already moving from where it has got to. What /gate does
with no argument.
Syntax
Section titled “Syntax”ToggleGate(key)| Parameter | Type | |
|---|---|---|
key |
string | the gate’s level name |
Returns
Section titled “Returns”boolean, boolean, string, number - accepted; true when the direction taken is open; the reason when refused ("" otherwise); the seconds the motion still has to run
Example
Section titled “Example”function OnPlayerCommandText(pid, cmd, args) if cmd == "lever" then local key = GetNearestGate(GetPlayerPos(pid)) if not key then SendClientMessage(pid, COLOR_RED, "No gate here.") return true end local ok, opening, reason = ToggleGate(key) SendClientMessage(pid, COLOR_YELLOW, ok and (opening and "The gate rises." or "The gate drops.") or ("The gate " .. reason .. ".")) return true endendSee also
Section titled “See also”SetGateState · GetNearestGate · the Gates group of the index
