Difference between revisions of "SetJetpackMaxHeight"

From Multi Theft Auto: Wiki
(New page: __NOTOC__ {{Client function}} This function can be used to change jetpacks max flying height. ==Syntax== <syntaxhighlight lang="lua"> bool setJetpackMaxHeight ( float Height ) </syntaxhighlight> ===Required Argumen...)
 
 
(10 intermediate revisions by 7 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
{{Client function}}
+
{{Server client function}}
This function can be used to change jetpacks max flying height.
+
This function changes the maximum flying height of jetpack.
  
 
==Syntax==
 
==Syntax==
Line 9: Line 9:
  
 
===Required Arguments===
 
===Required Arguments===
*'''Height''': todo
+
*'''Height''': The max height starting at approximately -20.
  
 
===Returns===
 
===Returns===
Line 15: Line 15:
  
 
==Example==
 
==Example==
 
+
<section name="Client" class="client" show="true">
TODO
+
This example shows you a command to set your maximum jetpack height.
 
+
<syntaxhighlight lang="lua">
 +
function setMyMaxHeight ( cmd, value )
 +
local height = tonumber ( value ) -- Get the number of the value
 +
if height > -20 then -- If the height is higher than -20
 +
local succes = setJetpackMaxHeight ( height ) -- Set the maximum height
 +
if succes then -- If it's succesfully changed
 +
outputChatBox ( "You've set you maximum jetpack height to "..height.."!", 0, 255, 0 ) -- Send the client a succes message
 +
else -- If there was something wrong
 +
outputChatBox ( "Failed to set your maximum jetpack height to "..height.."!", 255, 0, 0 ) -- Send the client an error message
 +
end
 +
else -- If the given value was below -20
 +
outputChatBox ( "Failed to change you jetpack height! Please use a number above -20." , 255, 0, 0 ) -- Send the client an error message
 +
end
 +
end
 +
addCommandHandler ( "maxheight", setMyMaxHeight ) -- Add the command handler
 +
</syntaxhighlight>
 +
</section>
  
 
==See Also==
 
==See Also==
 
{{Client_world_functions}}
 
{{Client_world_functions}}

Latest revision as of 16:20, 5 August 2012

This function changes the maximum flying height of jetpack.

Syntax

bool setJetpackMaxHeight ( float Height )

Required Arguments

  • Height: The max height starting at approximately -20.

Returns

Returns true if successful, false otherwise.

Example

Click to collapse [-]
Client

This example shows you a command to set your maximum jetpack height.

function setMyMaxHeight ( cmd, value )
	local height = tonumber ( value ) -- Get the number of the value
	if height > -20 then -- If the height is higher than -20
		local succes = setJetpackMaxHeight ( height ) -- Set the maximum height
		if succes then -- If it's succesfully changed
			outputChatBox ( "You've set you maximum jetpack height to "..height.."!", 0, 255, 0 ) -- Send the client a succes message
		else -- If there was something wrong
			outputChatBox ( "Failed to set your maximum jetpack height to "..height.."!", 255, 0, 0 ) -- Send the client an error message
		end
	else -- If the given value was below -20
		outputChatBox ( "Failed to change you jetpack height! Please use a number above -20." , 255, 0, 0 ) -- Send the client an error message
	end
end
addCommandHandler ( "maxheight", setMyMaxHeight ) -- Add the command handler

See Also

BETA: FROM VERSION 1.5.7 r20450 ONWARDS