OnPedWeaponSwitch: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 25: Line 25:
addEventHandler ( "onPedWeaponSwitch", getRootElement(), weaponSwitch )
addEventHandler ( "onPedWeaponSwitch", getRootElement(), weaponSwitch )
</syntaxhighlight>
</syntaxhighlight>


{{Ped_events}}
{{Ped_events}}

Revision as of 05:38, 29 June 2009

This event is triggered when a ped switches weapons.

Parameters

int previousWeaponID, int currentWeaponID
  • previousWeaponID: An integer representing the weapon that was switched from
  • currentWeaponID: An integer 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 )