- Documentation
- Server functions
- setPedChoking
Function
setPedChoking
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.
valuebooltrue= 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
isPedChokingReturns the choking state stored withsetPedChoking.falseby default. The game does not set this state by itself (tear gas does not change it), so it reflects only what scripts have set.setPedAnimationPlays an animation on a ped. The animation comes from a game animation block (e.g.ped,dancing,smoking) or from an IFP file loaded withengineLoadIFP. Calling it without a block stops the animation. On the server the animation reaches every player. On the client it only runs in this game: for the local player others see it through pose streaming; for a remote player the function returnsfalsebecause their appearance comes from their own game.setElementHealthSets an element's health.0kills a player or ped and firesonPlayerWasted/onPedWasted.