CanPlayerBeKnockedOffBike: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (Changed "DeprecatedWithAlt" template to "Deprecated")
 
(7 intermediate revisions by 5 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Client function}}
{{Client function}}
{{Needs_Checking|Can someone confirm this?}}
{{Deprecated|canPedBeKnockedOffBike|}}
This function checks if you can fall of your bike.
 
This function checks if a player can fall off bikes.


==Syntax==  
==Syntax==  
Line 12: Line 13:
*'''thePlayer:''' the player whose knockoffstatus being asked
*'''thePlayer:''' the player whose knockoffstatus being asked


==Example==  
===Returns===
Returns ''true'' if the player can be knocked off bikes, ''false'' if he can't or an invalid element was passed.
 
==Example==
This example puts the knockoff status in the chatbox.
This example puts the knockoff status in the chatbox.


<syntaxhighlight lang="lua">function canBeKnockedOff ( command )
<syntaxhighlight lang="lua">function canBeKnockedOff ( command )
-- The player should enter /knockstatus
    -- The player should enter /knockstatus
status = canPlayerBeKnockedOffBike ( getLocalPlayer())
    if canPlayerBeKnockedOffBike ( getLocalPlayer() ) then
  if (status == true) then
        outputChatBox ( "You can be knocked off your bike." )
  -- If the status is true then
    else
  outputChatBox ( "You can be knocked off your bike." )
        outputChatBox ( "You can't be knocked off your bike." )
  else
    end
  -- Otherwise
  outputChatBox ( "You can't be knocked off your bike." )
  end
end
end
addCommandHandler ( "knockstatus", canBeKnockedOff )
addCommandHandler ( "knockstatus", canBeKnockedOff )

Latest revision as of 16:33, 13 February 2015

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 canPedBeKnockedOffBike instead.


This function checks if a player can fall off bikes.

Syntax

bool canPlayerBeKnockedOffBike ( player thePlayer )         

Required Arguments

  • thePlayer: the player whose knockoffstatus being asked

Returns

Returns true if the player can be knocked off bikes, false if he can't or an invalid element was passed.

Example

This example puts the knockoff status in the chatbox.

function canBeKnockedOff ( command )
    -- The player should enter /knockstatus
    if canPlayerBeKnockedOffBike ( getLocalPlayer() ) then
        outputChatBox ( "You can be knocked off your bike." )
    else
        outputChatBox ( "You can't be knocked off your bike." )
    end
end
addCommandHandler ( "knockstatus", canBeKnockedOff )

See Also