SetPlayerCanBeKnockedOffBike: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(Deprecated function)
 
(8 intermediate revisions by 6 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Client function}}
{{Client function}}
{{Needs_Checking|Is this correct?}}
{{Deprecated|setPedCanBeKnockedOffBike}}
This function controls if you can fall of your bike.
 
This function controls if you can fall of your bike by accident - namely by banging into a wall.


==Syntax==  
==Syntax==  
Line 14: Line 15:


==Example==  
==Example==  
This example sets the canBeKnockedOff status true or false.
This example allows the local player to toggle whether or not he can fall of bikes.


<syntaxhighlight lang="lua">function canBeKnockedOff ( command, state )
<syntaxhighlight lang="lua">
-- The player should enter /knock true or /knock false
function changeCanBeKnockedOff ( command )
setPlayerCanBeKnockedOffBike ( getLocalPlayer(), state )
    -- The player should enter /knock
-- Get the player and set true or false
    if canPedBeKnockedOffBike ( getLocalPlayer() ) then
        setPlayerCanBeKnockedOffBike ( getLocalPlayer(), false )
        outputChatBox ( "Now you can't be knocked off your bike." )
    else
        setPlayerCanBeKnockedOffBike ( getLocalPlayer(), true )
        outputChatBox ( "Now you can be knocked off your bike." )
    end
end
end
addCommandHandler ( "knock", canBeKnockedOff )
addCommandHandler ( "knock", changeCanBeKnockedOff )
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{Player functions}}
{{Player functions}}

Latest revision as of 01:07, 11 September 2016

Emblem-important.png This function is deprecated. This means that its use is discouraged and that it might not exist in future versions.

Please use setPedCanBeKnockedOffBike instead.


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

Syntax

bool setPlayerCanBeKnockedOffBike ( player thePlayer, bool canBeKnockedOffBike )         

Required Arguments

  • thePlayer: the player whose knockoffstatus being changed
  • state: the true or false state

Example

This example allows the local player to toggle whether or not he can fall of bikes.

function changeCanBeKnockedOff ( command )
    -- The player should enter /knock
    if canPedBeKnockedOffBike ( getLocalPlayer() ) then
        setPlayerCanBeKnockedOffBike ( getLocalPlayer(), false )
        outputChatBox ( "Now you can't be knocked off your bike." )
    else
        setPlayerCanBeKnockedOffBike ( getLocalPlayer(), true )
        outputChatBox ( "Now you can be knocked off your bike." )
    end
end
addCommandHandler ( "knock", changeCanBeKnockedOff )

See Also