OnPlayerWeaponSwitch: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 8: | Line 8: | ||
==Variables== | ==Variables== | ||
* The source of this event is the player who switched his weapon | |||
*'''previousWeaponID''': An integer representing the weapon that was switched from | *'''previousWeaponID''': An integer representing the weapon that was switched from | ||
*'''currentWeaponID''': An integer representing the weapon that was switched to | *'''currentWeaponID''': An integer representing the weapon that was switched to |
Revision as of 14:52, 2 December 2006
This event is triggered when a player switches weapons.
Syntax
void onPlayerWeaponSwitch ( int previousWeaponID, int currentWeaponID )
Variables
- The source of this event is the player who switched his weapon
- 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