setPedCanBeKnockedOffBike | Multi Theft Auto: Wiki Skip to content

setPedCanBeKnockedOffBike

Client-side
Server-side
Shared

Pair: canPedBeKnockedOffBike

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


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.

Note

The ped will not get knocked off a bike that is set damage proof through setVehicleDamageProof . Refer to the note on that method for more information.

Syntax

setPedCanBeKnockedOffBike ( )

Code Examples

client

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