SetPedCanBeKnockedOffBike: Difference between revisions
Jump to navigation
Jump to search
Zangomangu (talk | contribs) No edit summary |
(Improve example.) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Client function}} | {{Client function}} | ||
This function controls if a ped can fall of his bike by accident - namely by banging into a wall. This | This function controls if a ped can fall of his bike by accident - namely by banging into a wall. | ||
{{Note | This effect is not synced for peds. When the ped falls off, he will not have exited the vehicle. To get it working you need to call it each time the ped is streamed in & each time it gets a new syncer.}} | |||
==Syntax== | ==Syntax== | ||
Line 18: | Line 19: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function changeCanBeKnockedOff ( | function changeCanBeKnockedOff() | ||
local canBeKnocked = canPedBeKnockedOffBike(localPlayer) | |||
local knockedText = canBeKnocked and "Now you can't be knocked off your bike." or "Now you can be knocked off your bike." | |||
setPedCanBeKnockedOffBike(localPlayer, not canBeKnocked) | |||
outputChatBox(knockedText) | |||
end | end | ||
addCommandHandler ( "knock", changeCanBeKnockedOff ) | addCommandHandler("knock", changeCanBeKnockedOff) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Client_ped_functions}} | {{Client_ped_functions}} |
Latest revision as of 05:32, 26 August 2021
This function controls if a ped can fall of his bike by accident - namely by banging into a wall.
Note: This effect is not synced for peds. When the ped falls off, he will not have exited the vehicle. To get it working you need to call it each time the ped is streamed in & each time it gets a new syncer. |
Syntax
bool setPedCanBeKnockedOffBike ( ped thePed, bool canBeKnockedOffBike )
OOP Syntax Help! I don't understand this!
- Method: ped:setCanBeKnockedOffBike(...)
- Counterpart: canPedBeKnockedOffBike
Required Arguments
- thePed: the ped whose knockoffstatus is being changed
- canBeKnockedOffBike: true or false
Example
This example adds a console command with which the local player can toggle if he can fall off bikes.
function changeCanBeKnockedOff() local canBeKnocked = canPedBeKnockedOffBike(localPlayer) local knockedText = canBeKnocked and "Now you can't be knocked off your bike." or "Now you can be knocked off your bike." setPedCanBeKnockedOffBike(localPlayer, not canBeKnocked) outputChatBox(knockedText) end addCommandHandler("knock", changeCanBeKnockedOff)
See Also
- canPedBeKnockedOffBike
- getPedAnalogControlState
- getPedAnimation
- getPedBonePosition
- getPedCameraRotation
- getPedControlState
- getPedMoveState
- getPedOxygenLevel
- getPedSimplestTask
- getPedTargetCollision
- getPedTargetEnd
- getPedTargetStart
- getPedTask
- getPedVoice
- getPedWeaponMuzzlePosition
- givePedWeapon
- isPedBleeding
- isPedDoingTask
- isPedReloadingWeapon
- isPedTargetingMarkerEnabled
- setAnalogControlState
- setPedAimTarget
- setPedAnalogControlState
- setPedBleeding
- setPedCameraRotation
- setPedCanBeKnockedOffBike
- setPedControlState
- setPedEnterVehicle
- setPedExitVehicle
- IsPedFootBloodEnabled
- setPedFootBloodEnabled
- setPedLookAt
- setPedOxygenLevel
- setPedTargetingMarkerEnabled
- setPedVoice
Shared
- addPedClothes
- getPedClothes
- removePedClothes
- createPed
- getPedAmmoInClip
- getPedArmor
- getPedFightingStyle
- getPedOccupiedVehicle
- getPedOccupiedVehicleSeat
- getPedStat
- getPedTarget
- getPedTotalAmmo
- getPedWalkingStyle
- getPedWeapon
- getPedWeaponSlot
- getPedContactElement
- getValidPedModels
- isPedChoking
- isPedDead
- isPedDoingGangDriveby
- isPedDucked
- isPedHeadless
- isPedInVehicle
- isPedOnFire
- isPedOnGround
- isPedWearingJetpack
- killPed
- removePedFromVehicle
- setPedAnimation
- setPedAnimationProgress
- setPedAnimationSpeed
- setPedArmor
- setPedDoingGangDriveby
- setPedFightingStyle
- setPedHeadless
- setPedOnFire
- setPedStat
- setPedWalkingStyle
- setPedWeaponSlot
- warpPedIntoVehicle