SetPlayerCanBeKnockedOffBike: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
m (Tweaked Example)
Line 16: Line 16:


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

Revision as of 12:03, 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.

local player = getLocalPlayer()
function changeCanBeKnockedOff ( command )
-- The player should enter /knock
status = canPlayerBeKnockedOffBike (player)
 if (status == true) then
  setPlayerCanBeKnockedOffBike (player, false )
  outputChatBox ( "Now you can't be knocked off your bike." )
  else
  setPlayerCanBeKnockedOffBike (player, 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

Shared