getPedWeaponMuzzlePosition
Client-side
Server-side
Shared
This page is incomplete! Help wanted!
Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.
Returns the world position of the muzzle of the weapon that a ped is currently carrying. The weapon muzzle is the end of the gun barrel where the bullets/rockets/... come out.
Syntax
getPedWeaponMuzzlePosition ( )Code Examples
client
This Example draws a red 3D-Line when a Player shoots,between the Players WeaponMuzzlePosition and the Point where the Bullet hits.[Tested]
function OnPlayerFire(w,a,aC,hX,hY,hZ,hE)-- the function to which onClientPlayerFire is attached, contains the Paramteres for the the Bullet hit Position local sx,sy,sz = getPedWeaponMuzzlePosition(source)-- get the WeaponMuzzlePosition of the Player who shot Position = {sx,sy,sz,hX,hY,hZ} -- save it in a table so we can use it later in 'onClientRender'function removeEventHandler("onClientRender",root,onRender)-- remove onClientRender-Event from function onRender to not have multiple add for same function addEventHandler("onClientRender",root,onRender) -- add the onClientRender-Event to the function onRenderend -- end of function onPlayerFireaddEventHandler("onClientPlayerWeaponFire",root,OnPlayerFire)
function onRender() -- function to which onClientRender-Event will be attached. if Position then -- check if there are Positions available local startX,startY,startZ,endX,endY,endZ = unpack(Position)-- unpack the Position table dxDrawLine3D( startX,startY,startZ,endX,endY,endZ,tocolor(200,0,0,255),3) -- draws the 3D line between start-Position and end-Position end -- end of ifend -- end of onRenderSee 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