HU/getPedAnimation: Difference between revisions
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
		
	
 (→Példa)  | 
				|||
| Line 19: | Line 19: | ||
==Példa==  | ==Példa==  | ||
Ez a példa olyan parancsot ad hozzá, amely lehetővé teszi egy másik játékos által használt animáció másolását a /copyanim theirName parancs használatával.  | |||
<syntaxhighlight lang="lua">  | <syntaxhighlight lang="lua">  | ||
function CopyAnimation(theCommand, thePlayer) -- The Command Function  | function CopyAnimation(theCommand, thePlayer) -- The Command Function  | ||
Revision as of 19:20, 7 October 2018
Visszaadja egy játékos vagy ped animációját a setPedAnimation használatával.
| Megjegyzés: Használja a getPedTask-ot egy játékos aktuális mozgásának az ellenőrzéséhez. | 
Szintaxis
string, string getPedAnimation ( ped thePed )
OOP Syntax Help! I don't understand this!
- Method: ped:getAnimation(...)
 - Counterpart: setPedAnimation
 
Kötelező paraméterek
- thePed: a játékos vagy ped, akinek az animációját szeretné megkapni.
 
Visszatérési érték
Visszatérési értéke két string: az első a tömb neve, a második az animáció neve. Visszatérési értéke false, ha valami hiba történt, vagy ha a ped nem csinál semmilyen animációt.
Példa
Ez a példa olyan parancsot ad hozzá, amely lehetővé teszi egy másik játékos által használt animáció másolását a /copyanim theirName parancs használatával.
function CopyAnimation(theCommand, thePlayer) -- The Command Function
	if thePlayer then -- If a player name entered then
		thePlayerToCopyFrom = getPlayerFromName(thePlayer) -- get player from his name
		Block, Anim = getPedAnimation(thePlayerToCopyFrom) -- get the player animation
		if Block then -- if got the animation successfully then
			setPedAnimation(localPlayer, Block, Anim) -- set my animation the same
			outputChatBox("* Copied Successfully !") -- output chat message
		end
	else	
		outputChatBox("* Please Enter a Player Name To Copy From !") -- if you didnt entered a player name , then output a chat box message
	end
end
addCommandHandler("copyanim", CopyAnimation) --  adding the Command Handler
Példa 2
This example shows what block and animation your player is currently performing. Note this will return "N/A" if you did not set an animation with setPedAnimation. If you want to see what the player ped is doing as you control them that is getPedTask.
addEventHandler("onClientPreRender",root,
	function ()
    local block, animation = getPedAnimation(localPlayer)
	dxDrawText ( "CURRENT ANIMATION INFO...", 100, 300 )
	if not block then block = "N/A" end
	if not animation then animation = "N/A" end
	dxDrawText ( "Block = "..block.." Animation = "..animation, 100, 315 )
end )
Lásd még
- HU/addPedClothes
 - HU/canPedBeKnockedOffBike
 - HU/createPed
 - HU/getPedAmmoInClip
 - HU/getPedAnalogControlState
 - HU/getPedAnimation
 - HU/getPedArmor
 - HU/getPedBonePosition
 - HU/getPedCameraRotation
 - HU/getPedClothes
 - HU/getPedContactElement
 - HU/getPedControlState
 - HU/getPedMoveState
 - HU/getPedOccupiedVehicle
 - HU/getPedOccupiedVehicleSeat
 - HU/getPedOxygenLevel
 - HU/getPedSimplestTask
 - HU/getPedStat
 - HU/getPedTarget
 - HU/getPedTargetCollision
 - HU/getPedTargetEnd
 - HU/getPedTargetStart
 - HU/getPedTask
 - HU/getPedTotalAmmo
 - HU/getPedVoice
 - HU/getPedWalkingStyle
 - HU/getPedWeapon
 - HU/getPedWeaponMuzzlePosition
 - HU/getPedWeaponSlot
 - HU/getValidPedModels
 - HU/givePedWeapon
 - HU/isPedChoking
 - HU/isPedDead
 - HU/isPedDoingGangDriveby
 - HU/isPedDoingTask
 - HU/isPedDucked
 - HU/isPedHeadless
 - HU/isPedInVehicle
 - HU/isPedOnFire
 - HU/isPedOnGround
 
- HU/isPedWearingJetpack
 - HU/killPed
 - HU/removePedClothes
 - HU/removePedFromVehicle
 - HU/setAnalogControlState
 - HU/setPedAimTarget
 - HU/setPedAnalogControlState
 - HU/setPedAnimation
 - HU/setPedAnimationProgress
 - HU/setPedCameraRotation
 - HU/setPedCanBeKnockedOffBike
 - HU/setPedControlState
 - HU/setPedDoingGangDriveby
 - HU/setPedFootBloodEnabled
 - HU/setPedHeadless
 - HU/setPedLookAt
 - HU/setPedOnFire
 - HU/setPedOxygenLevel
 - HU/setPedStat
 - HU/setPedTargetingMarkerEnabled
 - HU/setPedVoice
 - HU/setPedWalkingStyle
 - HU/setPedWeaponSlot
 - HU/warpPedIntoVehicle