SetPlayerCanBeKnockedOffBike: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Client function}}
{{Client function}}
{{Needs_Checking|Is this correct?}}
This function controls if you can fall of your bike.
This function controls if you can fall of your bike.


Line 16: Line 15:
This example sets the canBeKnockedOff status true or false.
This example sets the canBeKnockedOff status true or false.


<syntaxhighlight lang="lua">function changeCanBeKnockedOff ( 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
status = canPlayerBeKnockedOffBike ( getLocalPlayer())
if (status == true) 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." )
  -- Get the player and set true or false
end
end
end
addCommandHandler ( "knock", changeCanBeKnockedOff )
addCommandHandler ( "knock", changeCanBeKnockedOff )

Revision as of 09:48, 17 February 2008

This function controls if you can fall of your bike.

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 sets the canBeKnockedOff status true or false.

function changeCanBeKnockedOff ( command )
-- The player should enter /knock
status = canPlayerBeKnockedOffBike ( getLocalPlayer())
 if (status == true) 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." )
  -- Get the player and set true or false
 end
end
addCommandHandler ( "knock", changeCanBeKnockedOff )

See Also