SetPedHeadless: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(Added OOP syntax)
Line 4: Line 4:
==Syntax==
==Syntax==
<syntaxhighlight lang="lua">bool setPedHeadless  ( ped thePed, bool headState )</syntaxhighlight>
<syntaxhighlight lang="lua">bool setPedHeadless  ( ped thePed, bool headState )</syntaxhighlight>
{{OOP||[[ped]]:setHeadless|headless}}


===Required Arguments===
===Required Arguments===

Revision as of 17:10, 26 November 2014

With this function, you can set if a ped has a head or not.

Syntax

bool setPedHeadless  ( ped thePed, bool headState )

OOP Syntax Help! I don't understand this!

Method: ped:setHeadless(...)
Variable: .headless


Required Arguments

  • thePed: The ped to check.
  • headState: head state, use true if you want the ped be headless, use false to give back the head.

Returns

Returns true if successful, false otherwise

Example

Click to collapse [-]
Server

This example enables a player to behead themselves, and give them their head back.

function removeMyHead(thePlayer)
	setPedHeadless(thePlayer, true) -- Removes the players head
	outputChatBox("You have been beheaded!", thePlayer, 255, 0, 0) -- A confirmation message for the player
end
addCommandHandler("beheadme", removeMyHead)

function giveBackHead(thePlayer)
	setPedHeadless(thePlayer, false) -- Gives the player a head
	outputChatBox("You have been given a head!", thePlayer, 255, 0, 0) -- A confirmation message for the player
end
addCommandHandler("headmeup", giveBackHead)

See Also