SetPedBleeding: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (Reverted edits by Hydra (talk) to last revision by StrixG)
Tag: Rollback
m (Added an example.)
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{Client function}}
{{Client function}}
__NOTOC__
__NOTOC__
{{New feature/item|3.0159|1.5.8|20935|This function allows you to set [[player|player's]] or [[ped|ped's]] bleeding effect.}}
{{Added feature/item|1.5.9|1.5.8|20935|This function allows you to set [[player|player's]] or [[ped|ped's]] bleeding effect.}}
==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">bool setPedBleeding( ped thePed, bool bleeding ) </syntaxhighlight>  
<syntaxhighlight lang="lua">bool setPedBleeding ( ped thePed, bool bleeding ) </syntaxhighlight>  
{{OOP||[[ped]]:setBleeding|bleeding|isPedBleeding}}
{{OOP||[[ped]]:setBleeding|bleeding|isPedBleeding}}


===Required Arguments===
===Required Arguments===
*'''thePed:''' the player or ped whose bleeding effect you want to set of.
*'''thePed:''' The [[player]] or [[ped]] whose bleeding effect you want to set of.
*'''bleeding:''' boolean specifying whether the player or ped is bleeding or not.
*'''bleeding:''' [[Boolean]] specifying whether the player or ped is bleeding or not.


===Returns===
===Returns===
Returns ''true'' if the bleeding state was successfully set, ''error'' is raised otherwise.
Returns ''true'' if the bleeding state was successfully set, ''false'' otherwise.


==Example==
==Example==
{{Example}}
This example causes the player to bleed.
<syntaxhighlight lang="lua">
addCommandHandler("bleed", function()
    setPedBleeding(localPlayer, not isPedBleeding(localPlayer))
end)
</syntaxhighlight>


==Requirements==
==Requirements==

Latest revision as of 14:42, 1 October 2021

This function allows you to set player's or ped's bleeding effect.

Syntax

bool setPedBleeding ( ped thePed, bool bleeding ) 

OOP Syntax Help! I don't understand this!

Method: ped:setBleeding(...)
Variable: .bleeding
Counterpart: isPedBleeding


Required Arguments

  • thePed: The player or ped whose bleeding effect you want to set of.
  • bleeding: Boolean specifying whether the player or ped is bleeding or not.

Returns

Returns true if the bleeding state was successfully set, false otherwise.

Example

This example causes the player to bleed.

addCommandHandler("bleed", function()
    setPedBleeding(localPlayer, not isPedBleeding(localPlayer))
end)

Requirements

Minimum server version n/a
Minimum client version 1.5.8-9.20935

Note: Using this feature requires the resource to have the above minimum version declared in the meta.xml <min_mta_version> section. e.g. <min_mta_version client="1.5.8-9.20935" />

See Also

Shared