GetBodyPartName
Jump to navigation
Jump to search
This function is used to get the name of a body part on a player.
Syntax
string getBodyPartName ( int bodyPartID )
Required Arguments
- bodyPartID: An interger representing the body part ID you wish to retrieve the name of.
Returns
This function returns a string containing the body part name if the ID is valid, 'false' otherwise.
Example
This example prints the killer and body part to the chat on the wasted/kill event.
addEventHandler ( "onPlayerWasted", root, "onPlayerWasted" ) function onPlayerWasted ( ammo, attacker, weapon, bodypart ) if ( attacker ) then -- if we have an attacker if ( getElementType ( attacker ) == "player" ) then -- make sure the element that killed him was a player tempString = getClientName ( attacker ).." killed "..getClientName ( source ).." ("..getWeaponNameFromID ( weapon )..")" if ( bodypart == 9 ) then -- if he was shot in the head tempString = tempString.." (HEADSHOT!)" else tempString = tempString.." ("..getBodyPartName ( bodypart )..")" end chat ( tempString ) else chat ( getClientName ( source ).." died. ("..getWeaponNameFromID ( weapon )..") ("..getBodyPartName ( bodypart )..")" ) end else chat ( getClientName ( source ).." died. ("..getWeaponNameFromID ( weapon )..") ("..getBodyPartName ( bodypart )..")" ) end end
See Also
- getPlayerTeam
- getPlayerBlurLevel
- setPlayerBlurLevel
- getPlayerSerial
- forcePlayerMap
- getPlayerScriptDebugLevel
- getPlayerFromName
- getPlayerMoney
- getPlayerName
- getPlayerNametagColor
- getPlayerNametagText
- getPlayerPing
- getPlayerWantedLevel
- givePlayerMoney
- isPlayerMapForced
- isPlayerNametagShowing
- setPlayerHudComponentVisible
- setPlayerMoney
- setPlayerNametagColor
- setPlayerNametagShowing
- setPlayerNametagText
- takePlayerMoney
- countPlayersInTeam
- getPlayersInTeam
- isVoiceEnabled
- setControlState
- getControlState