RemovePlayerJetPack: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
{{Server function}}
__NOTOC__
__NOTOC__
This function is used to remove a player's jetpack.
This function is used to remove a player's jetpack.
Line 6: Line 7:


===Required Arguments===
===Required Arguments===
*'''player''': The [[player]] you want to remove the jetpack from.
*'''thePlayer''': The [[player]] you want to remove the jetpack from.


===Returns===
===Returns===
Returns 'true' if the player already had a jetpack, 'false' otherwise.
Returns ''true'' if the player had a jetpack, ''false'' otherwise.


==Example==
==Example==
<syntaxhighlight lang="lua"> [lua]
<syntaxhighlight lang="lua">
addCommandHandler ( "jetpack", "jetPackCommand" )
function jetPackCommand ( source, key )
function jetPackCommand ( source, key )
  if ( doesPlayerHaveJetPack ( source ) ) then -- if he has a jetpack
    if ( doesPlayerHaveJetPack ( source ) ) then -- if the player has a jetpack
    removePlayerJetPack ( source ) -- remove it
        removePlayerJetPack ( source )           -- remove it
  else
    else
    givePlayerJetPack ( source ) -- give him one
        givePlayerJetPack ( source )             -- otherwise give him one
  end
    end
end
end
addCommandHandler ( "jetpack", jetPackCommand )
</syntaxhighlight>
</syntaxhighlight>


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

Revision as of 17:44, 16 August 2007

This function is used to remove a player's jetpack.

Syntax

bool removePlayerJetPack ( player thePlayer )

Required Arguments

  • thePlayer: The player you want to remove the jetpack from.

Returns

Returns true if the player had a jetpack, false otherwise.

Example

function jetPackCommand ( source, key )
    if ( doesPlayerHaveJetPack ( source ) ) then  -- if the player has a jetpack
        removePlayerJetPack ( source )            -- remove it
    else
        givePlayerJetPack ( source )              -- otherwise give him one
    end
end
addCommandHandler ( "jetpack", jetPackCommand )

See Also