GetPedTargetEnd: Difference between revisions
Jump to navigation
Jump to search
(New page: __NOTOC__ {{Client function}} This function allows retrieval of the position where a ped's target range ends, when he is aiming with a weapon. ==Syntax== <syntaxhighlight lang="lua"> float float float ...) |
KryPtoHolYx (talk | contribs) |
||
Line 14: | Line 14: | ||
Returns three floats, ''x'',''y'',''z'', representing the position where the ped's target ends according to his range, or ''false'' if it was unsuccessful. | Returns three floats, ''x'',''y'',''z'', representing the position where the ped's target ends according to his range, or ''false'' if it was unsuccessful. | ||
==Example== | ==Example== | ||
This Example draws a line from where the Ped´s Target Starts to the Point where the Target Ends | |||
<syntaxhighlight lang="lua"> | |||
function drawline() | |||
if (getPedTargetStart(localPlayer)) then --Checks if there is a Point to start From. | |||
local x,y,z = getPedTargetStart(localPlayer) -- Gets the Point to start From | |||
local sx,sy,sz = getPedTargetEnd(localPlayer) -- Gets the Point where the Target Ends | |||
dxDrawLine3D(x,y,z,sx,sy,sz) -- Draws the Line | |||
end | |||
end | |||
addEventHandler("onClientPreRender",getRootElement(),drawline) -- Adds the Handler | |||
</syntaxhighlight> | |||
==See Also== | ==See Also== | ||
{{Client_ped_functions}} | {{Client_ped_functions}} | ||
[[Category:Needs_Example]] | [[Category:Needs_Example]] |
Revision as of 18:09, 16 October 2013
This function allows retrieval of the position where a ped's target range ends, when he is aiming with a weapon.
Syntax
float float float getPedTargetEnd ( ped targetingPed )
Required Arguments
- targetingPed: The ped who is targeting whose target end you wish to retrieve
Returns
Returns three floats, x,y,z, representing the position where the ped's target ends according to his range, or false if it was unsuccessful.
Example
This Example draws a line from where the Ped´s Target Starts to the Point where the Target Ends
function drawline() if (getPedTargetStart(localPlayer)) then --Checks if there is a Point to start From. local x,y,z = getPedTargetStart(localPlayer) -- Gets the Point to start From local sx,sy,sz = getPedTargetEnd(localPlayer) -- Gets the Point where the Target Ends dxDrawLine3D(x,y,z,sx,sy,sz) -- Draws the Line end end addEventHandler("onClientPreRender",getRootElement(),drawline) -- Adds the Handler
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