OnPedWeaponReload: Difference between revisions
Jump to navigation
Jump to search
-ffs-PLASMA (talk | contribs) (Created page with "__NOTOC__ {{Server event}} This event is triggered when a ped reloads his weapons. ==Parameters== <syntaxhighlight lang="lua"> int weapon, int clip, int ammo </syntaxhighlight> *'''weapon''': an int representing the weapon that was switched from. *'''clip''': an int representing the weapon clip size. *'''ammo''': an int representing the weapon ammo. ==Source== The source of this event is the ped that reloade...") |
-ffs-PLASMA (talk | contribs) No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server event}} | {{Server event}} | ||
{{Added feature/item|1.6.1|1.6.0|22909|Event has been added.}} | |||
This event is triggered when a ped reloads his weapons. | This event is triggered when a ped reloads his weapons. | ||
Line 8: | Line 10: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
*'''weapon''': an [[int]] representing the [[weapon]] that | *'''weapon''': an [[int]] representing the [[weapon]] that has been reloaded. | ||
*'''clip''': an [[int]] representing the [[weapon]] clip size. | *'''clip''': an [[int]] representing the [[weapon]] clip size. | ||
*'''ammo''': an [[int]] representing the [[weapon]] ammo. | *'''ammo''': an [[int]] representing the [[weapon]] ammo. | ||
Line 19: | Line 21: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function weaponReload(iWeaponID, iClip, iAmmo) | function weaponReload(iWeaponID, iClip, iAmmo) | ||
outputChatBox("A ped reloaded "..getWeaponNameFromID(iWeaponID)..", clip: "..iClip..", ammo: "..iAmmo.."!"); | |||
outputChatBox("A ped reloaded "..getWeaponNameFromID(iWeaponID)..", clip: "..iClip..", ammo: "..iAmmo.."!"); | |||
end | end | ||
addEventHandler("onPedWeaponReload", root, weaponReload); | |||
addEventHandler(" | |||
</syntaxhighlight> | </syntaxhighlight> | ||
{{See also/Server event|Ped events}} | {{See also/Server event|Ped events}} |
Latest revision as of 21:19, 17 August 2025
This event is triggered when a ped reloads his weapons.
Parameters
int weapon, int clip, int ammo
- weapon: an int representing the weapon that has been reloaded.
- clip: an int representing the weapon clip size.
- ammo: an int representing the weapon ammo.
Source
The source of this event is the ped that reloaded his weapon.
Example
This example outputs a line to the chat box whenever a ped reloads weapons.
function weaponReload(iWeaponID, iClip, iAmmo) outputChatBox("A ped reloaded "..getWeaponNameFromID(iWeaponID)..", clip: "..iClip..", ammo: "..iAmmo.."!"); end addEventHandler("onPedWeaponReload", root, weaponReload);
See Also
Ped events
Event functions
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled