IsPedReloadingWeapon: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
m (Switched the outputChatBox message in the example so that it now correctly displays whether the player is (not) reloading a weapon.) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Client function}} | {{Client function}} | ||
{{New | {{New feature/item|3.0156|1.5.5|11856| | ||
This function is used to determine whether or not a ped is currently reloading their weapon. Useful to stop certain quick reload exploits. | This function is used to determine whether or not a ped is currently reloading their weapon. Useful to stop certain quick reload exploits.}} | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
Line 17: | Line 17: | ||
==Example== | ==Example== | ||
This example checks if the player who enters the ''/amireloading'' command is reloading and outputs a message. | |||
This example checks if the player who enters the 'amireloading' command is reloading and outputs a message. | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function isHeReloading() | function isHeReloading( ) | ||
if isPedReloadingWeapon ( localPlayer) then | if isPedReloadingWeapon( localPlayer ) then | ||
outputChatBox ( " | outputChatBox( "You are reloading a weapon" ) | ||
else | else | ||
outputChatBox ( " | outputChatBox( "No, you're not reloading a weapon" ) | ||
end | end | ||
end | end | ||
addCommandHandler ( "amireloading", isHeReloading) | addCommandHandler( "amireloading", isHeReloading ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Client_ped_functions}} | {{Client_ped_functions}} |
Latest revision as of 09:48, 30 June 2020
This function is used to determine whether or not a ped is currently reloading their weapon. Useful to stop certain quick reload exploits.
Syntax
bool isPedReloadingWeapon ( ped thePed )
OOP Syntax Help! I don't understand this!
- Method: ped:isReloadingWeapon(...)
- Variable: .reloadingWeapon
Required Arguments
- thePed: The ped you are checking.
Returns
Returns true if the ped is currently reloading a weapon, false otherwise.
Example
This example checks if the player who enters the /amireloading command is reloading and outputs a message.
function isHeReloading( ) if isPedReloadingWeapon( localPlayer ) then outputChatBox( "You are reloading a weapon" ) else outputChatBox( "No, you're not reloading a weapon" ) end end addCommandHandler( "amireloading", isHeReloading )
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