SetPedAnalogControlState: Difference between revisions
Jump to navigation
Jump to search
Zangomangu (talk | contribs) mNo edit summary |
Zangomangu (talk | contribs) |
||
Line 17: | Line 17: | ||
==Example== | ==Example== | ||
<syntaxhighlight lang="lua"> | This example uses [[setPedAnalogControlState]] to very slowly accelerate a ped-controlled NRG-500. | ||
<syntaxhighlight lang="lua"> | |||
function createAnalogControlTest () | |||
local t_Pos = {getElementPosition(localPlayer)} | |||
local veh = createVehicle (522, unpack(t_Pos)) | |||
local ped = createPed (0, unpack(t_Pos)) | |||
warpPedIntoVehicle (ped, veh) | |||
setPedAnalogControlState (ped, 'accelerate', 0.05) | |||
setPedAnalogControlState (ped, 'vehicle_left', 1) | |||
end | |||
addCommandHandler ('analogcontroltest', createAnalogControlTest) | |||
</syntaxhighlight> | |||
==Requirements== | ==Requirements== |
Revision as of 19:01, 5 January 2014
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 value representing a full analog push ( 1 ) or full release ( 0 ).
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 t_Pos = {getElementPosition(localPlayer)} local veh = createVehicle (522, unpack(t_Pos)) local ped = createPed (0, unpack(t_Pos)) warpPedIntoVehicle (ped, veh) setPedAnalogControlState (ped, 'accelerate', 0.05) setPedAnalogControlState (ped, 'vehicle_left', 1) end addCommandHandler ('analogcontroltest', createAnalogControlTest)
Requirements
This template will be deleted.
See Also
- 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