SetPedCanBeKnockedOffBike: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Undo revision 64854 by Zangomangu (talk))
Tag: Undo
No edit summary
Line 2: Line 2:
{{Client function}}
{{Client function}}
This function controls if a ped can fall of his bike by accident - namely by banging into a wall.
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==  

Revision as of 00:21, 5 January 2020

This function controls if a ped can fall of his bike by accident - namely by banging into a wall.

[[{{{image}}}|link=|]] 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 ( command )
    -- The player should enter /knock
    if canPedBeKnockedOffBike ( getLocalPlayer() ) then
        setPedCanBeKnockedOffBike ( getLocalPlayer(), false )
        outputChatBox ( "Now you can't be knocked off your bike." )
    else
        setPedCanBeKnockedOffBike ( getLocalPlayer(), true )
        outputChatBox ( "Now you can be knocked off your bike." )
    end
end
addCommandHandler ( "knock", changeCanBeKnockedOff )

See Also