setPedAimTarget
Client-side
Server-side
Shared
Manual Review Required
Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.
This function allows you to set a ped's aim target to a specific point. If a ped is within a certain range defined by getPedTargetStart and getPedTargetEnd he will be targeted and shot.
Syntax
bool setPedAimTarget ( ped thePed, float x, float y, float z )Required Arguments
- thePed: The ped whose target you want to set. Only peds and remote players will work; this function has no effect on the local player.
- x: The x coordinate of the aim target point.
- y: The y coordinate of the aim target point.
- z: The z coordinate of the aim target point.
Returns
- bool: value
Returns true if the function was successful, false otherwise.
Code Examples
shared
Example 1:This example creates a ped in the middle of the map and sets its aim target to point north-east.
function createPedAndsetHisAimTarget () local ped = createPed (0, 0, 0, 5 ) -- create a ped, who looks like cj, in the middle of the map setPedAimTarget ( ped, 10, 10, 5 ) -- set the ped's target to a point in North-EastendSee Also
Ped Functions
- addPedClothes
- canPedBeKnockedOffBike
- createPed
- getPedAmmoInClip
- getPedAnalogControlState
- getPedAnimation
- getPedArmor
- getPedBonePosition
- getPedCameraRotation
- getPedClothes
- getPedContactElement
- getPedControlState
- getPedFightingStyle
- getPedGravity
- getPedMoveState
- getPedOccupiedVehicle
- getPedOccupiedVehicleSeat
- getPedOxygenLevel
- getPedSimplestTask
- getPedStat
- getPedTarget
- getPedTargetCollision
- getPedTargetEnd
- getPedTargetStart
- getPedTask
- getPedTotalAmmo
- getPedVoice
- getPedWalkingStyle
- getPedWeapon
- getPedWeaponMuzzlePosition
- getPedWeaponSlot
- getValidPedModels
- givePedWeapon
- isPedBleeding
- isPedChoking
- isPedDead
- isPedDoingGangDriveby
- isPedDoingTask
- isPedDucked
- IsPedFootBloodEnabled
- isPedHeadless
- isPedInVehicle
- isPedOnGround
- isPedReloadingWeapon
- isPedTargetingMarkerEnabled
- isPedWearingJetpack
- killPed
- playPedVoiceLine
- reloadPedWeapon
- removePedClothes
- removePedFromVehicle
- resetPedVoice
- setPedAimTarget
- setPedAnalogControlState
- setPedAnimation
- setPedAnimationProgress
- setPedAnimationSpeed
- setPedArmor
- setPedBleeding
- setPedCameraRotation
- setPedCanBeKnockedOffBike
- setPedChoking
- setPedControlState
- setPedDoingGangDriveby
- setPedEnterVehicle
- setPedExitVehicle
- setPedFightingStyle
- setPedFootBloodEnabled
- setPedGravity
- setPedHeadless
- setPedLookAt
- setPedOxygenLevel
- setPedStat
- setPedTargetingMarkerEnabled
- setPedVoice
- setPedWalkingStyle
- setPedWeaponSlot
- setPedWearingJetpack
- warpPedIntoVehicle