GetRoofPosition: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 20: Line 20:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
setTimer (
setTimer (
function ( )
function ()
local playerX, playerY, playerZ = getElementPosition ( localPlayer )
local playerX, playerY, playerZ = getElementPosition (localPlayer)
local roofZ = getRoofPosition ( playerX, playerY, playerZ )
local roofZ = getRoofPosition (playerX, playerY, playerZ)
setCameraShakeLevel ( ( roofZ ) and 0 or 255 )
setCameraShakeLevel ((roofZ) and 0 or 255 )
end, 100, 0
end, 100, 0
)
)

Revision as of 11:23, 20 September 2021

20675

Syntax

float getRoofPosition ( float x, float y, float z )

Required Arguments

  • x: A floating point number representing the X world coordinate of the point.
  • y: A floating point number representing the Y world coordinate of the point.
  • z: A floating point number representing the Z world coordinate of the point.

Returns

Returns a float with the lowest roof-level Z coord if parameters are valid, false if the point you tried to test is outside the loaded world map.

Example

This example starts to shake the player's camera if there is no roof over him.

setTimer (
	function ()
		local playerX, playerY, playerZ = getElementPosition (localPlayer)
		local roofZ = getRoofPosition (playerX, playerY, playerZ)
		setCameraShakeLevel ((roofZ) and 0 or 255 )
	end, 100, 0
)

Requirements

This template will be deleted.

See Also