ReloadPedWeapon: Difference between revisions
Jump to navigation
Jump to search
(New page: __NOTOC__ {{Server function}} This function makes a pedestrian reload their weapon. ==Syntax== <syntaxhighlight lang="lua"> bool reloadPedWeapon ( ped thePed ) </syntaxhighlight> ===Required Arguments=== *'''t...) |
m (→See Also) |
||
(7 intermediate revisions by 3 users not shown) | |||
Line 7: | Line 7: | ||
bool reloadPedWeapon ( ped thePed ) | bool reloadPedWeapon ( ped thePed ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[ped]]:reloadWeapon}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
Line 13: | Line 14: | ||
===Returns=== | ===Returns=== | ||
Returns ''true'' if the pedestrian was made to reload, or ''false'' if invalid arguments were passed or that pedestrian has a weapon which cannot be reloaded. | Returns ''true'' if the pedestrian was made to reload, or ''false'' if invalid arguments were passed or that pedestrian has a weapon which cannot be reloaded. | ||
'''Note:''' this will fail but return true if | |||
1) the ped is crouched and moving | |||
2) the ped is using a weapon without clip ammo (or minigun/flamethrower/fire | |||
extinguisher) | |||
3) the ped is using his weapon (shooting/aiming) | |||
4) the ped moved while crouching recently | |||
Due to these circumstances causing problems with this function | |||
==Example== | ==Example== | ||
Line 24: | Line 38: | ||
==See Also== | ==See Also== | ||
{{Ped functions}} | {{Ped functions|server}} |
Latest revision as of 22:35, 6 September 2024
This function makes a pedestrian reload their weapon.
Syntax
bool reloadPedWeapon ( ped thePed )
OOP Syntax Help! I don't understand this!
- Method: ped:reloadWeapon(...)
Required Arguments
- thePed: The ped who will reload their weapon.
Returns
Returns true if the pedestrian was made to reload, or false if invalid arguments were passed or that pedestrian has a weapon which cannot be reloaded.
Note: this will fail but return true if
1) the ped is crouched and moving
2) the ped is using a weapon without clip ammo (or minigun/flamethrower/fire extinguisher)
3) the ped is using his weapon (shooting/aiming)
4) the ped moved while crouching recently
Due to these circumstances causing problems with this function
Example
This example adds a 'reloadgun' console command that lets players reload their weapon.
function reloadGun ( sourcePlayer, command ) reloadPedWeapon ( sourcePlayer ) end addCommandHandler ( "reloadgun", reloadGun )
See Also
- getPedGravity
- reloadPedWeapon
- setPedChoking
- setPedGravity
- setPedWearingJetpack
- 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