HU/getBodyPartName

From Multi Theft Auto: Wiki
Revision as of 19:41, 20 September 2018 by Surge (talk | contribs)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Ezzel a funkcióval visszakaphatjuk egy játékos testrészeinek a nevét.

Szintaxis

string getBodyPartName ( int bodyPartID )

Kötelező paraméterek

  • bodyPartID: Egy integer, mely a testrész ID-jét határozza meg, amelynek a nevét szeretné megkapni.
  • 3: Torso
  • 4: Ass
  • 5: Left Arm
  • 6: Right Arm
  • 7: Left Leg
  • 8: Right Leg
  • 9: Head

Visszatérési érték

Visszatérési értéke egy string, mely tartalmazza a testrész nevét, ha az ID érvényes, egyébként false.

Példa

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 )

Lásd még


Fordította