DoesPlayerHaveJetPack: Difference between revisions
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
		
	
No edit summary  | 
				|||
| Line 12: | Line 12: | ||
==Example==  | ==Example==  | ||
This examples adds a "jetpack" command in console, which gives and removes jetpacks.  | |||
<syntaxhighlight lang="lua"> [lua]  | <syntaxhighlight lang="lua"> [lua]  | ||
function consoleJetPack ( player, commandName )  | |||
function   | 	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  | end  | ||
addCommandHandler ( "jetpack", consoleJetPack )  | |||
</syntaxhighlight>  | </syntaxhighlight>  | ||
==See Also==  | ==See Also==  | ||
{{Player functions}}  | {{Player functions}}  | ||
Revision as of 23:17, 15 July 2007
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
- getPlayerTeam
 - getPlayerBlurLevel
 - setPlayerBlurLevel
 - getPlayerSerial
 - forcePlayerMap
 - getPlayerScriptDebugLevel
 - getPlayerFromName
 - getPlayerMoney
 - getPlayerName
 - getPlayerNametagColor
 - getPlayerNametagText
 - getPlayerPing
 - getPlayerWantedLevel
 - givePlayerMoney
 - isPlayerMapForced
 - isPlayerNametagShowing
 - setPlayerHudComponentVisible
 - setPlayerMoney
 - setPlayerNametagColor
 - setPlayerNametagShowing
 - setPlayerNametagText
 - takePlayerMoney
 - countPlayersInTeam
 - getPlayersInTeam
 - isVoiceEnabled
 - setControlState
 - getControlState