SetPedCanBeKnockedOffBike

From Multi Theft Auto: Wiki
Revision as of 18:17, 30 March 2008 by Arc (talk | contribs) (New page: __NOTOC__ {{Client function}} This function controls if a ped can fall of his bike by accident - namely by banging into a wall. ==Syntax== <syntaxhighlight lang="lua"> bool setPedCanBeKnockedOffBike ( ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

Syntax

bool setPedCanBeKnockedOffBike ( ped thePed, bool canBeKnockedOffBike )         

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.

local player = getLocalPlayer()
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