SetPlayerDowned: Difference between revisions
Jump to navigation
Jump to search
Automatyczna aktualizacja dokumentacji funkcji |
Complete Lua function catalog |
||
| Line 42: | Line 42: | ||
* Use <code>revivePlayer</code> for an explicit recovery. | * Use <code>revivePlayer</code> for an explicit recovery. | ||
[[Category:Lua Functions]] | |||
[[Category:Server Functions]] | [[Category:Server Functions]] | ||
[[Category:Player Functions]] | [[Category:Player Functions]] | ||
[[Category:Life State Functions]] | [[Category:Life State Functions]] | ||
Latest revision as of 09:55, 15 August 2026
setPlayerDowned
Places a player in the authoritative downed state.
Syntax
bool setPlayerDowned(int playerId [, int durationMs = 0, number reviveHealth = 10])
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
playerId |
int |
yes | The connected player identifier. |
durationMs |
int |
no | 0 for an indefinite downed state, or 250..3600000 milliseconds for automatic revive. |
reviveHealth |
number |
no | Health restored by an automatic revive; defaults to 10. |
Returns
Returns true when the life-state transition is accepted; otherwise returns false.
Examples
Example 1
Use a medic-controlled downed state with no automatic recovery:
addEventHandler("onPlayerDeath", root, function(playerId)
setPlayerDowned(playerId, 0, 25)
end)
Example 2
Down a player for fifteen seconds:
setPlayerDowned(playerId, 15000, 10)
Notes
- Available only in server-side resource scripts.
- The player's health becomes 0 and movement, attacks, and spell casting are blocked.
- The state is reliable and included in late-join synchronization.
- Use
revivePlayerfor an explicit recovery.