CanPedBeKnockedOffBike

From Multi Theft Auto: Wiki
Revision as of 18:31, 26 July 2010 by Remi-X (talk | contribs) (Example added from setPedCanBeKnockedOffBike.)
Jump to navigation Jump to search

This function checks if the given ped can fall off bikes.

Syntax

bool canPedBeKnockedOffBike ( ped thePed )         

Required Arguments

  • thePed: the ped you want to check.

Returns

Returns true if the ped can be knocked off bikes, false if he cannot or an invalid element was passed.

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