onPedWeaponSwitch
Client-side
Server-side
Shared
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
element: The source of this event is the ped that switched his weapon.
Code Examples
server
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
Ped Events
Ped Functions
- createPed
- getPedAmmoInClip
- getPedArmor
- getPedFightingStyle
- getPedOccupiedVehicle
- getPedTarget
- getPedStat
- getPedOccupiedVehicleSeat
- getPedTotalAmmo
- getPedWalkingStyle
- getPedWeapon
- getPedWeaponSlot
- getValidPedModels
- isPedChoking
- isPedDead
- isPedDoingGangDriveby
- isPedDucked
- isPedHeadless
- isPedInVehicle
- isPedOnFire
- isPedOnGround
- isPedReloadingWeapon
- isPedWearingJetpack
- killPed
- removePedFromVehicle
- setPedAnimation
- setPedAnimationProgress
- setPedAnimationSpeed
- setPedArmor
- setPedDoingGangDriveby
- setPedFightingStyle
- setPedHeadless
- setPedOnFire
- setPedStat
- setPedWalkingStyle
- setPedWeaponSlot
- warpPedIntoVehicle
- IsPedFootBloodEnabled
- canPedBeKnockedOffBike
- getPedAnalogControlState
- getPedAnimation
- getPedBonePosition
- getPedCameraRotation
- getPedControlState
- getPedMoveState
- getPedSimplestTask
- getPedTargetCollision
- getPedOxygenLevel
- getPedTargetEnd
- getPedTargetStart
- getPedTask
- getPedVoice
- getPedWeaponMuzzlePosition
- givePedWeapon
- isPedBleeding
- isPedDoingTask
- isPedTargetingMarkerEnabled
- playPedVoiceLine
- resetPedVoice
- setPedAimTarget
- setPedAnalogControlState
- setPedCameraRotation
- setPedCanBeKnockedOffBike
- setPedBleeding
- setPedControlState
- setPedEnterVehicle
- setPedExitVehicle
- setPedFootBloodEnabled
- setPedLookAt
- setPedOxygenLevel
- setPedTargetingMarkerEnabled
- setPedVoice
- getPedGravity
- reloadPedWeapon
- setPedChoking
- setPedGravity
- setPedWearingJetpack