HU/setPedAnimation

From Multi Theft Auto: Wiki
Jump to navigation Jump to search

Beállítja az animációját egy játékosnak vagy pednek. Ha nincs megadva animáció akkor leállítja automatikusan a jelenleg futó animációt.

Szintaxis

bool setPedAnimation ( ped thePed [, string block = nil, string anim = nil, int time = -1, bool loop = true, bool updatePosition = true,
                       bool interruptable = true, bool freezeLastFrame = true, int blendTime = 250 ] )

OOP Syntax Help! I don't understand this!

Method: ped:setAnimation(...)
Counterpart: getPedAnimation


Kötelező argumentumok

Opcionális argumentumok

Megjegyzés: Ha opcionális argumentumokat használsz, meg kell adnod az adott argumentum előtt az összeset. Több információ: optional arguments.

  • block: az animáció block neve.
  • anim: az animáció neve a blockon belül.
  • time: mennyi ideig fusson az animáció (nem minden animációnál működik).
  • loop: ismétlődjön-e az animáció.
  • updatePosition: megváltoztatja a ped pozicióját hasznos a mozgás animációknál.
  • interruptable: ha false-ra van állítva semmi tudja majd megzavarni az animációt.
  • freezeLastFrame: ha true-ra van állítva akkor az animáció vége után az utolsó képkocka fog folyamatosan lejátszodni.
  • blendTime: mennyi ideig lesz mixelve a képkocka az előzővel milliszekundumban megadva.

Vissza küldött érték

true ha sikeres volt, ellenkező esetben false.

Példa

Click to collapse [-]
Server

This example creates a ped, rotates him, and makes him walk:

function makePed()
	local thePed = createPed(56, 1, 1, 4, 315)
	setPedAnimation(thePed, "ped", "WOMAN_walknorm")
end
addCommandHandler("makemyped", makePed)
Click to collapse [-]
Server

This example makes the player sit down and stand up using the command /sit.

function toggleSit(thePlayer)
	if not getElementData(thePlayer, "sitting") then
		setPedAnimation(thePlayer, "ped", "seat_down", -1, false, false, false, false)
		setElementData(thePlayer, "sitting", true)
	else
		-- If you use again this command then your character stand up
		setPedAnimation(thePlayer)
		removeElementData(thePlayer, "sitting")
	end
end
addCommandHandler("sit", toggleSit)

Issues

Issue ID Description
#9522 Setting a ped's or player's animation whilst occupying a jetpack will remove their jetpack, but not the jetpack sound

Lásd még