getBodyPartName | Multi Theft Auto: Wiki Skip to content

getBodyPartName

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


This function is used to get the name of a body part on a player.

Syntax

getBodyPartName ( )

Code Examples

server

This example prints the killer and body part to the chat on the wasted/kill event.

function deathMessageOnWasted ( 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 = getPlayerName ( attacker ) .. " killed " .. getPlayerName ( source ) .. " (" .. getWeaponNameFromID ( weapon ) .. ")"
if ( bodypart == 9 ) then -- if he was shot in the head
tempString = tempString .. " (HEADSHOT!)"
else
tempString = tempString .. " (" .. getBodyPartName ( bodypart ) .. ")"
end
outputChatBox ( tempString )
else
outputChatBox ( getPlayerName ( source ) .. " died. (" .. getWeaponNameFromID ( weapon ) .. ") (" .. getBodyPartName ( bodypart ) .. ")" )
end
else
outputChatBox ( getPlayerName ( source ) .. " died. (" .. getWeaponNameFromID ( weapon ) .. ") (" .. getBodyPartName ( bodypart ) .. ")" )
end
end
addEventHandler ( "onPlayerWasted", root, deathMessageOnWasted )

See Also