OnPlayerWeaponSwitch
Jump to navigation
Jump to search
This event is triggered when a player switches weapons.
Syntax
void onPlayerWeaponSwitch ( int previousWeaponID, int currentWeaponID )
Variables
- previousWeaponID: An integer representing the weapon that was switched from
- currentWeaponID: An integer representing the weapon that was switched to
Example
This example disables use of the minigun
--add an event handler for onPlayerWeaponSwitch addEventHandler ( "onPlayerWeaponSwitch", getRootElement(), "weaponSwitchDisableMinigun" ) function weaponSwitchDisableMinigun ( previousWeaponID, currentWeaponID ) --when a player switches his weapon if currentWeaponID == 38 then --if the weapon ID is minigun toggleControl ( source, "fire", false ) --disable the fire button else --otherwise toggleControl ( source, "fire", true ) --enable it end
See Also
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled