SetPlayerChoking: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(New page: __NOTOC__ {{Server function}} This function can be used to force the player to do the choking animation (teargas etc...) until he respawns or toggled off using this function. The animation...)
 
mNo edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Server function}}
{{Server function}}
{{Deprecated|setPedChoking}}
This function can be used to force the player to do the choking animation (teargas etc...) until he respawns or toggled off using this function. The animation can not be cancelled by the player and he will not loose health.
This function can be used to force the player to do the choking animation (teargas etc...) until he respawns or toggled off using this function. The animation can not be cancelled by the player and he will not loose health.



Latest revision as of 10:19, 7 July 2014

Emblem-important.png This function is deprecated. This means that its use is discouraged and that it might not exist in future versions.

Please use setPedChoking instead.


This function can be used to force the player to do the choking animation (teargas etc...) until he respawns or toggled off using this function. The animation can not be cancelled by the player and he will not loose health.

Syntax

bool setPlayerChoking ( player thePlayer, bool choking )


Required Arguments

  • thePlayer: Define the player whose choking status to toggle
  • choking: Use true to make the player choke, false to no longer force his choking animation

Returns

Returns true if successful, false otherwise (e.g. player handle is invalid)

Example

This script will make all players choke on resource start

-- Choke all the players when the resource starts
function ResourceStart ()
    setPlayerChoking ( root, true )
end
addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), ResourceStart, true )

-- Unchoke all the players when the resource stops
function ResourceStop ()
    setPlayerChoking ( root, false )
end
addEventHandler ( "onResourceStop", getResourceRootElement ( getThisResource () ), ResourceStop, true )

-- Choke players spawning
function PlayerSpawn ()
    setPlayerChoking ( source, true )
end
addEventHandler ( "onPlayerSpawn", root, PlayerJoin )

See Also