ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Server functions
  3. setPedChoking

Function

setPedChoking

ServerPedsIdentical to MTA:SA

Stores on the server whether a ped is choking (e.g. from tear gas in GTA). In Trilogy Hub this is state for scripts: the server remembers it and returns it from isPedChoking, but the game does not play a coughing animation or take health yet. If choking should have effects, implement them in a script, e.g. a timer that lowers health plus setPedAnimation with a coughing animation.

Syntax

bool setPedChoking(ped ped, bool value)

Arguments

pedped
A player or an NPC.
valuebool
true = choking, false = not.

Returns

true on success.

Example

setPedChoking(player, true)
local t = setTimer(function()
    if not isElement(player) or not isPedChoking(player) then return end
    setElementHealth(player, getElementHealth(player) - 2)
end, 1000, 10)
setTimer(setPedChoking, 10000, 1, player, false)

Notes

State for scripts. The game does not show choking yet; the value is for your own script logic.

See also