DoesPlayerHaveJetPack

From Multi Theft Auto: Wiki
Revision as of 23:17, 15 July 2007 by Talidan (talk | contribs)
Jump to navigation Jump to search

This function is used to determine whether or not a player has a jetpack.

Syntax

bool doesPlayerHaveJetPack ( player thePlayer )

Required Arguments

  • thePlayer: The player you are checking.

Returns

Returns true if a player has a jetpack, false otherwise.

Example

This examples adds a "jetpack" command in console, which gives and removes jetpacks.

 [lua]
function consoleJetPack ( player, commandName )
	if ( not doesPlayerHaveJetPack ( player ) ) then --if the player doesnt have a jetpack
		local status = givePlayerJetPack ( player ) --give him one
		if ( not status ) then
			outputConsole ( "Failed to give jetpack.", player )--tell him if it failed
		end
	else --otherwise
		local status = removePlayerJetPack ( player ) --remove his jetpack
		if ( not status ) then
			outputConsole ( "Failed to remove jetpack.", player ) --tell him if it faield
		end
	end
end
addCommandHandler ( "jetpack", consoleJetPack )

See Also