SetPedAnalogControlState: Difference between revisions
Jump to navigation
Jump to search
Zangomangu (talk | contribs) m (OCD issue) |
mNo edit summary |
||
Line 11: | Line 11: | ||
*'''thePed:''' The ped you wish to set the control state of. | *'''thePed:''' The ped you wish to set the control state of. | ||
*'''control:''' The control that you want to set the state of. See [[control names]] for a list of possible controls. | *'''control:''' The control that you want to set the state of. See [[control names]] for a list of possible controls. | ||
*'''state:''' A float | *'''state:''' A [[float]] between 0 and 1 indicating the amount the control is pressed. | ||
===Returns=== | ===Returns=== | ||
Line 17: | Line 17: | ||
==Example== | ==Example== | ||
This example uses | This example uses setPedAnalogControlState to very slowly accelerate a ped-controlled NRG-500. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function createAnalogControlTest () | function createAnalogControlTest( ) | ||
local | local playerPosition = Vector3( getElementPosition( localPlayer ) ) | ||
local theVehicle = createVehicle( 522, playerPosition ) | |||
local | local thePed = createPed( 0, playerPosition ) | ||
local | |||
warpPedIntoVehicle ( | warpPedIntoVehicle( thePed, theVehicle ) | ||
setPedAnalogControlState ( | setPedAnalogControlState( thePed, "accelerate", 0.05 ) | ||
setPedAnalogControlState ( | setPedAnalogControlState( thePed, "vehicle_left", 1 ) | ||
end | end | ||
addCommandHandler ( | addCommandHandler( "analogcontroltest", createAnalogControlTest ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 36: | Line 36: | ||
==See Also== | ==See Also== | ||
{{ | {{Client ped functions}} |
Revision as of 00:54, 8 July 2018
Sets an analog state of a specified ped's control, as if they pressed or released it.
This function only works on peds, to change the analog control state for a player, please use setAnalogControlState.
Syntax
bool setPedAnalogControlState ( ped thePed, string control, float state )
Required Arguments
- thePed: The ped you wish to set the control state of.
- control: The control that you want to set the state of. See control names for a list of possible controls.
- state: A float between 0 and 1 indicating the amount the control is pressed.
Returns
Returns true if the control state was successfully set, false otherwise.
Example
This example uses setPedAnalogControlState to very slowly accelerate a ped-controlled NRG-500.
function createAnalogControlTest( ) local playerPosition = Vector3( getElementPosition( localPlayer ) ) local theVehicle = createVehicle( 522, playerPosition ) local thePed = createPed( 0, playerPosition ) warpPedIntoVehicle( thePed, theVehicle ) setPedAnalogControlState( thePed, "accelerate", 0.05 ) setPedAnalogControlState( thePed, "vehicle_left", 1 ) end addCommandHandler( "analogcontroltest", createAnalogControlTest )
Requirements
This template will be deleted.
See Also
- canPedBeKnockedOffBike
- getPedAnalogControlState
- getPedAnimation
- getPedBonePosition
- getPedCameraRotation
- getPedControlState
- getPedMoveState
- getPedOxygenLevel
- getPedSimplestTask
- getPedTargetCollision
- getPedTargetEnd
- getPedTargetStart
- getPedTask
- getPedVoice
- getPedWeaponMuzzlePosition
- givePedWeapon
- isPedBleeding
- isPedDoingTask
- isPedReloadingWeapon
- isPedTargetingMarkerEnabled
- setAnalogControlState
- setPedAimTarget
- setPedAnalogControlState
- setPedBleeding
- setPedCameraRotation
- setPedCanBeKnockedOffBike
- setPedControlState
- setPedEnterVehicle
- setPedExitVehicle
- IsPedFootBloodEnabled
- setPedFootBloodEnabled
- setPedLookAt
- setPedOxygenLevel
- setPedTargetingMarkerEnabled
- setPedVoice
- Shared
- addPedClothes
- getPedClothes
- removePedClothes
- createPed
- getPedAmmoInClip
- getPedArmor
- getPedFightingStyle
- getPedOccupiedVehicle
- getPedOccupiedVehicleSeat
- getPedStat
- getPedTarget
- getPedTotalAmmo
- getPedWalkingStyle
- getPedWeapon
- getPedWeaponSlot
- getPedContactElement
- getValidPedModels
- isPedChoking
- isPedDead
- isPedDoingGangDriveby
- isPedDucked
- isPedHeadless
- isPedInVehicle
- isPedOnFire
- isPedOnGround
- isPedWearingJetpack
- killPed
- removePedFromVehicle
- setPedAnimation
- setPedAnimationProgress
- setPedAnimationSpeed
- setPedArmor
- setPedDoingGangDriveby
- setPedFightingStyle
- setPedHeadless
- setPedOnFire
- setPedStat
- setPedWalkingStyle
- setPedWeaponSlot
- warpPedIntoVehicle