OnPlayerWeaponReload

From Multi Theft Auto: Wiki
Jump to navigation Jump to search

BETA: NEW FEATURE (BUILD: 1.6.0 r22909)
This event is triggered when a player is reloading their weapon.

Parameters

int weapon, int ammoInClip, int ammo
  • weapon: an int representing weapon used for firing a shot.
  • ammoInClip: an int amount of ammo left for this weapon type in clip.
  • ammo: an int amount of ammo left for this weapon type.


Source

The source of this event is the player who's reloading their weapon.

Canceling

If this event is canceled, then the players will not be able to reload their weapon manually by pressing R key. The weapons will still reload when the ammoInClip reaches zero. Using quickreload will also reload the weapon.

Example

This example will output informations when a player's weapon is reloading.

addEventHandler("onPlayerWeaponReload", root, function(weapon, ammoInClip, ammo) 
    outputChatBox(getPlayerName(source) .. " is reloading their weapon: ")
    outputChatBox("Weapon: " .. getWeaponNameFromID(weapon))
    outputChatBox("AmmoInClip: " .. ammoInClip)
    outputChatBox("Ammo: " .. ammo)
end)

See Also

Player events


Event functions