GetPedAmmoInClip
From Multi Theft Auto: Wiki
This function returns an integer that contains the ammo in a specified ped's weapon. See Weapon Info
Syntax
int getPedAmmoInClip ( ped thePed [, int weaponSlot = current ] )
OOP Syntax Help! I don't understand this!
- Method: ped:getAmmoInClip(...)
- Variable: .ammoInClip
Required Arguments
- thePed: The ped whose ammo you want to check.
Optional Arguments
- weaponSlot: an integer representing the weapon slot (set to the ped's currently selected slot if not specified).
Returns
Returns an int containing the amount of ammo in the specified ped's currently selected or specified clip, or 0 if the ped specified is invalid.
Example
This example outputs the amount of ammo the specified player has in his current slot. For example: 'ammo someguy'.
function showAmmo(thePlayer, command, who ) local targetPlayer = getPlayerFromName ( who ) if ( thePlayer ) then local ammo = getPedAmmoInClip ( targetPlayer ) outputChatBox ( who .. " has " .. ammo .. " ammo in his active clip" ) else outputChatBox ( "Player '" .. who .. "' not found." ) end end addCommandHandler( "ammo", showAmmo )
Issues
Issue ID | Description |
---|---|
#7719 | getPedTotalAmmo() & getPedAmmoInClip() serverside sometimes return invalid values |
See Also
- getPedAmmoInClip
- getPedAnalogControlState
- getPedAnimation
- getPedArmor
- getPedBonePosition
- getPedCameraRotation
- getPedClothes
- getPedContactElement
- getPedControlState
- getPedFightingStyle
- getPedMoveState
- getPedOccupiedVehicle
- getPedOccupiedVehicleSeat
- getPedOxygenLevel
- getPedSimplestTask
- getPedStat
- getPedTarget
- getPedTargetCollision
- getPedTargetEnd
- getPedTargetStart
- getPedTask
- getPedTotalAmmo
- getPedVoice
- getPedWalkingStyle
- getPedWeapon
- getPedWeaponMuzzlePosition
- getPedWeaponSlot
- getValidPedModels
- givePedWeapon
- isPedChoking
- isPedDead
- isPedDoingGangDriveby
- isPedDoingTask
- isPedDucked
- isPedHeadless
- isPedInVehicle
- isPedOnFire
- isPedOnGround
- isPedWearingJetpack
- killPed
- removePedClothes
- removePedFromVehicle
- setAnalogControlState
- setPedAimTarget
- setPedAnalogControlState
- setPedAnimation
- setPedAnimationProgress
FROM VERSION 1.5.7 r19626 ONWARDS
FROM VERSION 1.5.7 r19626 ONWARDS