- Documentation
- Server functions
- isPedReloadingWeapon
Function
isPedReloadingWeapon
Checks whether a ped is reloading right now. For a player it uses the state sent by their game, and it also returns true for the time set with setPedReloadingWeapon. Useful e.g. to block actions while reloading.
Syntax
bool isPedReloadingWeapon(ped ped)Arguments
pedped- A player or an NPC.
Returns
true while reloading.
Example
addCommandHandler("lecz", function(player)
if isPedReloadingWeapon(player) then return end
setElementHealth(player, 100)
end)
See also
setPedReloadingWeaponMarks a ped as reloading for the given time. It does not start any animation in the game; it is a flag for scripts read byisPedReloadingWeapon, e.g. when your own weapon system needs its own reload time. A time of 0 or less clears the flag.reloadPedWeaponMakes a ped reload the weapon it is holding, as if the reload key was pressed. On the server the order goes to the player's game; for an NPC it is stored as a reload request. On the client it only works for the local player.