onPlayerWeaponReload | Multi Theft Auto: Wiki Skip to content

onPlayerWeaponReload

Client-side
Server-side
Shared

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

element: 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.

Code Examples

server

This example will output informations when aplayer'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