OnPedWeaponSwitch: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 8: Line 8:
</syntaxhighlight>  
</syntaxhighlight>  


*'''previousWeaponID''': An integer representing the weapon that was switched from
*'''previousWeaponID''': an [[int]] representing the weapon that was switched from.
*'''currentWeaponID''': An integer representing the weapon that was switched to
*'''currentWeaponID''': an [[int]] representing the weapon that was switched to.


==Source==
==Source==

Revision as of 21:56, 2 April 2018

This event is triggered when a ped switches weapons.

Parameters

int previousWeaponID, int currentWeaponID
  • previousWeaponID: an int representing the weapon that was switched from.
  • currentWeaponID: an int representing the weapon that was switched to.

Source

The source of this event is the ped that switched his weapon.

Example

This example outputs a line to the chat box whenever a ped changes weapons.

function weaponSwitch ( previousWeaponID, currentWeaponID )

outputChatBox("A ped switched weapons from " .. previousWeaponID .. " to " .. currentWeaponID .. "!")

end

addEventHandler ( "onPedWeaponSwitch", getRootElement(), weaponSwitch )

See Also