GetGarageBoundingBox: Difference between revisions
Jump to navigation
Jump to search
(New page: __NOTOC__ {{client function}} This function outputs the bounding box of a garage. ==Syntax== <syntaxhighlight lang="lua"> float, float, float, float getGarageBoundingBox ( int garageID ) </syntaxhighlight> ==...) |
|||
(4 intermediate revisions by 3 users not shown) | |||
Line 13: | Line 13: | ||
===Returns=== | ===Returns=== | ||
Returns four ''float''s indicating the bounding box of the garage. | Returns four ''float''s indicating the bounding box of the garage. | ||
''Western X position, Eastern X position, Southern Y position, Northern Y position.'' | ''Western X position, Eastern X position, Southern Y position, Northern Y position,, false when invalid garageID was provided.'' | ||
==Example== | ==Example== | ||
<section name="Client" class="client" show="true"> | <section name="Client" class="client" show="true"> | ||
Checks if the player is inside the bounding box of the garage and outputs the result to the chat | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- | function garageCheck ( command, garageID ) | ||
if not garageID then | |||
return | |||
end | |||
local west, east, south, north = getGarageBoundingBox ( garageID ) --get the bounding box of the specified garage | |||
local x, y, z = getElementPosition ( getLocalPlayer ( ) ) --get the position of the player | |||
if x > west and x < east and y > south and y < north then --check if the player is inside the bounding box | |||
outputChatBox ( "You are inside the garage" ) | |||
else | |||
outputChatBox ( "You are outside the garage" ) | |||
end | |||
end | |||
addCommandHandler ( "garagecheck", garageCheck ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | </section> | ||
Line 25: | Line 40: | ||
==See Also== | ==See Also== | ||
{{World functions}} | {{World functions}} | ||
Revision as of 03:43, 25 September 2018
This function outputs the bounding box of a garage.
Syntax
float, float, float, float getGarageBoundingBox ( int garageID )
Required Arguments
- garageID: The garage ID that represents the garage door that is being checked.
Returns
Returns four floats indicating the bounding box of the garage. Western X position, Eastern X position, Southern Y position, Northern Y position,, false when invalid garageID was provided.
Example
Click to collapse [-]
ClientChecks if the player is inside the bounding box of the garage and outputs the result to the chat
function garageCheck ( command, garageID ) if not garageID then return end local west, east, south, north = getGarageBoundingBox ( garageID ) --get the bounding box of the specified garage local x, y, z = getElementPosition ( getLocalPlayer ( ) ) --get the position of the player if x > west and x < east and y > south and y < north then --check if the player is inside the bounding box outputChatBox ( "You are inside the garage" ) else outputChatBox ( "You are outside the garage" ) end end addCommandHandler ( "garagecheck", garageCheck )
See Also
- areTrafficLightsLocked
- getAircraftMaxVelocity
- getCloudsEnabled
- getFarClipDistance
- getFogDistance
- getGameSpeed
- getGravity
- getHeatHaze
- getJetpackMaxHeight
- getJetpackWeaponEnabled
- getMinuteDuration
- getMoonSize
- getOcclusionsEnabled
- getRainLevel
- getSkyGradient
- getSunColor
- getSunSize
- getTime
- getTrafficLightState
- getWeather
- getWindVelocity
- getZoneName
- isGarageOpen
- removeWorldModel
- resetColorFilter
- resetFarClipDistance
- resetFogDistance
- resetHeatHaze
- resetMoonSize
- resetRainLevel
- resetSkyGradient
- resetSunColor
- resetSunSize
- resetWindVelocity
- restoreAllWorldModels
- restoreWorldModel
- setAircraftMaxVelocity
- setCloudsEnabled
- setColorFilter
- setFarClipDistance
- setFogDistance
- setGameSpeed
- setGarageOpen
- setGravity
- setHeatHaze
- setInteriorSoundsEnabled
- setJetpackWeaponEnabled
- setMinuteDuration
- setMoonSize
- setOcclusionsEnabled
- setRainLevel
- setSkyGradient
- setSunColor
- setSunSize
- setTime
- setTrafficLightState
- setTrafficLightsLocked
- setWeather
- setWeatherBlended
- setWindVelocity